[Users] modifying vmdisk hook

This is a multi-part message in MIME format. --------------010501010600070107060506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hello, I'm testing hooks in vdsm and I need some help on modifying one of your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_...) the hook works great and I'm able now to attach a file device as a second disk. But I want this disk to be the first bootable disk instead of the block device one created into the engine. In order to change the boot order of the disk, I added those lines: ... source = domxml.createElement('source') source.setAttribute('file', devpath) disk.appendChild(source) boot = domxml.createElement('boot') boot.setAttribute('order', 1) disk.appendChild(boot) # find a name for vdXXX ..... So the hook permit <boot order=1> item (http://libvirt.org/formatdomain.html#elementsDisks) But the vm refuses booting without any logs anywhere... What is wrong? Thanks for your help -- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr --------------010501010600070107060506 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> Hello,<br> <br> I'm testing hooks in vdsm and I need some help on modifying one of your pyhton script : vmdisk (<a class="moz-txt-link-freetext" href="http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3">http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3</a>)<br> the hook works great and I'm able now to attach a file device as a second disk. But I want this disk to be the first bootable disk instead of the block device one created into the engine. In order to change the boot order of the disk, I added those lines: <br> <br> ...<br> source = domxml.createElement('source')<br> source.setAttribute('file', devpath)<br> disk.appendChild(source)<br> <br> <font color="#ff0000"><big>boot = domxml.createElement('boot')<br> boot.setAttribute('order', 1)<br> disk.appendChild(boot)</big></font><br> <br> # find a name for vdXXX<br> .....<br> <br> So the hook permit <boot order=1> item (<a class="moz-txt-link-freetext" href="http://libvirt.org/formatdomain.html#elementsDisks">http://libvirt.org/formatdomain.html#elementsDisks</a>)<br> <br> But the vm refuses booting without any logs anywhere...<br> <br> What is wrong?<br> <br> Thanks for your help<br> <pre class="moz-signature" cols="72">-- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 <a class="moz-txt-link-abbreviated" href="mailto:blanchet@abes.fr">blanchet@abes.fr</a> </pre> </body> </html> --------------010501010600070107060506--

On 04.06.12 17:03, Nathanaël Blanchet wrote: > Hello, > > I'm testing hooks in vdsm and I need some help on modifying one of > your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3) > the hook works great and I'm able now to attach a file device as a > second disk. But I want this disk to be the first bootable disk > instead of the block device one created into the engine. In order to > change the boot order of the disk, I added those lines: > > ... > source = domxml.createElement('source') > source.setAttribute('file', devpath) > disk.appendChild(source) > > boot = domxml.createElement('boot') > boot.setAttribute('order', 1) > disk.appendChild(boot) > > # find a name for vdXXX > ..... > > So the hook permit <boot order=1> item > (http://libvirt.org/formatdomain.html#elementsDisks) > > But the vm refuses booting without any logs anywhere... > > What is wrong? > > Thanks for your help Hi, 1. try to change the number to string: boot.setAttribute('order', '1') 2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log 3. when the script enumerate all the disks you need to change the other disk boot order: for d in xmldisks: # here look in each disk for boot element and change its order attribute # to other number, ie 2, 3 ... > > -- > Nathanaël Blanchet > > Supervision réseau > Pôle exploitation et maintenance > Département des systèmes d'information > 227 avenue Professeur-Jean-Louis-Viala > 34193 MONTPELLIER CEDEX 5 > Tél. 33 (0)4 67 54 84 55 > Fax 33 (0)4 67 54 84 14 > blanchet@abes.fr >

