[ovirt-users] Setting PXE boot via Python API

Juan Hernández jhernand at redhat.com
Fri Dec 4 08:50:27 UTC 2015


On 12/03/2015 10:59 PM, Jamie Lawrence wrote:
> Hello,
> 
> I’m currently playing with scripted VM creation and have an issue getting the newly created VM to PXE boot. My objective is to port some creation scripts from the environment this will eventually replace and worry about making this more “Ovirt-ey” later.
> 
> Skipping the details, everything is happy through creation, and when I boot it, it attempts to boot from a ‘disk' and fails, and I don’t understand why.
> 
> Following the creation of the VM, creation/attachment of the disk and net,
> 
>         boot_dev = params.Boot(dev='network')
>         vm.os.set_boot([boot_dev])
>         vm.set_os(params.OperatingSystem(cmdline=kernel_cmd))

This line ^ is overwriting the complete OS configuration that you set
before, so the change to the boot device is lost. If you enable the
debug output of the SDK (with debug=True in the constructor of the API
object) you will see that this is what is sent:

  <os>
    <cmdline>your command line</cmdline>
  </os>

Try this instead:

  vm.set_os(
    params.OperatingSystem(
      boot=[
        params.Boot(dev="network")
      ],
      cmdline=kernel_cmd
    )
  )

It should result in sending this:

  <os>
    <boot dev="network"/>
    <cmdline>your command line</cmdline>
  </os>

Not also that I believe that the kernel command line won't have any
effect for the PXE boot, as it is used only for direct kernel boot.

>         vm.update()
> 
> kernel_cmd there evaluates to a fairly typical PXEboot string that works with our legacy setup - there isn’t really anything exotic going on. The BIOS doesn’t show any attempt at a PXE boot - it goes straight to the disk, declares it unbootable (because it was just created and is blank), and halts. It feels like the set_boot line is wrong or ignored, but this is new to me.
> 
> Anyone have a hint?
> 
> Thanks,
> 
> -j
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 


-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.



More information about the Users mailing list