[ovirt-users] Run Once Python SDK

Juan Hernández jhernand at redhat.com
Fri Jun 19 11:04:31 UTC 2015


On 06/19/2015 11:24 AM, Jiri Belka wrote:
>> I was looking into performing the "run once" option via the SDK with an
>> attached ISO. With the plan to be to attach an ISO and force a VM to boot
>> from the CD.
>>
>> Basically:
>>
>> 1) Mount an ISO in "run once" mode
>> 2) Make "CD-ROM" the first item in the boot sequence
>> 3) Boot the VM
> 
> Isn't it just vm.start() with appropriate params?
> 
> j.

Yes, something like this:

---8<---
#!/usr/bin/python

from ovirtsdk import api
from ovirtsdk.xml import params

api = api.API(
    url="https://engine.example.com/ovirt-engine/api",
    username="admin at internal",
    password="...",
    insecure=True,
    debug=False
)

vm = api.vms.get(name="myvm")

vm.start(
  action=params.Action(
    vm=params.VM(
      cdroms=params.CdRoms(
        cdrom=[
          params.CdRom(
            file=params.File(
              id="CentOS-7.0-1406-x86_64-Minimal.iso"
            )
          )
        ]
      ),
      os=params.OperatingSystem(
        boot=[
          params.Boot(
            dev="cdrom"
          )
        ]
      )
    )
  )
)

api.disconnect()
--->8---

-- 
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