Hi, when executing several hook, I always have this issue in the vdsm logs : File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, in <module> from vdsm import utils ImportError: No module named vdsm and the vm refuses to boot how to correct this ? Le 04/06/2012 17:16, Shahar Havivi a écrit : > On 04.06.12 17:03, Nathanaël Blanchet wrote: >> Hello, >> >> I'm testing hooks in vdsm and I need some help on modifying one of >> your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3) >> the hook works great and I'm able now to attach a file device as a >> second disk. But I want this disk to be the first bootable disk >> instead of the block device one created into the engine. In order to >> change the boot order of the disk, I added those lines: >> >> ... >> source = domxml.createElement('source') >> source.setAttribute('file', devpath) >> disk.appendChild(source) >> >> boot = domxml.createElement('boot') >> boot.setAttribute('order', 1) >> disk.appendChild(boot) >> >> # find a name for vdXXX >> ..... >> >> So the hook permit<boot order=1> item >> (http://libvirt.org/formatdomain.html#elementsDisks) >> >> But the vm refuses booting without any logs anywhere... >> >> What is wrong? >> >> Thanks for your help > Hi, > 1. try to change the number to string: > boot.setAttribute('order', '1') > 2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log > 3. when the script enumerate all the disks you need to change the other disk > boot order: > for d in xmldisks: > # here look in each disk for boot element and change its order attribute > # to other number, ie 2, 3 ... > > >> -- >> Nathanaël Blanchet >> >> Supervision réseau >> Pôle exploitation et maintenance >> Département des systèmes d'information >> 227 avenue Professeur-Jean-Louis-Viala >> 34193 MONTPELLIER CEDEX 5 >> Tél. 33 (0)4 67 54 84 55 >> Fax 33 (0)4 67 54 84 14 >> blanchet@abes.fr >> -- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On 05.06.12 16:21, Nathanaël Blanchet wrote: > Hi, > > when executing several hook, I always have this issue in the vdsm logs : > File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, > in <module> > from vdsm import utils > ImportError: No module named vdsm > > and the vm refuses to boot > > how to correct this ? how did you install this? > > > Le 04/06/2012 17:16, Shahar Havivi a écrit : > >On 04.06.12 17:03, Nathanaël Blanchet wrote: > >>Hello, > >> > >>I'm testing hooks in vdsm and I need some help on modifying one of > >>your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3) > >>the hook works great and I'm able now to attach a file device as a > >>second disk. But I want this disk to be the first bootable disk > >>instead of the block device one created into the engine. In order to > >>change the boot order of the disk, I added those lines: > >> > >>... > >>source = domxml.createElement('source') > >>source.setAttribute('file', devpath) > >>disk.appendChild(source) > >> > >>boot = domxml.createElement('boot') > >>boot.setAttribute('order', 1) > >>disk.appendChild(boot) > >> > >> # find a name for vdXXX > >>..... > >> > >>So the hook permit<boot order=1> item > >>(http://libvirt.org/formatdomain.html#elementsDisks) > >> > >>But the vm refuses booting without any logs anywhere... > >> > >>What is wrong? > >> > >>Thanks for your help > >Hi, > >1. try to change the number to string: > > boot.setAttribute('order', '1') > >2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log > >3. when the script enumerate all the disks you need to change the other disk > > boot order: > > for d in xmldisks: > > # here look in each disk for boot element and change its order attribute > > # to other number, ie 2, 3 ... > > > > > >>-- > >>Nathanaël Blanchet > >> > >>Supervision réseau > >>Pôle exploitation et maintenance > >>Département des systèmes d'information > >>227 avenue Professeur-Jean-Louis-Viala > >>34193 MONTPELLIER CEDEX 5 > >>Tél. 33 (0)4 67 54 84 55 > >>Fax 33 (0)4 67 54 84 14 > >>blanchet@abes.fr > >> > > -- > Nathanaël Blanchet > > Supervision réseau > Pôle exploitation et maintenance > Département des systèmes d'information > 227 avenue Professeur-Jean-Louis-Viala > 34193 MONTPELLIER CEDEX 5 > Tél. 33 (0)4 67 54 84 55 > Fax 33 (0)4 67 54 84 14 > blanchet@abes.fr >

