[ovirt-users] [Rest API / Python SDK] Setting VM Video Type

Juan Hernández jhernand at redhat.com
Fri Dec 11 12:04:09 UTC 2015


On 12/11/2015 12:27 PM, Ollie Armstrong wrote:
> Hi everyone,
> 
> I'm looking for a method of settings the VM's video type to QXL from
> the Python SDK, which doesn't appear to be possible in any way.
> Whenever I set the graphics protocol to VNC it defaults the video type
> to CIRRUS.  I'd like to use QXL with VNC, which is possible to set
> using the console's web UI.
> 
> Has anyone achieved this before?  Using the "SPICE + VNC" option with
> QXL would also be acceptable, but the API doesn't seem to accept that
> value for the graphics protocol.
> 
> Cheers,
> Ollie

What version of the engine are you using? Can you share the script that
you are using to try to change the display type?

In version 3.6 of then engine a new "/vm/{vm:id}/graphicsconsoles"
service has been added that allows you to add/remove graphics consoles.
For example, if you want to add VNC and SPICE as protocols you can do
the following:

  # Find the VM:
  vm = api.vms.get(name="myvm")

  # Remove the current graphics consoles:
  consoles = vm.graphicsconsoles.list()
  for console in consoles:
    console.delete()

  # Add new consoles:
  vm.graphicsconsoles.add(
    params.GraphicsConsole(
      protocol="VNC"
    )
  )
  vm.graphicsconsoles.add(
    params.GraphicsConsole(
      protocol="SPICE"
    )
  )

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