guest: remove spiceport devices when spice is removed

serial/console type='spiceport' is another spice specific device,
so remove that too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-09-18 09:57:48 -04:00 committed by Pavel Hrdina
parent 229b905053
commit f0078a179d
2 changed files with 16 additions and 0 deletions

View File

@ -26,5 +26,15 @@
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<serial type='spiceport'>
<source channel='org.qemu.console.serial.0'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='spiceport'>
<source channel='org.qemu.console.serial.0'/>
<target type='serial' port='0'/>
</console>
</devices>
</domain>

View File

@ -1355,10 +1355,16 @@ class Guest(XMLBuilder):
if redirdev.type == "spicevmc":
self.devices.remove_child(redirdev)
def _remove_spiceport(self):
for dev in self.devices.serial + self.devices.console:
if dev.type == dev.TYPE_SPICEPORT:
self.devices.remove_child(dev)
def _force_remove_spice_devices(self):
self._remove_spice_audio()
self._remove_spice_channels()
self._remove_spice_usbredir()
self._remove_spiceport()
def _remove_spice_devices(self, rmdev):
if rmdev.DEVICE_TYPE != "graphics" or self.has_spice():