[ovirt-users] Help with a vdsm hook script script?

Simone Tiraboschi stirabos at redhat.com
Fri Jun 12 09:46:12 UTC 2015



----- Original Message -----
> From: "Karli Sjöberg" <karli.sjoberg at slu.se>
> To: "Paul Jansen" <vlaero at yahoo.com.au>
> Cc: "Users" <users at ovirt.org>
> Sent: Friday, June 12, 2015 9:03:01 AM
> Subject: Re: [ovirt-users] Help with a vdsm hook script script?
> 
> fre 2015-06-12 klockan 06:34 +0000 skrev Paul Jansen:
> > 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'.
> 
> Haven´t looked at the code, but I have a silly question. Are you sure
> the VM is configured with virtio-scsi and not virtio-blk? Could be one
> of those "d'oh!" moments...
> 
> /K
> 
> > 
> > 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.5
> > 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.
> > 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')

controller.setAttribute('model','ich9-ahci')

> > 
> >         hooking.write_domxml(domxml)
> > 
> > 
> > if __name__ == '__main__':
> >     main()
> > 
> > 
> > _______________________________________________
> > Users mailing list
> > Users at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>



More information about the Users mailing list