Description of problem: Python SDK does not allow to initialize VM object (params.VM) with spice+vnc display. Sending list or two displays is not relaly possible. Version-Release number of selected component (if applicable): Seems to be v3 SDK. How reproducible: Always. Steps to Reproduce: 1. Try something similar to: api = API(url='<url>', username='admin@internal', password='<password>', insecure=True, validate_cert_chain=False) VM_NAME = 'vm11' NIC_NAME = 'eth0' nic=params.NIC( name=NIC_NAME, interface='virtio', network=params.Network( name='ovirtmgmt', ), ) vm_memory = 1024 * 2 ** 20 vm_params = params.VM( name=VM_NAME, memory=vm_memory, cluster=params.Cluster( name='test-cluster', ), display=params.Display( type_='spice', smartcard_enabled=True, file_transfer_enabled=True, copy_paste_enabled=True, ), template=params.Template( name='Blank', ), os=params.OperatingSystem( boot=[params.Boot(dev='network')], ), delete_protected=True, soundcard_enabled=True, ) 2. modify display=params.Display( type_='spice+vnc', smartcard_enabled=True, file_transfer_enabled=True, copy_paste_enabled=True, ), (or try list or anything) 3. api.vms.add(vm_params) api.vms.get(VM_NAME).nics.add(nic) api.vms.get(VM_NAME).start() Actual results: detail: The string 'spice+vnc' isn't a valid value for the 'DisplayType' enumerated type. Valid values are: 'vnc', 'spice'. Expected results: The VM starts with spice + vnc configuration. Additional info:
Since version 3.6 of the engine the correct way to manipulate the graphics consoles attached to a virtual machine is using the "graphicsconsoles" sub-collection. The existing "display.type" element inside the virtual machine is preserved only for backwards compatibility, and it only supports one value. If you need to check which graphics consoles are currently enabled you can use the following code: ---8<--- protocols = [] for console in vm.graphicsconsoles.list(): protocols.append(console.get_protocol()) print(protocols) --->8--- This should print something like ['spice', 'vnc'], depending on the protocols that are actually enabled. To enable a protocol you need to add it to the collection, and to disable it you need to remove it from the collection. For example, to make sure that both SPICE and VNC are enabled, you can do the following: ---8<--- # Enable the SPICE protocol if it isn't already enabled: if not 'spice' in protocols: vm.graphicsconsoles.add( params.GraphicsConsole( protocol='spice', ) ) # Enable the VNC protocol if it isn't already enabled: if not 'vnc' in protocols: vm.graphicsconsoles.add( params.GraphicsConsole( protocol='vnc', ) ) --->8---
How is it possible to specify the console parameters in that case? Display includes parameters like - smartcard_enabled, - keyboard_layout, - file_transfer_enabled and more. I can't seem to find a way to pass these to GraphicsConsole.
These parameters are still part of the "display" element. What has been moved to the "graphicsconsoles" collection is "display.type".