I have not coded much python, but I'm having a go at trying to get a vdsm hook script working. 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'.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.I've also added the custom property to my engine like so: engine-config -s UserDefinedVMProperties='change_scsi_controller=.*' --cver=3.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. 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' 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? 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. 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 import os import hooking def main(): if hooking.tobool(os.environ.get('change_scsi_controller')): newscsiadapter = hooking.read_json() domxml = hooking.read_domxml() for controller in domxml.getElementsByTagName('controller'): filterValue = controller.getAttribute('model') if filterValue == 'virtio-scsi': filterValue.setAttribute('model','ich9-ahci') hooking.write_domxml(domxml) if __name__ == '__main__': main()
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users