<html><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:16px"><div dir="ltr" id="yui_3_16_0_1_1434089995415_2277"><span id="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 script working.</span></div><div id="yui_3_16_0_1_1434089995415_2366" dir="ltr"><br><span></span></div><div id="yui_3_16_0_1_1434089995415_2289" dir="ltr"><span id="yui_3_16_0_1_1434089995415_2310">What it is supposed 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="yui_3_16_0_1_1434089995415_2311" dir="ltr"><span id="yui_3_16_0_1_1434089995415_2310"></span></div><div id="yui_3_16_0_1_1434089995415_2338" dir="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 where I'm doing this testing. I've set the perms to 755.</div><div id="yui_3_16_0_1_1434089995415_2389" dir="ltr">I've also added the custom property to my engine like so: engine-config -s UserDefinedVMProperties='change_scsi_controller=.*' --cver=3.5</div><div id="yui_3_16_0_1_1434089995415_2423" dir="ltr">I'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. I've put a string into the 'change_scsi_controller' property and booted up the VM.</div><div id="yui_3_16_0_1_1434089995415_2453" dir="ltr">The scsi controller model is not changed from 'virtio-scsi' to 'ich9-ahci'<br></div><div style="" class="" id="yui_3_16_0_1_1434089995415_2338" dir="ltr"> </div><div id="yui_3_16_0_1_1434089995415_2535" style="" class="" dir="ltr">On the host when I look at '/var/log/vdsm/vdsm.log' I can see 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 wrong here? Is it an issue with my python hook script?</div><div id="yui_3_16_0_1_1434089995415_2562" style="" class="" dir="ltr"><br></div><div id="yui_3_16_0_1_1434089995415_2593" style="" class="" dir="ltr">I'm wanting to test an EL5 based install with a scsi disk, and EL5 does not support virtio-scsi.<br></div><div id="yui_3_16_0_1_1434089995415_2701" style="" class="" dir="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 likely 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="yui_3_16_0_1_1434089995415_2702" style="" class="" dir="ltr"><br></div><div id="yui_3_16_0_1_1434089995415_2703" style="" class="" dir="ltr">Here's the hook script code:</div><div id="yui_3_16_0_1_1434089995415_2635" style="" class="" dir="ltr"><br></div><div id="yui_3_16_0_1_1434089995415_2636" style="" class="" dir="ltr"><br></div><div id="yui_3_16_0_1_1434089995415_2637" style="" class="" dir="ltr">#!/usr/bin/python<br style="" class=""> <br style="" class="">import os<br style="" class="">import hooking<br style="" class=""> <br style="" class="">def main():<br style="" class=""> <br style="" class=""> if hooking.tobool(os.environ.get('change_scsi_controller')):<br style="" class=""> newscsiadapter = hooking.read_json()<br style="" class=""> domxml = hooking.read_domxml()<br style="" class=""><br style="" class=""> for controller in domxml.getElementsByTagName('controller'):<br style="" class=""> filterValue = controller.getAttribute('model')<br style="" class=""> if filterValue == 'virtio-scsi':<br style="" class=""> filterValue.setAttribute('model','ich9-ahci')<br style="" class=""><br style="" class=""> hooking.write_domxml(domxml)<br style="" class=""><br style="" class=""><br style="" class="">if __name__ == '__main__':<br style="" class=""> main()<br style="" class=""><br></div></div></body></html>