Skip to content

Commit

Permalink
Merge pull request #3727 from hs0210/graphics
Browse files Browse the repository at this point in the history
Update func set_graphics_attr
  • Loading branch information
chloerh authored Jul 26, 2023
2 parents 77c9a17 + 1b44adb commit 52a0548
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion virttest/libvirt_xml/vm_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,11 @@ def set_graphics_attr(vm_name, attr, index=0, virsh_instance=base.virsh):
"""
vmxml = VMXML.new_from_inactive_dumpxml(
vm_name, virsh_instance=virsh_instance)
graphic = vmxml.xmltreefile.find('devices').findall('graphics')
devices = vmxml.xmltreefile.find('devices')
graphic = devices.findall('graphics')
if not graphic:
graphic = [xml_utils.ElementTree.SubElement(devices, 'graphics')]
graphic[0].set('type', 'vnc')
for key in attr:
LOG.debug("Set %s='%s'" % (key, attr[key]))
graphic[index].set(key, attr[key])
Expand Down

0 comments on commit 52a0548

Please sign in to comment.