I cloned the git tree and copied the script in /usr/libexec/vdsm/hooks/before_vm_start/ Le 05/06/2012 16:27, Shahar Havivi a écrit : > On 05.06.12 16:21, Nathanaël Blanchet wrote: >> Hi, >> >> when executing several hook, I always have this issue in the vdsm logs : >> File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, >> in<module> >> from vdsm import utils >> ImportError: No module named vdsm >> >> and the vm refuses to boot >> >> how to correct this ? > how did you install this? >> >> Le 04/06/2012 17:16, Shahar Havivi a écrit : >>> On 04.06.12 17:03, Nathanaël Blanchet wrote: >>>> Hello, >>>> >>>> I'm testing hooks in vdsm and I need some help on modifying one of >>>> your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3) >>>> the hook works great and I'm able now to attach a file device as a >>>> second disk. But I want this disk to be the first bootable disk >>>> instead of the block device one created into the engine. In order to >>>> change the boot order of the disk, I added those lines: >>>> >>>> ... >>>> source = domxml.createElement('source') >>>> source.setAttribute('file', devpath) >>>> disk.appendChild(source) >>>> >>>> boot = domxml.createElement('boot') >>>> boot.setAttribute('order', 1) >>>> disk.appendChild(boot) >>>> >>>> # find a name for vdXXX >>>> ..... >>>> >>>> So the hook permit<boot order=1> item >>>> (http://libvirt.org/formatdomain.html#elementsDisks) >>>> >>>> But the vm refuses booting without any logs anywhere... >>>> >>>> What is wrong? >>>> >>>> Thanks for your help >>> Hi, >>> 1. try to change the number to string: >>> boot.setAttribute('order', '1') >>> 2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log >>> 3. when the script enumerate all the disks you need to change the other disk >>> boot order: >>> for d in xmldisks: >>> # here look in each disk for boot element and change its order attribute >>> # to other number, ie 2, 3 ... >>> >>> >>>> -- >>>> Nathanaël Blanchet >>>> >>>> Supervision réseau >>>> Pôle exploitation et maintenance >>>> Département des systèmes d'information >>>> 227 avenue Professeur-Jean-Louis-Viala >>>> 34193 MONTPELLIER CEDEX 5 >>>> Tél. 33 (0)4 67 54 84 55 >>>> Fax 33 (0)4 67 54 84 14 >>>> blanchet@abes.fr >>>> >> -- >> Nathanaël Blanchet >> >> Supervision réseau >> Pôle exploitation et maintenance >> Département des systèmes d'information >> 227 avenue Professeur-Jean-Louis-Viala >> 34193 MONTPELLIER CEDEX 5 >> Tél. 33 (0)4 67 54 84 55 >> Fax 33 (0)4 67 54 84 14 >> blanchet@abes.fr >> -- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On 05.06.12 16:57, Nathanaël Blanchet wrote: > I cloned the git tree and copied the script in > /usr/libexec/vdsm/hooks/before_vm_start/ you need to make rpm that will install the scripts properly with the right permissions and other files. like that: $ ./autogen.sh --system --enable-hooks $ make rpm > > Le 05/06/2012 16:27, Shahar Havivi a écrit : > >On 05.06.12 16:21, Nathanaël Blanchet wrote: > >>Hi, > >> > >>when executing several hook, I always have this issue in the vdsm logs : > >>File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, > >>in<module> > >>from vdsm import utils > >>ImportError: No module named vdsm > >> > >>and the vm refuses to boot > >> > >>how to correct this ? > >how did you install this? > >> > >>Le 04/06/2012 17:16, Shahar Havivi a écrit : > >>>On 04.06.12 17:03, Nathanaël Blanchet wrote: > >>>>Hello, > >>>> > >>>>I'm testing hooks in vdsm and I need some help on modifying one of > >>>>your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3) > >>>>the hook works great and I'm able now to attach a file device as a > >>>>second disk. But I want this disk to be the first bootable disk > >>>>instead of the block device one created into the engine. In order to > >>>>change the boot order of the disk, I added those lines: > >>>> > >>>>... > >>>>source = domxml.createElement('source') > >>>>source.setAttribute('file', devpath) > >>>>disk.appendChild(source) > >>>> > >>>>boot = domxml.createElement('boot') > >>>>boot.setAttribute('order', 1) > >>>>disk.appendChild(boot) > >>>> > >>>> # find a name for vdXXX > >>>>..... > >>>> > >>>>So the hook permit<boot order=1> item > >>>>(http://libvirt.org/formatdomain.html#elementsDisks) > >>>> > >>>>But the vm refuses booting without any logs anywhere... > >>>> > >>>>What is wrong? > >>>> > >>>>Thanks for your help > >>>Hi, > >>>1. try to change the number to string: > >>> boot.setAttribute('order', '1') > >>>2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log > >>>3. when the script enumerate all the disks you need to change the other disk > >>> boot order: > >>> for d in xmldisks: > >>> # here look in each disk for boot element and change its order attribute > >>> # to other number, ie 2, 3 ... > >>> > >>> > >>>>-- > >>>>Nathanaël Blanchet > >>>> > >>>>Supervision réseau > >>>>Pôle exploitation et maintenance > >>>>Département des systèmes d'information > >>>>227 avenue Professeur-Jean-Louis-Viala > >>>>34193 MONTPELLIER CEDEX 5 > >>>>Tél. 33 (0)4 67 54 84 55 > >>>>Fax 33 (0)4 67 54 84 14 > >>>>blanchet@abes.fr > >>>> > >>-- > >>Nathanaël Blanchet > >> > >>Supervision réseau > >>Pôle exploitation et maintenance > >>Département des systèmes d'information > >>227 avenue Professeur-Jean-Louis-Viala > >>34193 MONTPELLIER CEDEX 5 > >>Tél. 33 (0)4 67 54 84 55 > >>Fax 33 (0)4 67 54 84 14 > >>blanchet@abes.fr > >> > > -- > Nathanaël Blanchet > > Supervision réseau > Pôle exploitation et maintenance > Département des systèmes d'information > 227 avenue Professeur-Jean-Louis-Viala > 34193 MONTPELLIER CEDEX 5 > Tél. 33 (0)4 67 54 84 55 > Fax 33 (0)4 67 54 84 14 > blanchet@abes.fr >

