- cli: Add basic --audio type=XXX,id=Y support (RHEL-17435) - virtinst: unify detection of duplicate console when removing device (RHEL-17435) - virtinst: fix compare for audio devices (RHEL-17435) - testsuite: add test-spice vm definition (RHEL-17435) - virtinst: remove spice devices when removing last spice graphics (RHEL-17435) - guest: add convert_to_vnc() (RHEL-17435) - guest: remove spiceport devices when spice is removed (RHEL-17435) - guest: convert_to_vnc: convert video device (RHEL-17435) - virt-xml: Add `--edit --convert-to-vnc` (RHEL-17435) Resolves: RHEL-17435
100 lines
3.4 KiB
Diff
100 lines
3.4 KiB
Diff
From e233ec657ddf5ffb583394b251e763a3d973c251 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <e233ec657ddf5ffb583394b251e763a3d973c251.1737975657.git.phrdina@redhat.com>
|
|
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Date: Mon, 12 Feb 2024 09:38:02 +0100
|
|
Subject: [PATCH] virtinst: unify detection of duplicate console when removing
|
|
device
|
|
|
|
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
(cherry picked from commit ef64949e84bbb1c94f742f48711ed766d8c80a02)
|
|
|
|
https://issues.redhat.com/browse/RHEL-17435
|
|
|
|
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
---
|
|
virtManager/object/domain.py | 10 ----------
|
|
virtinst/guest.py | 9 +++++++++
|
|
virtinst/virtxml.py | 8 --------
|
|
3 files changed, 9 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
|
|
index cc2f506d4..5215a97e9 100644
|
|
--- a/virtManager/object/domain.py
|
|
+++ b/virtManager/object/domain.py
|
|
@@ -583,21 +583,11 @@ class vmmDomain(vmmLibvirtObject):
|
|
"""
|
|
Remove passed device from the inactive guest XML
|
|
"""
|
|
- # If serial and duplicate console are both present, they both need
|
|
- # to be removed at the same time
|
|
- con = None
|
|
- if self.serial_is_console_dup(devobj):
|
|
- con = self.xmlobj.devices.console[0]
|
|
-
|
|
xmlobj = self._make_xmlobj_to_define()
|
|
editdev = self._lookup_device_to_define(xmlobj, devobj, False)
|
|
if not editdev:
|
|
return # pragma: no cover
|
|
|
|
- if con:
|
|
- rmcon = xmlobj.find_device(con)
|
|
- if rmcon:
|
|
- xmlobj.remove_device(rmcon)
|
|
xmlobj.remove_device(editdev)
|
|
|
|
self._redefine_xmlobj(xmlobj)
|
|
diff --git a/virtinst/guest.py b/virtinst/guest.py
|
|
index c53516c6e..fc7b0080a 100644
|
|
--- a/virtinst/guest.py
|
|
+++ b/virtinst/guest.py
|
|
@@ -479,8 +479,11 @@ class Guest(XMLBuilder):
|
|
|
|
def add_device(self, dev):
|
|
self.devices.add_child(dev)
|
|
+
|
|
def remove_device(self, dev):
|
|
self.devices.remove_child(dev)
|
|
+ self._remove_duplicate_console(dev)
|
|
+
|
|
devices = XMLChildProperty(_DomainDevices, is_single=True)
|
|
|
|
def find_device(self, origdev):
|
|
@@ -1035,3 +1038,9 @@ class Guest(XMLBuilder):
|
|
self._add_spice_channels()
|
|
self._add_spice_sound()
|
|
self._add_spice_usbredir()
|
|
+
|
|
+ def _remove_duplicate_console(self, dev):
|
|
+ condup = DeviceConsole.get_console_duplicate(self, dev)
|
|
+ if condup:
|
|
+ log.debug("Found duplicate console device:\n%s", condup.get_xml())
|
|
+ self.devices.remove_child(condup)
|
|
diff --git a/virtinst/virtxml.py b/virtinst/virtxml.py
|
|
index bd2b42823..640f70a87 100644
|
|
--- a/virtinst/virtxml.py
|
|
+++ b/virtinst/virtxml.py
|
|
@@ -11,7 +11,6 @@ import libvirt
|
|
|
|
from . import cli
|
|
from .cli import fail, fail_conflicting, print_stdout, print_stderr
|
|
-from .devices import DeviceConsole
|
|
from .guest import Guest
|
|
from .logger import log
|
|
from . import xmlutil
|
|
@@ -182,13 +181,6 @@ def action_remove_device(guest, options, parserclass):
|
|
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
|
|
--
|
|
2.48.1
|