diff options
author | Cole Robinson <crobinso@redhat.com> | 2020-09-08 17:55:09 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-09-08 17:55:09 -0400 |
commit | 44033b43bbda487bf8962f7d74de107f96aa2f47 (patch) | |
tree | 053652432ea9939bf571f09ceab6f1278d5be44c /virtinst/virtxml.py | |
parent | e2419869e7fd4e6e5b04eb7914c2f88e842630ed (diff) | |
download | virt-manager-44033b43bbda487bf8962f7d74de107f96aa2f47.tar.gz |
virt-xml: Handle removing <console> <serial> dup device
This is a quirk of libvirt that the first <device> is usually a
logical duplicate of the first <serial> device. Adjust virt-xml to
understand this quirk and remove both devices at the same time,
like we already do in virt-manager
https://bugzilla.redhat.com/show_bug.cgi?id=1685541
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtinst/virtxml.py')
-rw-r--r-- | virtinst/virtxml.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/virtinst/virtxml.py b/virtinst/virtxml.py index a5ba74e0..b80a84db 100644 --- a/virtinst/virtxml.py +++ b/virtinst/virtxml.py @@ -11,6 +11,7 @@ import libvirt from . import cli from .cli import fail, print_stdout, print_stderr +from .devices import DeviceConsole from .guest import Guest from .logger import log from . import xmlutil @@ -176,8 +177,15 @@ def action_remove_device(guest, options, parserclass): devs = _find_objects_to_edit(guest, "remove-device", getattr(options, parserclass.cli_arg_name)[-1], parserclass) - devs = xmlutil.listify(devs) + + # Check for console duplicate devices + for dev in devs[:]: + condup = DeviceConsole.get_console_duplicate(guest, dev) + if condup: + log.debug("Found duplicate console device:\n%s", condup.get_xml()) + devs.append(condup) + for dev in devs: guest.remove_device(dev) return devs |