okay, but I was running vdsm 4.9.3.2 from the ovirt 3.0 stable repository and I'm not sure 4.9.6.x is compatible with engine 3.0. So I built rpm on a F17 host and then installed the rpm vdsm-hook-directlun-4.9.6-0.268.gitfc9e104.fc17.noarch.rpm to the host with vdsm 4.9.3.2. According to the logs, issues about "from vdsm import utils" are the same. I guess it must exist a way to make those scripts work with 4.9.3.2 because those scripts have been written before this first ovirt release had been available. Plus, vmdisk works fine but scripts invoking "from vdsm import utils" don't. Do you have any idea? Le 05/06/2012 17:06, Shahar Havivi a écrit : > On 05.06.12 16:57, Nathanaël Blanchet wrote: >> I cloned the git tree and copied the script in >> /usr/libexec/vdsm/hooks/before_vm_start/ > you need to make rpm that will install the scripts properly with the right > permissions and other files. > like that: > $ ./autogen.sh --system --enable-hooks > $ make rpm > >> Le 05/06/2012 16:27, Shahar Havivi a écrit : >>> On 05.06.12 16:21, Nathanaël Blanchet wrote: >>>> Hi, >>>> >>>> when executing several hook, I always have this issue in the vdsm logs : >>>> File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, >>>> in<module> >>> >from vdsm import utils >>>> ImportError: No module named vdsm >>>> >>>> and the vm refuses to boot >>>> >>>> how to correct this ? >>> how did you install this? >>>> Le 04/06/2012 17:16, Shahar Havivi a écrit : >>>>> On 04.06.12 17:03, Nathanaël Blanchet wrote: >>>>>> Hello, >>>>>> >>>>>> I'm testing hooks in vdsm and I need some help on modifying one of >>>>>> your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_vm_start.py;h=191d5c1af533e11d699b1d715d3c1ea60e28b787;hb=6817f1c6e3f5bc137d1f3bef45a2d0191465c7a3) >>>>>> the hook works great and I'm able now to attach a file device as a >>>>>> second disk. But I want this disk to be the first bootable disk >>>>>> instead of the block device one created into the engine. In order to >>>>>> change the boot order of the disk, I added those lines: >>>>>> >>>>>> ... >>>>>> source = domxml.createElement('source') >>>>>> source.setAttribute('file', devpath) >>>>>> disk.appendChild(source) >>>>>> >>>>>> boot = domxml.createElement('boot') >>>>>> boot.setAttribute('order', 1) >>>>>> disk.appendChild(boot) >>>>>> >>>>>> # find a name for vdXXX >>>>>> ..... >>>>>> >>>>>> So the hook permit<boot order=1> item >>>>>> (http://libvirt.org/formatdomain.html#elementsDisks) >>>>>> >>>>>> But the vm refuses booting without any logs anywhere... >>>>>> >>>>>> What is wrong? >>>>>> >>>>>> Thanks for your help >>>>> Hi, >>>>> 1. try to change the number to string: >>>>> boot.setAttribute('order', '1') >>>>> 2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log >>>>> 3. when the script enumerate all the disks you need to change the other disk >>>>> boot order: >>>>> for d in xmldisks: >>>>> # here look in each disk for boot element and change its order attribute >>>>> # to other number, ie 2, 3 ... >>>>> >>>>> >>>>>> -- >>>>>> Nathanaël Blanchet >>>>>> >>>>>> Supervision réseau >>>>>> Pôle exploitation et maintenance >>>>>> Département des systèmes d'information >>>>>> 227 avenue Professeur-Jean-Louis-Viala >>>>>> 34193 MONTPELLIER CEDEX 5 >>>>>> Tél. 33 (0)4 67 54 84 55 >>>>>> Fax 33 (0)4 67 54 84 14 >>>>>> blanchet@abes.fr >>>>>> >>>> -- >>>> Nathanaël Blanchet >>>> >>>> Supervision réseau >>>> Pôle exploitation et maintenance >>>> Département des systèmes d'information >>>> 227 avenue Professeur-Jean-Louis-Viala >>>> 34193 MONTPELLIER CEDEX 5 >>>> Tél. 33 (0)4 67 54 84 55 >>>> Fax 33 (0)4 67 54 84 14 >>>> blanchet@abes.fr >>>> >> -- >> Nathanaël Blanchet >> >> Supervision réseau >> Pôle exploitation et maintenance >> Département des systèmes d'information >> 227 avenue Professeur-Jean-Louis-Viala >> 34193 MONTPELLIER CEDEX 5 >> Tél. 33 (0)4 67 54 84 55 >> Fax 33 (0)4 67 54 84 14 >> blanchet@abes.fr >> -- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On 05.06.12 18:12, Nathanaël Blanchet wrote:
okay, but I was running vdsm 4.9.3.2 from the ovirt 3.0 stable repository and I'm not sure 4.9.6.x is compatible with engine 3.0. So I built rpm on a F17 host and then installed the rpm vdsm-hook-directlun-4.9.6-0.268.gitfc9e104.fc17.noarch.rpm to the host with vdsm 4.9.3.2. According to the logs, issues about "from vdsm import utils" are the same. I guess it must exist a way to make those scripts work with 4.9.3.2 because those scripts have been written before this first ovirt release had been available. Plus, vmdisk works fine but scripts invoking "from vdsm import utils" don't.
Do you have any idea? No, You can try asking in vdsm mailing list: vdsm-devel@ovirt.org
Le 05/06/2012 17:06, Shahar Havivi a écrit :
I cloned the git tree and copied the script in /usr/libexec/vdsm/hooks/before_vm_start/ you need to make rpm that will install the scripts properly with the right
On 05.06.12 16:57, Nathanaël Blanchet wrote: permissions and other files. like that: $ ./autogen.sh --system --enable-hooks $ make rpm
Le 05/06/2012 16:27, Shahar Havivi a écrit :
On 05.06.12 16:21, Nathanaël Blanchet wrote:
Hi,
when executing several hook, I always have this issue in the vdsm logs : File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, in<module> from vdsm import utils ImportError: No module named vdsm
and the vm refuses to boot
how to correct this ? how did you install this? Le 04/06/2012 17:16, Shahar Havivi a écrit :
On 04.06.12 17:03, Nathanaël Blanchet wrote: >Hello, > >I'm testing hooks in vdsm and I need some help on modifying one of >your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_...) >the hook works great and I'm able now to attach a file device as a >second disk. But I want this disk to be the first bootable disk >instead of the block device one created into the engine. In order to >change the boot order of the disk, I added those lines: > >... >source = domxml.createElement('source') >source.setAttribute('file', devpath) >disk.appendChild(source) > >boot = domxml.createElement('boot') >boot.setAttribute('order', 1) >disk.appendChild(boot) > > # find a name for vdXXX >..... > >So the hook permit<boot order=1> item >(http://libvirt.org/formatdomain.html#elementsDisks) > >But the vm refuses booting without any logs anywhere... > >What is wrong? > >Thanks for your help Hi, 1. try to change the number to string: boot.setAttribute('order', '1') 2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log 3. when the script enumerate all the disks you need to change the other disk boot order: for d in xmldisks: # here look in each disk for boot element and change its order attribute # to other number, ie 2, 3 ...
>-- >Nathanaël Blanchet > >Supervision réseau >Pôle exploitation et maintenance >Département des systèmes d'information >227 avenue Professeur-Jean-Louis-Viala >34193 MONTPELLIER CEDEX 5 >Tél. 33 (0)4 67 54 84 55 >Fax 33 (0)4 67 54 84 14 >blanchet@abes.fr > -- Nathanaël Blanchet
Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
-- Nathanaël Blanchet
Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
-- Nathanaël Blanchet
Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

