------=_Part_1839633_221010509.1434090878897
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I have not coded much python, but I'm having a go at trying to get a vdsm h=
ook script working.
What it is supposed to do is look for a controller of model 'virtio-scsi' i=
n the domxml and change the model to 'ich9-ahci'.I've named the script
'50_=
change_scsi_controller' and have placed it in '/usr/libexec/vdsm/hooks/befo=
re_vm_start' on the one (and only) host in the cluster where I'm doing this=
testing.=C2=A0 I've set the perms to 755.I've also added the custom proper=
ty to my engine like so: engine-config -s UserDefinedVMProperties=3D'change=
_scsi_controller=3D.*' --cver=3D3.5I've restarted the ovirt-engine like so =
'service ovirt-engine restart' , and can now see the custom property in the=
GUI config for a powered off VM that is set to boot up into my cluster.=C2=
=A0 I've put a string into the 'change_scsi_controller' property and booted=
up the VM.The scsi controller model is not changed from 'virtio-scsi' to '=
ich9-ahci'
=C2=A0On the host when I look at '/var/log/vdsm/vdsm.log' I can see tha tth=
e hook is getting called, but I'm not sure what I need to look at here spec=
ifically?=C2=A0 Can anyone assist and possibly tell me what is wrong here? =
Is it an issue with my python hook script?
I'm wanting to test an EL5 based install with a scsi disk, and EL5 does not=
support virtio-scsi.
I should also mention that I know there are issues with migrating VMs that =
use the ich9-ahci sata controller and I don't plan to use this long term.=
=C2=A0 If I do need this functionality I'll likely set up some Fedora hosts=
in another cluster and use one of the other scsi controller types instead =
- ie: 'lsi53c810"', 'lsi53c895a', 'megasas',
'pvscsi'.
Here's the hook script code:
#!/usr/bin/python
=C2=A0
import os
import hooking
=C2=A0
def main():
=C2=A0
=C2=A0=C2=A0=C2=A0 if hooking.tobool(os.environ.get('change_scsi_controller=
')):
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 newscsiadapter =3D hooking.read_=
json()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 domxml =3D hooking.read_domxml()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for controller in domxml.getElem=
entsByTagName('controller'):
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 filterVa=
lue =3D controller.getAttribute('model')
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if filte=
rValue =3D=3D 'virtio-scsi':
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 filterValue.setAttribute('model','ich9-ahci')
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 hooking.write_domxml(domxml)
if __name__ =3D=3D '__main__':
=C2=A0=C2=A0=C2=A0 main()
------=_Part_1839633_221010509.1434090878897
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html><body><div style=3D"color:#000; background-color:#fff;
font-family:He=
lvetica Neue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial,=
Lucida Grande, Sans-Serif;font-size:16px"><div dir=3D"ltr"
id=3D"yui_3_16_=
0_1_1434089995415_2277"><span
id=3D"yui_3_16_0_1_1434089995415_2464">I have=
not coded much python, but I'm having a go at trying to get a vdsm hook sc=
ript working.</span></div><div
id=3D"yui_3_16_0_1_1434089995415_2366" dir=
=3D"ltr"><br><span></span></div><div
id=3D"yui_3_16_0_1_1434089995415_2289"=
dir=3D"ltr"><span
id=3D"yui_3_16_0_1_1434089995415_2310">What it is suppos=
ed to do is look for a controller of model 'virtio-scsi' in the domxml and =
change the model to 'ich9-ahci'.</span></div><div
id=3D"yui_3_16_0_1_143408=
9995415_2311" dir=3D"ltr"><span
id=3D"yui_3_16_0_1_1434089995415_2310"></sp=
an></div><div id=3D"yui_3_16_0_1_1434089995415_2338"
dir=3D"ltr">I've named=
the script '50_change_scsi_controller' and have placed it in '/usr/libexec=
/vdsm/hooks/before_vm_start' on the one (and only) host in the cluster wher=
e I'm doing this testing. I've set the perms to 755.</div><div
id=3D"=
yui_3_16_0_1_1434089995415_2389" dir=3D"ltr">I've also added the
custom pro=
perty to my engine like so: engine-config -s UserDefinedVMProperties=3D'cha=
nge_scsi_controller=3D.*' --cver=3D3.5</div><div
id=3D"yui_3_16_0_1_1434089=
995415_2423" dir=3D"ltr">I've restarted the ovirt-engine like so
'service o=
virt-engine restart' , and can now see the custom property in the GUI confi=
g for a powered off VM that is set to boot up into my cluster. I've p=
ut a string into the 'change_scsi_controller' property and booted up the VM=
.</div><div id=3D"yui_3_16_0_1_1434089995415_2453"
dir=3D"ltr">The scsi con=
troller model is not changed from 'virtio-scsi' to
'ich9-ahci'<br></div><di=
v style=3D"" class=3D""
id=3D"yui_3_16_0_1_1434089995415_2338" dir=3D"ltr">=
</div><div id=3D"yui_3_16_0_1_1434089995415_2535"
style=3D"" class=3D=
"" dir=3D"ltr">On the host when I look at
'/var/log/vdsm/vdsm.log' I can se=
e tha tthe hook is getting called, but I'm not sure what I need to look at =
here specifically? Can anyone assist and possibly tell me what is wro=
ng here? Is it an issue with my python hook script?</div><div
id=3D"yui_3_1=
6_0_1_1434089995415_2562" style=3D"" class=3D""
dir=3D"ltr"><br></div><div =
id=3D"yui_3_16_0_1_1434089995415_2593" style=3D"" class=3D""
dir=3D"ltr">I'=
m wanting to test an EL5 based install with a scsi disk, and EL5 does not s=
upport virtio-scsi.<br></div><div
id=3D"yui_3_16_0_1_1434089995415_2701" st=
yle=3D"" class=3D"" dir=3D"ltr">I should also mention
that I know there are=
issues with migrating VMs that use the ich9-ahci sata controller and I don=
't plan to use this long term. If I do need this functionality I'll l=
ikely set up some Fedora hosts in another cluster and use one of the other =
scsi controller types instead - ie: 'lsi53c810"', 'lsi53c895a',
'megasas', =
'pvscsi'.</div><div id=3D"yui_3_16_0_1_1434089995415_2702"
style=3D"" class=
=3D"" dir=3D"ltr"><br></div><div
id=3D"yui_3_16_0_1_1434089995415_2703" sty=
le=3D"" class=3D"" dir=3D"ltr">Here's the hook script
code:</div><div id=3D=
"yui_3_16_0_1_1434089995415_2635" style=3D"" class=3D""
dir=3D"ltr"><br></d=
iv><div id=3D"yui_3_16_0_1_1434089995415_2636" style=3D""
class=3D"" dir=3D=
"ltr"><br></div><div
id=3D"yui_3_16_0_1_1434089995415_2637" style=3D"" clas=
s=3D"" dir=3D"ltr">#!/usr/bin/python<br style=3D""
class=3D""> <br sty=
le=3D"" class=3D"">import os<br style=3D""
class=3D"">import hooking<br sty=
le=3D"" class=3D""> <br style=3D""
class=3D"">def main():<br style=3D"=
" class=3D""> <br style=3D""
class=3D""> if hooking.=
tobool(os.environ.get('change_scsi_controller')):<br style=3D""
class=3D"">=
newscsiadapter =3D
hooking.read_=
json()<br style=3D""
class=3D"">
=
domxml =3D hooking.read_domxml()<br style=3D"" class=3D""><br
style=3D"" cl=
ass=3D"">
for controller in domxm=
l.getElementsByTagName('controller'):<br style=3D""
class=3D""> =
filterValue =3D cont=
roller.getAttribute('model')<br style=3D""
class=3D""> &nb=
sp; if filterValue
=3D=3D 'virtio=
-scsi':<br style=3D""
class=3D""> =
filterValue.setAttribute('=
model','ich9-ahci')<br style=3D"" class=3D""><br
style=3D"" class=3D"">&nbs=
p;
hooking.write_domxml(domxml)<br styl=
e=3D"" class=3D""><br style=3D""
class=3D""><br style=3D"" class=3D"">if __=
name__ =3D=3D '__main__':<br style=3D""
class=3D""> main(=
)<br style=3D""
class=3D""><br></div></div></body></html>
------=_Part_1839633_221010509.1434090878897--