hello, I found the origin of the issue: the repository /usr/lib/python2.7/site-packages/vdsm(/utils.py) is not installed by the stable release. I created rpm from the git repository on a f17 host and copied manually it to the f16 host and it works fine now. I'll ask to the vdsm team which package must provides this directory. Thanks for your help. Le 06/06/2012 09:30, Shahar Havivi a écrit :
On 05.06.12 18:12, Nathanaël Blanchet wrote:
okay, but I was running vdsm 4.9.3.2 from the ovirt 3.0 stable repository and I'm not sure 4.9.6.x is compatible with engine 3.0. So I built rpm on a F17 host and then installed the rpm vdsm-hook-directlun-4.9.6-0.268.gitfc9e104.fc17.noarch.rpm to the host with vdsm 4.9.3.2. According to the logs, issues about "from vdsm import utils" are the same. I guess it must exist a way to make those scripts work with 4.9.3.2 because those scripts have been written before this first ovirt release had been available. Plus, vmdisk works fine but scripts invoking "from vdsm import utils" don't.
Do you have any idea? No, You can try asking in vdsm mailing list: vdsm-devel@ovirt.org
Le 05/06/2012 17:06, Shahar Havivi a écrit :
I cloned the git tree and copied the script in /usr/libexec/vdsm/hooks/before_vm_start/ you need to make rpm that will install the scripts properly with the right
On 05.06.12 16:57, Nathanaël Blanchet wrote: permissions and other files. like that: $ ./autogen.sh --system --enable-hooks $ make rpm
Le 05/06/2012 16:27, Shahar Havivi a écrit :
On 05.06.12 16:21, Nathanaël Blanchet wrote:
Hi,
when executing several hook, I always have this issue in the vdsm logs : File "/usr/libexec/vdsm/hooks/before_vm_start/40_directlun", line 9, in<module> from vdsm import utils ImportError: No module named vdsm
and the vm refuses to boot
how to correct this ? how did you install this? Le 04/06/2012 17:16, Shahar Havivi a écrit : > On 04.06.12 17:03, Nathanaël Blanchet wrote: >> Hello, >> >> I'm testing hooks in vdsm and I need some help on modifying one of >> your pyhton script : vmdisk (http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_hooks/vmdisk/before_...) >> the hook works great and I'm able now to attach a file device as a >> second disk. But I want this disk to be the first bootable disk >> instead of the block device one created into the engine. In order to >> change the boot order of the disk, I added those lines: >> >> ... >> source = domxml.createElement('source') >> source.setAttribute('file', devpath) >> disk.appendChild(source) >> >> boot = domxml.createElement('boot') >> boot.setAttribute('order', 1) >> disk.appendChild(boot) >> >> # find a name for vdXXX >> ..... >> >> So the hook permit<boot order=1> item >> (http://libvirt.org/formatdomain.html#elementsDisks) >> >> But the vm refuses booting without any logs anywhere... >> >> What is wrong? >> >> Thanks for your help > Hi, > 1. try to change the number to string: > boot.setAttribute('order', '1') > 2. you have a libvirt log at /var/log/libvirt/qemu/youvmname.log > 3. when the script enumerate all the disks you need to change the other disk > boot order: > for d in xmldisks: > # here look in each disk for boot element and change its order attribute > # to other number, ie 2, 3 ... > > >> -- >> Nathanaël Blanchet >> >> Supervision réseau >> Pôle exploitation et maintenance >> Département des systèmes d'information >> 227 avenue Professeur-Jean-Louis-Viala >> 34193 MONTPELLIER CEDEX 5 >> Tél. 33 (0)4 67 54 84 55 >> Fax 33 (0)4 67 54 84 14 >> blanchet@abes.fr >> -- Nathanaël Blanchet
Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
-- Nathanaël Blanchet
Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
-- Nathanaël Blanchet
Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
-- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On Tue, Jun 05, 2012 at 06:12:37PM +0200, Nathanaël Blanchet wrote:
okay, but I was running vdsm 4.9.3.2 from the ovirt 3.0 stable repository and I'm not sure 4.9.6.x is compatible with engine 3.0. So I built rpm on a F17 host and then installed the rpm vdsm-hook-directlun-4.9.6-0.268.gitfc9e104.fc17.noarch.rpm to the host with vdsm 4.9.3.2. According to the logs, issues about "from vdsm import utils" are the same. I guess it must exist a way to make those scripts work with 4.9.3.2 because those scripts have been written before this first ovirt release had been available. Plus, vmdisk works fine but scripts invoking "from vdsm import utils" don't.
Do you have any idea?
The vdsm package you are importing from is rather new and did not exist in vdsm-4.9.3.2. You should probably use the hooks from http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=tree;f=vdsm_hooks;hb=v4.9.3.2 when vdsm-4.9.3.2 is installed. Dan.

Thanks for answering, all is logical now we found the reason. I think there is a lack of documentation about the hook scripts while there are very useful in my case, waiting for engine implementation in ovirt 3.1. I would have never found the good gerrit link without your help. How can I get a tree of an old version except by directly adding hb=v4.9.3.2 instead of hb=HEAD in the url? Le 06/06/2012 09:43, Dan Kenigsberg a écrit :
On Tue, Jun 05, 2012 at 06:12:37PM +0200, Nathanaël Blanchet wrote:
okay, but I was running vdsm 4.9.3.2 from the ovirt 3.0 stable repository and I'm not sure 4.9.6.x is compatible with engine 3.0. So I built rpm on a F17 host and then installed the rpm vdsm-hook-directlun-4.9.6-0.268.gitfc9e104.fc17.noarch.rpm to the host with vdsm 4.9.3.2. According to the logs, issues about "from vdsm import utils" are the same. I guess it must exist a way to make those scripts work with 4.9.3.2 because those scripts have been written before this first ovirt release had been available. Plus, vmdisk works fine but scripts invoking "from vdsm import utils" don't.
Do you have any idea? The vdsm package you are importing from is rather new and did not exist in vdsm-4.9.3.2. You should probably use the hooks from http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=tree;f=vdsm_hooks;hb=v4.9.3.2 when vdsm-4.9.3.2 is installed.
Dan.
-- Nathanaël Blanchet Supervision réseau Pôle exploitation et maintenance Département des systèmes d'information 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On Wed, Jun 06, 2012 at 11:38:29AM +0200, Nathanaël Blanchet wrote:
Thanks for answering, all is logical now we found the reason. I think there is a lack of documentation about the hook scripts while
Unfortunately this is true for every aspect of ovirt...
there are very useful in my case, waiting for engine implementation in ovirt 3.1. I would have never found the good gerrit link without your help. How can I get a tree of an old version except by directly adding hb=v4.9.3.2 instead of hb=HEAD in the url?
in you local git-clone, you can git-checkout v4.9.3.2 and see history recreated.
participants (3)
-
Dan Kenigsberg
-
Nathanaël Blanchet
-
Shahar Havivi