Compare commits

..

No commits in common. "c10s" and "c8" have entirely different histories.
c10s ... c8

27 changed files with 2676 additions and 273 deletions

4
.gitignore vendored
View File

@ -1,3 +1 @@
/virt-manager-*.tar.gz
/virt-manager-20220220-git363fca41.tar.xz
/virt-manager-5.0.0.tar.xz
SOURCES/virt-manager-3.2.0.tar.gz

1
.virt-manager.metadata Normal file
View File

@ -0,0 +1 @@
f620494a41f898422581846ccf38b0e4540ea54e SOURCES/virt-manager-3.2.0.tar.gz

View File

@ -0,0 +1,112 @@
From 3e150cab1c478e1ce95f4f1466ecbac0b693e375 Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Tue, 26 Oct 2021 14:18:40 -0500
Subject: [PATCH] Handle new nodedev name for mediated devices
libvirt recently changed the nodedev names for mediated devices due to
the fact that mdevctl supports defining multiple mediated devices with
the same UUID as long as only one is active at a time. This means that
the nodedev name changed from the format 'mdev_$UUID' to the format
'mdev_$UUID_$PARENT'.
Unfortunately, virt-install was parsing the nodedev name to extract the
UUID of a mediated device. This fails with the new name format.
Fortunately, in libvirt 7.3.0, a <uuid> field was added to the xml
schema for mdev devices, so we can simply use this instead, and fall
back to the name parsing if it doesn't exist.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
(cherry picked from commit 0c146b250384ddddcefd2cc0d76b9e808377ebe5)
https://bugzilla.redhat.com/show_bug.cgi?id=2020241
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
tests/data/testdriver/testdriver.xml | 14 ++++++++++++++
tests/test_nodedev.py | 14 ++++++++++++++
virtinst/nodedev.py | 7 +++++++
3 files changed, 35 insertions(+)
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index 5875732a..e4880936 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -3725,4 +3725,18 @@ ba</description>
</capability>
</device>
+<device>
+ <name>mdev_35ceae7f_eea5_4f28_b7f3_7b12a3e62d3c_0000_06_00_0</name>
+ <path>/sys/devices/pci0000:00/0000:00:02.0/35ceae7f-eea5-4f28-b7f3-7b12a3e62d3c</path>
+ <parent>pci_0000_06_00_0</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='nvidia-11'/>
+ <iommuGroup number='12'/>
+ <uuid>35ceae7f-eea5-4f28-b7f3-7b12a3e62d3c</uuid>
+ </capability>
+</device>
+
</node>
diff --git a/tests/test_nodedev.py b/tests/test_nodedev.py
index 79678bc8..41435262 100644
--- a/tests/test_nodedev.py
+++ b/tests/test_nodedev.py
@@ -8,6 +8,7 @@
import os.path
import pytest
+import libvirt
from virtinst import Guest
from virtinst import NodeDevice
@@ -154,6 +155,19 @@ def testPCIMdev():
assert dev.parent == "pci_0000_06_00_0"
assert dev.device_type == "mdev"
assert dev.type_id == "nvidia-11"
+ assert dev.get_mdev_uuid() == "4b20d080-1b54-4048-85b3-a6a62d165c01"
+
+# libvirt <7.3.0 doesn't support <uuid> in the mdev node device xml
+@pytest.mark.skipif(libvirt.getVersion() < 7003000, reason="libvirt version doesn't support new mdev format")
+def testPCIMdevNewFormat():
+ conn = utils.URIs.open_testdriver_cached()
+ devname = "mdev_35ceae7f_eea5_4f28_b7f3_7b12a3e62d3c_0000_06_00_0"
+ dev = _nodeDevFromName(conn, devname)
+ assert dev.name == devname
+ assert dev.parent == "pci_0000_06_00_0"
+ assert dev.device_type == "mdev"
+ assert dev.type_id == "nvidia-11"
+ assert dev.get_mdev_uuid() == "35ceae7f-eea5-4f28-b7f3-7b12a3e62d3c"
# NodeDevice 2 Device XML tests
diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py
index f54a311c..248723b9 100644
--- a/virtinst/nodedev.py
+++ b/virtinst/nodedev.py
@@ -94,6 +94,12 @@ class NodeDevice(XMLBuilder):
device_type = XMLProperty("./capability/@type")
def get_mdev_uuid(self):
+ # libvirt 7.3.0 added a <uuid> element to the nodedev xml for mdev
+ # types. For older versions, we unfortunately have to parse the nodedev
+ # name, which uses the format "mdev_$UUID_WITH_UNDERSCORES"
+ if self.uuid is not None:
+ return self.uuid
+
return self.name[5:].replace('_', '-')
def compare_to_hostdev(self, hostdev):
@@ -191,6 +197,7 @@ class NodeDevice(XMLBuilder):
# type='mdev' options
type_id = XMLProperty("./capability/type/@id")
+ uuid = XMLProperty("./capability/uuid")
def _AddressStringToHostdev(conn, addrstr):
--
2.31.1

View File

@ -0,0 +1,33 @@
From b533019b5776207412ed1aa886d97ead2550695a Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sat, 21 Nov 2020 17:17:33 -0500
Subject: [PATCH] addstorage: Don't pass None to widget.set_active()
Older pygobject can't handle it. Mentioned here:
https://github.com/virt-manager/virt-manager/issues/188
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit e7222b5058c8874b15fbfd998e5eeb233f571075)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2026987
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtManager/device/addstorage.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtManager/device/addstorage.py b/virtManager/device/addstorage.py
index dee0160c..49d0b693 100644
--- a/virtManager/device/addstorage.py
+++ b/virtManager/device/addstorage.py
@@ -310,7 +310,7 @@ class vmmAddStorage(vmmGObjectUI):
detect_zeroes = disk.driver_detect_zeroes
ro = disk.read_only
share = disk.shareable
- removable = disk.removable
+ removable = bool(disk.removable)
serial = disk.serial
self.set_disk_bus(disk.bus)
--
2.31.1

View File

@ -0,0 +1,203 @@
From a39c0f0ddb75bca67a150e8c914ce94c8d1c6858 Mon Sep 17 00:00:00 2001
Message-ID: <a39c0f0ddb75bca67a150e8c914ce94c8d1c6858.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 24 Feb 2022 13:47:59 -0500
Subject: [PATCH] cli: Add basic --audio type=XXX,id=Y support
From: Cole Robinson <crobinso@redhat.com>
Closes: #264
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit cd5c34a3f3ab53be32319af6857efd3c2ac45385)
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
man/virt-install.rst | 10 ++++++++++
man/virt-xml.rst | 1 +
.../cli/compare/virt-install-many-devices.xml | 2 ++
tests/data/cli/compare/virt-xml-add-audio.xml | 10 ++++++++++
tests/test_cli.py | 6 ++++++
virtinst/cli.py | 16 ++++++++++++++++
virtinst/devices/__init__.py | 1 +
virtinst/devices/audio.py | 12 ++++++++++++
virtinst/guest.py | 3 ++-
9 files changed, 60 insertions(+), 1 deletion(-)
create mode 100644 tests/data/cli/compare/virt-xml-add-audio.xml
create mode 100644 virtinst/devices/audio.py
diff --git a/man/virt-install.rst b/man/virt-install.rst
index 963f95649..bafbf9f1f 100644
--- a/man/virt-install.rst
+++ b/man/virt-install.rst
@@ -1561,6 +1561,16 @@ Complete details at https://libvirt.org/formatdomain.html#elementsSound
+``--audio``
+^^^^^^^^^^^
+
+Configure host audio output for the guest's `--sound` hardware.
+
+Use --audio=? to see a list of all available sub options.
+Complete details at https://libvirt.org/formatdomain.html#audio-backends
+
+
+
``--watchdog``
^^^^^^^^^^^^^^
diff --git a/man/virt-xml.rst b/man/virt-xml.rst
index 7ff7ceca7..75c8be860 100644
--- a/man/virt-xml.rst
+++ b/man/virt-xml.rst
@@ -235,6 +235,7 @@ XML OPTIONS
* ``--hostdev``
* ``--filesystem``
* ``--sound``
+* ``--audio``
* ``--watchdog``
* ``--video``
* ``--smartcard``
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index 3bd756b34..d13ec6fb7 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -493,6 +493,8 @@
<codec type="duplex"/>
<codec type="output"/>
</sound>
+ <audio type="spice" id="1"/>
+ <audio type="pulseaudio" id="2"/>
<video>
<model type="cirrus"/>
</video>
diff --git a/tests/data/cli/compare/virt-xml-add-audio.xml b/tests/data/cli/compare/virt-xml-add-audio.xml
new file mode 100644
index 000000000..3e491518c
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-add-audio.xml
@@ -0,0 +1,10 @@
+ <vsock model="virtio">
+ <cid auto="no" address="5"/>
+ </vsock>
++ <audio type="none" id="1"/>
+ </devices>
+ <seclabel type="dynamic" model="selinux" relabel="yes"/>
+ <keywrap>
+
+Domain 'test-for-virtxml' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 75a891f08..532f456ae 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -694,6 +694,11 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--sound ac97
--sound codec0.type=micro,codec1.type=duplex,codec2.type=output
+
+--audio id=1,type=spice
+--audio id=2,type=pulseaudio
+
+
--video cirrus
--video model=qxl,vgamem=1,ram=2,vram=3,heads=4,accel3d=yes,vram64=65
--video model=qxl,model.vgamem=1,model.ram=2,model.vram=3,model.heads=4,model.acceleration.accel3d=yes,model.vram64=65
@@ -1299,6 +1304,7 @@ c.add_invalid("--add-device --pm suspend_to_disk=yes") # --add-device without a
c.add_invalid("--remove-device --clock utc") # --remove-device without a dev
c.add_compare("--add-device --host-device usb_device_4b3_4485_noserial", "add-host-device")
c.add_compare("--add-device --sound pcspk", "add-sound")
+c.add_compare("--add-device --audio type=none,id=1", "add-audio", predefine_check="7.4.0")
c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic")
c.add_compare("--add-device --disk %(EXISTIMG1)s", "add-disk-notarget") # filling in acceptable target
c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index dbd4a5452..390c54cd2 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -766,6 +766,10 @@ def add_device_options(devg, sound_back_compat=False):
devg.add_argument("--soundhw", action="append", dest="sound",
help=argparse.SUPPRESS)
+ ParserAudio.register()
+ devg.add_argument("--audio", action="append",
+ help=_("Configure host audio backend for sound devices"))
+
ParserWatchdog.register()
devg.add_argument("--watchdog", action="append",
help=_("Configure a guest watchdog device"))
@@ -4305,6 +4309,18 @@ class ParserSound(VirtCLIParser):
find_inst_cb=cls.codec_find_inst_cb)
+class ParserAudio(VirtCLIParser):
+ cli_arg_name = "audio"
+ guest_propname = "devices.audio"
+
+ @classmethod
+ def _init_class(cls, **kwargs):
+ VirtCLIParser._init_class(**kwargs)
+
+ cls.add_arg("type", "type")
+ cls.add_arg("id", "id")
+
+
#####################
# --hostdev parsing #
#####################
diff --git a/virtinst/devices/__init__.py b/virtinst/devices/__init__.py
index eae4b29bd..60081f603 100644
--- a/virtinst/devices/__init__.py
+++ b/virtinst/devices/__init__.py
@@ -4,6 +4,7 @@
# See the COPYING file in the top-level directory.
+from .audio import DeviceAudio
from .char import DeviceChannel, DeviceConsole, DeviceParallel, DeviceSerial
from .controller import DeviceController
from .device import Device
diff --git a/virtinst/devices/audio.py b/virtinst/devices/audio.py
new file mode 100644
index 000000000..e12975b16
--- /dev/null
+++ b/virtinst/devices/audio.py
@@ -0,0 +1,12 @@
+# This work is licensed under the GNU GPLv2 or later.
+# See the COPYING file in the top-level directory.
+
+from .device import Device
+from ..xmlbuilder import XMLProperty
+
+
+class DeviceAudio(Device):
+ XML_NAME = "audio"
+
+ type = XMLProperty("./@type")
+ id = XMLProperty("./@id")
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 3269f72e3..c53516c6e 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -25,7 +25,7 @@ class _DomainDevices(XMLBuilder):
XML_NAME = "devices"
_XML_PROP_ORDER = ['disk', 'controller', 'filesystem', 'interface',
'smartcard', 'serial', 'parallel', 'console', 'channel',
- 'input', 'tpm', 'graphics', 'sound', 'video', 'hostdev',
+ 'input', 'tpm', 'graphics', 'sound', 'audio', 'video', 'hostdev',
'redirdev', 'watchdog', 'memballoon', 'rng', 'panic',
'memory', 'vsock', 'iommu']
@@ -43,6 +43,7 @@ class _DomainDevices(XMLBuilder):
tpm = XMLChildProperty(DeviceTpm)
graphics = XMLChildProperty(DeviceGraphics)
sound = XMLChildProperty(DeviceSound)
+ audio = XMLChildProperty(DeviceAudio)
video = XMLChildProperty(DeviceVideo)
hostdev = XMLChildProperty(DeviceHostdev)
redirdev = XMLChildProperty(DeviceRedirdev)
--
2.48.1

View File

@ -0,0 +1,112 @@
From fa5f5f8f9b2b00b7580cb55f82c17e66e54b438d Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Tue, 11 Jan 2022 11:21:39 -0600
Subject: [PATCH] cli: add 'ioapic.driver' to --features
Add the ability to set the ioapic driver using the --features argument:
$ virt-install --features ioapic.driver=qemu ...
This results in the following xml:
<features>
...
<ioapic driver="qemu"/>
</features>
This is required in order to install a guest with >255 cpus. Such a
configuration requires an iommu with extended interrupt mode enabled,
which in turn requires IOMMU interrupt remapping to be enabled, which in
turn requires a split I/O APIC.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
(cherry picked from commit 9766beea0432faad7cded9e0285d05851659020e)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037202
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
tests/data/cli/compare/virt-install-singleton-config-3.xml | 1 +
tests/data/xmlparse/change-guest-out.xml | 1 +
tests/test_cli.py | 2 +-
tests/test_xmlparse.py | 1 +
virtinst/cli.py | 1 +
virtinst/domain/features.py | 1 +
6 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/data/cli/compare/virt-install-singleton-config-3.xml b/tests/data/cli/compare/virt-install-singleton-config-3.xml
index d2e7a363..a36c7bf2 100644
--- a/tests/data/cli/compare/virt-install-singleton-config-3.xml
+++ b/tests/data/cli/compare/virt-install-singleton-config-3.xml
@@ -73,6 +73,7 @@
<pvspinlock state="off"/>
<smm state="off"/>
<vmcoreinfo state="on"/>
+ <ioapic driver="qemu"/>
</features>
<cpu>
<topology sockets="1" cores="3" threads="2"/>
diff --git a/tests/data/xmlparse/change-guest-out.xml b/tests/data/xmlparse/change-guest-out.xml
index 17af0826..3faf8783 100644
--- a/tests/data/xmlparse/change-guest-out.xml
+++ b/tests/data/xmlparse/change-guest-out.xml
@@ -32,6 +32,7 @@
<hidden state="on"/>
</kvm>
<pvspinlock state="on"/>
+ <ioapic driver="qemu"/>
</features>
<numatune>
<memory nodeset="2,4,6"/>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 9f0cdfe9..75a891f0 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -558,7 +558,7 @@ c.add_compare("""
--vcpus vcpu.current=3,maxvcpus=4,vcpu.placement=auto
--memory hotplugmemorymax=2048,hotplugmemoryslots=2
--disk none
---features apic.eoi=off,hap=on,hyperv.synic.state=on,hyperv.reset.state=off,hyperv.spinlocks.state=on,hyperv.spinlocks.retries=5678,pae=on,pmu.state=on,pvspinlock.state=off,smm.state=off,viridian=on,vmcoreinfo.state=on,vmport.state=off,kvm.hidden.state=on,hyperv.vapic.state=off,hyperv.relaxed.state=off,gic.version=host,kvm.hint-dedicated.state=on
+--features apic.eoi=off,hap=on,hyperv.synic.state=on,hyperv.reset.state=off,hyperv.spinlocks.state=on,hyperv.spinlocks.retries=5678,pae=on,pmu.state=on,pvspinlock.state=off,smm.state=off,viridian=on,vmcoreinfo.state=on,vmport.state=off,kvm.hidden.state=on,hyperv.vapic.state=off,hyperv.relaxed.state=off,gic.version=host,kvm.hint-dedicated.state=on,ioapic.driver=qemu
--clock rtc_present=no,pit_present=yes,pit_tickpolicy=catchup,tsc_present=no,platform_present=no,hypervclock_present=no,platform_tickpolicy=foo,hpet_tickpolicy=bar,tsc_tickpolicy=wibble,kvmclock_tickpolicy=wobble,hypervclock_tickpolicy=woo
--boot bios.useserial=no,bios.rebootTimeout=60,cmdline=root=/foo,smbios.mode=host,bootmenu.enable=yes,loader_ro=yes,loader.type=rom,loader=/tmp/foo
--memorybacking access.mode=shared,source.type=anonymous,hugepages=on
diff --git a/tests/test_xmlparse.py b/tests/test_xmlparse.py
index 6d1aaddb..ac2fb38d 100644
--- a/tests/test_xmlparse.py
+++ b/tests/test_xmlparse.py
@@ -160,6 +160,7 @@ def testAlterGuest():
check("kvm_hidden", None, True)
check("pvspinlock", None, True)
check("gic_version", None, False)
+ check("ioapic_driver", None, "qemu")
check = _make_checker(guest.cpu)
check("match", "exact", "strict")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index e1a988f9..dbd4a545 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2777,6 +2777,7 @@ class ParserFeatures(VirtCLIParser):
cls.add_arg("smm.state", "smm", is_onoff=True)
cls.add_arg("vmcoreinfo.state", "vmcoreinfo", is_onoff=True)
+ cls.add_arg("ioapic.driver", "ioapic_driver")
###################
diff --git a/virtinst/domain/features.py b/virtinst/domain/features.py
index 246839f2..7d32edc0 100644
--- a/virtinst/domain/features.py
+++ b/virtinst/domain/features.py
@@ -41,6 +41,7 @@ class DomainFeatures(XMLBuilder):
smm = XMLProperty("./smm/@state", is_onoff=True)
vmcoreinfo = XMLProperty("./vmcoreinfo/@state", is_onoff=True)
+ ioapic_driver = XMLProperty("./ioapic/@driver")
##################
--
2.34.1

View File

@ -0,0 +1,71 @@
From c1da35159c20e0d633f6c568bb984311a4fed861 Mon Sep 17 00:00:00 2001
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 14 Sep 2021 17:08:35 +0200
Subject: [PATCH] cli: introduce --resource fibrechannel.appid option
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 0953e1aea1fd16cd1825c03f3b032c7f12f3322f)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2011327
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
tests/data/cli/compare/virt-install-singleton-config-1.xml | 1 +
tests/test_cli.py | 2 +-
virtinst/cli.py | 1 +
virtinst/domain/resource.py | 3 ++-
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/data/cli/compare/virt-install-singleton-config-1.xml b/tests/data/cli/compare/virt-install-singleton-config-1.xml
index 518a0099..b50d806e 100644
--- a/tests/data/cli/compare/virt-install-singleton-config-1.xml
+++ b/tests/data/cli/compare/virt-install-singleton-config-1.xml
@@ -19,6 +19,7 @@
</numatune>
<resource>
<partition>/virtualmachines/production</partition>
+ <fibrechannel appid="myapplication"/>
</resource>
<os>
<type arch="x86_64" machine="q35">hvm</type>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5e69a135..5b174933 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -480,7 +480,7 @@ c.add_compare("""
--memorybacking hugepages=on
--features apic=off
--clock offset=localtime
---resource /virtualmachines/production
+--resource /virtualmachines/production,fibrechannel.appid=myapplication
--events on_crash=restart
--metadata genid_enable=yes
--sysinfo host
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 8e5b13cd..e1a988f9 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1999,6 +1999,7 @@ class ParserResource(VirtCLIParser):
def _init_class(cls, **kwargs):
VirtCLIParser._init_class(**kwargs)
cls.add_arg("partition", "partition")
+ cls.add_arg("fibrechannel.appid", "fibrechannel_appid", can_comma=True)
######################
diff --git a/virtinst/domain/resource.py b/virtinst/domain/resource.py
index d0962db9..8ad3df54 100644
--- a/virtinst/domain/resource.py
+++ b/virtinst/domain/resource.py
@@ -14,6 +14,7 @@ class DomainResource(XMLBuilder):
"""
XML_NAME = "resource"
- _XML_PROP_ORDER = ["partition"]
+ _XML_PROP_ORDER = ["partition", "fibrechannel_appid"]
partition = XMLProperty("./partition")
+ fibrechannel_appid = XMLProperty("./fibrechannel/@appid")
--
2.31.1

View File

@ -0,0 +1,50 @@
From 61e24e595852a552019912b9a9d6884f5012dc6e Mon Sep 17 00:00:00 2001
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 5 Feb 2021 12:15:46 +0100
Subject: [PATCH] console: fix error with old pygobject
The code doesn't work as expected. From python documentation:
x and y
is the same as
x if not x or y
so in the code if for some reasone `dev` is None the value stored in
`sensitive` will be None as well.
No the code itself works with pygobject >= 3.31.3 where they allowed
None as a valid boolean value, but with older versions it will fail
with this error message:
TypeError: Argument 1 does not allow None as a value
Resolves: https://github.com/virt-manager/virt-manager/issues/226
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit cf93e2dbff28fe05d6d45364c579f923b157beb1)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2026987
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtManager/details/console.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtManager/details/console.py b/virtManager/details/console.py
index c4ed478ed..18f9ddd91 100644
--- a/virtManager/details/console.py
+++ b/virtManager/details/console.py
@@ -258,7 +258,7 @@ class _ConsoleMenu:
cb = toggled_cb
cbdata = dev
- sensitive = dev and not tooltip
+ sensitive = bool(dev and not tooltip)
active = False
if oldlabel is None and sensitive:
--
2.35.1

View File

@ -0,0 +1,397 @@
From a6f53b7da4ac6ff0139e7a130ba875a61a877617 Mon Sep 17 00:00:00 2001
Message-ID: <a6f53b7da4ac6ff0139e7a130ba875a61a877617.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Sep 2024 10:02:59 -0400
Subject: [PATCH] guest: add convert_to_vnc()
From: Cole Robinson <crobinso@redhat.com>
This is the beginnings of support for a `virt-xml --convert-to-vnc`
option. Take an existing VM, strip out most of the previous graphics
config, and add VNC graphics.
We try to convert over some of the shared graphic bits, like listen
and port settings, if they were previously specified.
If spice GL was enabled, we convert to egl-headless config
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 229b905053f3d4bc17e7ad0f8d3fc2c3f23c47cd)
Conflicts:
tests/test_xmlparse.py
virtinst/guest.py
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
.../data/xmlparse/convert-to-vnc-empty-in.xml | 13 +++
.../xmlparse/convert-to-vnc-empty-out.xml | 13 +++
.../xmlparse/convert-to-vnc-has-vnc-in.xml | 31 +++++++
.../xmlparse/convert-to-vnc-has-vnc-out.xml | 22 +++++
.../convert-to-vnc-spice-devices-in.xml | 30 +++++++
.../convert-to-vnc-spice-devices-out.xml | 22 +++++
.../convert-to-vnc-spice-manyopts-in.xml | 20 +++++
.../convert-to-vnc-spice-manyopts-out.xml | 20 +++++
tests/test_xmlparse.py | 14 +++
virtinst/guest.py | 88 ++++++++++++++++++-
10 files changed, 269 insertions(+), 4 deletions(-)
create mode 100644 tests/data/xmlparse/convert-to-vnc-empty-in.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-empty-out.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml
create mode 100644 tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml
diff --git a/tests/data/xmlparse/convert-to-vnc-empty-in.xml b/tests/data/xmlparse/convert-to-vnc-empty-in.xml
new file mode 100644
index 000000000..bc370a8a2
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-empty-in.xml
@@ -0,0 +1,13 @@
+<domain type='qemu'>
+ <name>convert-me</name>
+ <memory unit='KiB'>8388608</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ </devices>
+</domain>
+
diff --git a/tests/data/xmlparse/convert-to-vnc-empty-out.xml b/tests/data/xmlparse/convert-to-vnc-empty-out.xml
new file mode 100644
index 000000000..8612a6567
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-empty-out.xml
@@ -0,0 +1,13 @@
+<domain type="qemu">
+ <name>convert-me</name>
+ <memory unit="KiB">8388608</memory>
+ <currentMemory unit="KiB">2097152</currentMemory>
+ <vcpu placement="static">2</vcpu>
+ <os>
+ <type arch="i686">hvm</type>
+ <boot dev="hd"/>
+ </os>
+ <devices>
+ <graphics type="vnc" port="-1"/>
+ </devices>
+</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml b/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml
new file mode 100644
index 000000000..29ee53d4c
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml
@@ -0,0 +1,31 @@
+<domain type="kvm">
+ <name>convert-me</name>
+ <memory>2097152</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="x86_64" machine="q35">hvm</type>
+ <boot dev="network"/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <vmport state="off"/>
+ </features>
+ <devices>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <graphics type="vnc" port="5907"/>
+ <sound model="ich9"/>
+ <audio type='spice'/>
+ <video>
+ <model type="virtio"/>
+ </video>
+ <redirdev bus="usb" type="spicevmc"/>
+ <redirdev bus="usb" type="spicevmc"/>
+ </devices>
+</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml b/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml
new file mode 100644
index 000000000..113f70a1e
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml
@@ -0,0 +1,22 @@
+<domain type="kvm">
+ <name>convert-me</name>
+ <memory>2097152</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="x86_64" machine="q35">hvm</type>
+ <boot dev="network"/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <vmport state="off"/>
+ </features>
+ <devices>
+ <graphics type="vnc" port="5907"/>
+ <sound model="ich9"/>
+ <video>
+ <model type="virtio"/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml b/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
new file mode 100644
index 000000000..8c5c63bdf
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
@@ -0,0 +1,30 @@
+<domain type="kvm">
+ <name>convert-me</name>
+ <memory>2097152</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="x86_64" machine="q35">hvm</type>
+ <boot dev="network"/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <vmport state="off"/>
+ </features>
+ <devices>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich9"/>
+ <audio type='spice'/>
+ <video>
+ <model type="virtio"/>
+ </video>
+ <redirdev bus="usb" type="spicevmc"/>
+ <redirdev bus="usb" type="spicevmc"/>
+ </devices>
+</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml b/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml
new file mode 100644
index 000000000..cc3fefabe
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml
@@ -0,0 +1,22 @@
+<domain type="kvm">
+ <name>convert-me</name>
+ <memory>2097152</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="x86_64" machine="q35">hvm</type>
+ <boot dev="network"/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <vmport state="off"/>
+ </features>
+ <devices>
+ <graphics type="vnc" port="-1"/>
+ <sound model="ich9"/>
+ <video>
+ <model type="virtio"/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml
new file mode 100644
index 000000000..ebd20a56d
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml
@@ -0,0 +1,20 @@
+<domain type='qemu'>
+ <name>convert-me</name>
+ <memory unit='KiB'>8388608</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <devices>
+ <graphics type='spice' port='5907' tlsPort='5901' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect' keymap='de' listen='127.0.0.1'>
+ <listen type='socket' socket='/tmp/spice.sock'/>
+ <listen type='address' address='127.0.0.1'/>
+ <gl enable='yes' rendernode='/dev/my/rendernode'/>
+ </graphics>
+ <graphics type='sdl'/>
+ </devices>
+</domain>
+
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml
new file mode 100644
index 000000000..c98c63830
--- /dev/null
+++ b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml
@@ -0,0 +1,20 @@
+<domain type="qemu">
+ <name>convert-me</name>
+ <memory unit="KiB">8388608</memory>
+ <currentMemory unit="KiB">2097152</currentMemory>
+ <vcpu placement="static">2</vcpu>
+ <os>
+ <type arch="i686">hvm</type>
+ <boot dev="hd"/>
+ </os>
+ <clock offset="utc"/>
+ <devices>
+ <graphics type="vnc" port="5907" keymap="de" listen="127.0.0.1" passwd="sercet" passwdValidTo="2011-05-31T16:11:22">
+ <listen type="socket" socket="/tmp/spice.sock"/>
+ <listen type="address" address="127.0.0.1"/>
+ </graphics>
+ <graphics type="egl-headless">
+ <gl rendernode="/dev/my/rendernode"/>
+ </graphics>
+ </devices>
+</domain>
diff --git a/tests/test_xmlparse.py b/tests/test_xmlparse.py
index ac2fb38d2..e11d15d07 100644
--- a/tests/test_xmlparse.py
+++ b/tests/test_xmlparse.py
@@ -1135,3 +1135,17 @@ def testControllerAttachedDevices():
# Little test for DeviceAddress.pretty_desc
assert devs[-1].address.pretty_desc() == "0:0:0:3"
+
+
+def testConvertToVNC():
+ conn = utils.URIs.openconn(utils.URIs.kvm_x86)
+
+ def _test(filename_base):
+ guest, outfile = _get_test_content(conn, filename_base)
+ guest.convert_to_vnc()
+ _alter_compare(conn, guest.get_xml(), outfile)
+
+ _test("convert-to-vnc-empty")
+ _test("convert-to-vnc-spice-devices")
+ _test("convert-to-vnc-spice-manyopts")
+ _test("convert-to-vnc-has-vnc")
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 7aa62be49..93e71a149 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -706,6 +706,84 @@ class Guest(XMLBuilder):
self.vcpus = self.cpu.vcpus_from_topology()
self.cpu.set_topology_defaults(self.vcpus)
+ def _convert_spice_gl_to_egl_headless(self):
+ if not self.has_spice():
+ return
+
+ spicedev = [g for g in self.devices.graphics if g.type == "spice"][0]
+ if not spicedev.gl:
+ return
+
+ dev = DeviceGraphics(self.conn)
+ dev.type = "egl-headless"
+ dev.set_defaults(self.conn)
+ if spicedev.rendernode:
+ dev.rendernode = spicedev.rendernode
+ self.add_device(dev)
+
+ def _convert_to_vnc_graphics(self):
+ """
+ If there's already VNC graphics configured, we leave it intact,
+ but rip out all evidence of other graphics devices.
+
+ If there's other non-VNC, non-egl-headless configured, we try to
+ inplace convert the first device we encounter.
+
+ If there's no graphics configured, set up a default VNC config.`
+ """
+ vnc_devs = [g for g in self.devices.graphics if g.type == "vnc"]
+ # We ignore egl-headless, it's not a true graphical frontend
+ other_devs = [g for g in self.devices.graphics if
+ g.type != "vnc" and g.type != "egl-headless"]
+
+ # Guest already had a vnc device.
+ # Remove all other devs and we are done
+ if vnc_devs:
+ for g in other_devs:
+ self.remove_device(g)
+ return
+
+ # We didn't find any non-vnc device to convert.
+ # Add a vnc device with default config
+ if not other_devs:
+ dev = DeviceGraphics(self.conn)
+ dev.type = dev.TYPE_VNC
+ dev.set_defaults(self.conn)
+ self.add_device(dev)
+ return
+
+ # Convert the pre-existing graphics device to vnc
+ # Remove the rest
+ dev = other_devs.pop(0)
+ srcdev = DeviceGraphics(self.conn, dev.get_xml())
+ for g in other_devs:
+ self.remove_device(g)
+
+ dev.clear()
+ dev.type = dev.TYPE_VNC
+ dev.keymap = srcdev.keymap
+ dev.port = srcdev.port
+ dev.autoport = srcdev.autoport
+ dev.passwd = srcdev.passwd
+ dev.passwdValidTo = srcdev.passwdValidTo
+ dev.listen = srcdev.listen
+ for listen in srcdev.listens:
+ srcdev.remove_child(listen)
+ dev.add_child(listen)
+ dev.set_defaults(self)
+
+ def convert_to_vnc(self):
+ """
+ Convert existing XML to have one VNC graphics connection.
+ """
+ self._convert_spice_gl_to_egl_headless()
+
+ # Rip out spice graphics devices unconditionally.
+ # Could be necessary if XML is in broken state.
+ self._force_remove_spice_devices()
+
+ self._convert_to_vnc_graphics()
+
def set_defaults(self, _guest):
self.set_capabilities_defaults()
@@ -1061,10 +1139,12 @@ class Guest(XMLBuilder):
if redirdev.type == "spicevmc":
self.devices.remove_child(redirdev)
- def _remove_spice_devices(self, rmdev):
- if rmdev.DEVICE_TYPE != "graphics" or self.has_spice():
- return
-
+ def _force_remove_spice_devices(self):
self._remove_spice_audio()
self._remove_spice_channels()
self._remove_spice_usbredir()
+
+ def _remove_spice_devices(self, rmdev):
+ if rmdev.DEVICE_TYPE != "graphics" or self.has_spice():
+ return
+ self._force_remove_spice_devices()
--
2.48.1

View File

@ -0,0 +1,190 @@
From 834497bf91142335b1ba97a7415fabd08ad55843 Mon Sep 17 00:00:00 2001
Message-ID: <834497bf91142335b1ba97a7415fabd08ad55843.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 18 Sep 2024 10:36:26 -0400
Subject: [PATCH] guest: convert_to_vnc: convert video device
From: Cole Robinson <crobinso@redhat.com>
This is mostly about stripping out spice references. All qxl devices
are converted to app defaults
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit d58299ee6b8fe59b399fde59a4dd684c399c3bbb)
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
.../xmlparse/convert-to-vnc-empty-out.xml | 3 +++
.../xmlparse/convert-to-vnc-has-vnc-in.xml | 2 +-
.../xmlparse/convert-to-vnc-has-vnc-out.xml | 2 +-
.../convert-to-vnc-spice-devices-in.xml | 3 +++
.../convert-to-vnc-spice-devices-out.xml | 3 +++
.../convert-to-vnc-spice-manyopts-in.xml | 8 ++++++
.../convert-to-vnc-spice-manyopts-out.xml | 5 ++++
virtinst/devices/video.py | 1 +
virtinst/guest.py | 27 +++++++++++++++++++
9 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/tests/data/xmlparse/convert-to-vnc-empty-out.xml b/tests/data/xmlparse/convert-to-vnc-empty-out.xml
index 8612a6567..54e0353aa 100644
--- a/tests/data/xmlparse/convert-to-vnc-empty-out.xml
+++ b/tests/data/xmlparse/convert-to-vnc-empty-out.xml
@@ -9,5 +9,8 @@
</os>
<devices>
<graphics type="vnc" port="-1"/>
+ <video>
+ <model type="vga"/>
+ </video>
</devices>
</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml b/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml
index 29ee53d4c..dd25347fb 100644
--- a/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml
+++ b/tests/data/xmlparse/convert-to-vnc-has-vnc-in.xml
@@ -23,7 +23,7 @@
<sound model="ich9"/>
<audio type='spice'/>
<video>
- <model type="virtio"/>
+ <model type="qxl" heads='4' vgamem='1'/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
diff --git a/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml b/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml
index 113f70a1e..e07163a78 100644
--- a/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml
+++ b/tests/data/xmlparse/convert-to-vnc-has-vnc-out.xml
@@ -16,7 +16,7 @@
<graphics type="vnc" port="5907"/>
<sound model="ich9"/>
<video>
- <model type="virtio"/>
+ <model type="vga"/>
</video>
</devices>
</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml b/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
index f5dff5ed1..e57d6377a 100644
--- a/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
+++ b/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
@@ -21,6 +21,9 @@
</graphics>
<sound model="ich9"/>
<audio type='spice'/>
+ <video>
+ <model type="qxl" primary='yes'/>
+ </video>
<video>
<model type="virtio"/>
</video>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml b/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml
index cc3fefabe..42aac52c2 100644
--- a/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml
+++ b/tests/data/xmlparse/convert-to-vnc-spice-devices-out.xml
@@ -15,6 +15,9 @@
<devices>
<graphics type="vnc" port="-1"/>
<sound model="ich9"/>
+ <video>
+ <model type="vga"/>
+ </video>
<video>
<model type="virtio"/>
</video>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml
index ebd20a56d..7c12b6b34 100644
--- a/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml
+++ b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-in.xml
@@ -15,6 +15,14 @@
<gl enable='yes' rendernode='/dev/my/rendernode'/>
</graphics>
<graphics type='sdl'/>
+ <video>
+ <model type='virtio'>
+ <acceleration accel3d='yes'/>
+ </model>
+ </video>
+ <video>
+ <model type='qxl'/>
+ </video>
</devices>
</domain>
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml
index c98c63830..35b1b771f 100644
--- a/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml
+++ b/tests/data/xmlparse/convert-to-vnc-spice-manyopts-out.xml
@@ -13,6 +13,11 @@
<listen type="socket" socket="/tmp/spice.sock"/>
<listen type="address" address="127.0.0.1"/>
</graphics>
+ <video>
+ <model type="virtio" primary="yes">
+ <acceleration accel3d="yes"/>
+ </model>
+ </video>
<graphics type="egl-headless">
<gl rendernode="/dev/my/rendernode"/>
</graphics>
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
index f93831318..bd68e4738 100644
--- a/virtinst/devices/video.py
+++ b/virtinst/devices/video.py
@@ -19,6 +19,7 @@ class DeviceVideo(Device):
heads = XMLProperty("./model/@heads", is_int=True)
vgamem = XMLProperty("./model/@vgamem", is_int=True)
accel3d = XMLProperty("./model/acceleration/@accel3d", is_yesno=True)
+ primary = XMLProperty("./model/@primary", is_yesno=True)
##################
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 3a80d8dad..b0ff87276 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -772,6 +772,32 @@ class Guest(XMLBuilder):
dev.add_child(listen)
dev.set_defaults(self)
+ def _convert_to_vnc_video(self):
+ """
+ If there's no video device, add a default one.
+ If there's any qxl device, reset its config to app defaults.
+ """
+ if not self.devices.video:
+ videodev = DeviceVideo(self.conn)
+ videodev.set_defaults(self)
+ self.add_device(videodev)
+ return
+
+ qxl_devs = [v for v in self.devices.video if v.model == "qxl"]
+ if qxl_devs and not any(dev.primary for dev in self.devices.video):
+ # Make sure `primary` flag is set, we need it up ahead
+ self.devices.video[0].primary = True
+
+ for dev in qxl_devs:
+ is_primary = dev.primary
+ dev.clear()
+ dev.set_defaults(self)
+ if not is_primary and dev.model != "virtio":
+ # Device can't be non-primary, so just remove it
+ log.debug("Can't use model=%s for non-primary video device, "
+ "removing it instead.", dev.model)
+ self.remove_device(dev)
+
def convert_to_vnc(self):
"""
Convert existing XML to have one VNC graphics connection.
@@ -783,6 +809,7 @@ class Guest(XMLBuilder):
self._force_remove_spice_devices()
self._convert_to_vnc_graphics()
+ self._convert_to_vnc_video()
def set_defaults(self, _guest):
self.set_capabilities_defaults()
--
2.48.1

View File

@ -0,0 +1,65 @@
From 066c261ffb471d0b5319adbdf890eb2b27d55aa9 Mon Sep 17 00:00:00 2001
Message-ID: <066c261ffb471d0b5319adbdf890eb2b27d55aa9.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 18 Sep 2024 09:57:48 -0400
Subject: [PATCH] guest: remove spiceport devices when spice is removed
From: Cole Robinson <crobinso@redhat.com>
serial/console type='spiceport' is another spice specific device,
so remove that too
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit f0078a179d19c7060fa2dbd8868bd3c423cc0202)
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
.../data/xmlparse/convert-to-vnc-spice-devices-in.xml | 10 ++++++++++
virtinst/guest.py | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml b/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
index 8c5c63bdf..f5dff5ed1 100644
--- a/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
+++ b/tests/data/xmlparse/convert-to-vnc-spice-devices-in.xml
@@ -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>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 93e71a149..3a80d8dad 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -1139,10 +1139,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():
--
2.48.1

View File

@ -0,0 +1,35 @@
From 99d841337bab8134c173168cabd93e9b133f6049 Mon Sep 17 00:00:00 2001
From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Date: Mon, 31 May 2021 21:54:27 +0200
Subject: [PATCH] hostdev: use method get_mdev_uuid()
Use method get_mdev_uuid() to retrieve the UUID of MDEV node device
object.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
(cherry picked from commit f87e96d3d40891f1403601abc389c24800ba1069)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1995125
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtinst/devices/hostdev.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtinst/devices/hostdev.py b/virtinst/devices/hostdev.py
index e8d0fae2..b3717430 100644
--- a/virtinst/devices/hostdev.py
+++ b/virtinst/devices/hostdev.py
@@ -78,7 +78,7 @@ class DeviceHostdev(Device):
_("Don't know how to generate nodedev for mdev type id '%s'") %
nodedev.type_id)
- self.uuid = nodedev.name[5:].replace('_', '-')
+ self.uuid = nodedev.get_mdev_uuid()
else:
raise ValueError(_("Unknown node device type %s") % nodedev)
--
2.31.1

View File

@ -0,0 +1,230 @@
From a243508cc0a896dd35a73277ca651fa8638b086b Mon Sep 17 00:00:00 2001
From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Date: Mon, 31 May 2021 21:54:28 +0200
Subject: [PATCH] tests: verify MDEV support
Add tests to verify add, edit and remove features of mediated
devices.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
(cherry picked from commit 9d4002ee0f7088c490748ffb3144c006f4e39c68)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1995125
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
.../virt-xml-add-hostdev-mdev-start.xml | 12 +++++++
.../cli/compare/virt-xml-add-hostdev-mdev.xml | 14 ++++++++
tests/data/cli/compare/virt-xml-edit-all.xml | 7 ++++
.../compare/virt-xml-edit-hostdev-mdev.xml | 11 +++++++
.../compare/virt-xml-edit-simple-redirdev.xml | 2 +-
.../compare/virt-xml-remove-hostdev-mdev.xml | 15 +++++++++
tests/data/testdriver/testsuite.xml | 32 +++++++++++++++++++
tests/test_cli.py | 4 +++
tests/utils.py | 2 +-
9 files changed, 97 insertions(+), 2 deletions(-)
create mode 100644 tests/data/cli/compare/virt-xml-add-hostdev-mdev-start.xml
create mode 100644 tests/data/cli/compare/virt-xml-add-hostdev-mdev.xml
create mode 100644 tests/data/cli/compare/virt-xml-edit-hostdev-mdev.xml
create mode 100644 tests/data/cli/compare/virt-xml-remove-hostdev-mdev.xml
diff --git a/tests/data/cli/compare/virt-xml-add-hostdev-mdev-start.xml b/tests/data/cli/compare/virt-xml-add-hostdev-mdev-start.xml
new file mode 100644
index 00000000..3742d454
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-add-hostdev-mdev-start.xml
@@ -0,0 +1,12 @@
+ <model type="cirrus" vram="16384" heads="1" primary="yes"/>
+ </video>
+ <memballoon model="virtio"/>
++ <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
++ <source>
++ <address uuid="8e37ee90-2b51-45e3-9b25-bf8283c03110"/>
++ </source>
++ </hostdev>
+ </devices>
+ </domain>
+
+Domain 'test-state-shutoff' started successfully.
diff --git a/tests/data/cli/compare/virt-xml-add-hostdev-mdev.xml b/tests/data/cli/compare/virt-xml-add-hostdev-mdev.xml
new file mode 100644
index 00000000..c2acff8f
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-add-hostdev-mdev.xml
@@ -0,0 +1,14 @@
+ <vsock model="virtio">
+ <cid auto="no" address="5"/>
+ </vsock>
++ <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
++ <source>
++ <address uuid="8e37ee90-2b51-45e3-9b25-bf8283c03110"/>
++ </source>
++ </hostdev>
+ </devices>
+ <seclabel type="dynamic" model="selinux" relabel="yes"/>
+ <keywrap>
+
+Domain 'test-for-virtxml' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/data/cli/compare/virt-xml-edit-all.xml b/tests/data/cli/compare/virt-xml-edit-all.xml
index ed09effc..5bdee2aa 100644
--- a/tests/data/cli/compare/virt-xml-edit-all.xml
+++ b/tests/data/cli/compare/virt-xml-edit-all.xml
@@ -8,6 +8,13 @@
<address domain="0x0000" bus="0x00" slot="0x19" function="0x0"/>
</source>
<rom bar="off"/>
++ <driver name="vfio"/>
+ </hostdev>
+ <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
+ <source>
+ <address uuid="b1ae8bf6-38b0-4c81-9d44-78ce3f520496"/>
+ </source>
+ <address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0002"/>
+ <driver name="vfio"/>
</hostdev>
<redirdev bus="usb" type="tcp">
diff --git a/tests/data/cli/compare/virt-xml-edit-hostdev-mdev.xml b/tests/data/cli/compare/virt-xml-edit-hostdev-mdev.xml
new file mode 100644
index 00000000..ef5523db
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-edit-hostdev-mdev.xml
@@ -0,0 +1,11 @@
+ <source>
+ <address uuid="b1ae8bf6-38b0-4c81-9d44-78ce3f520496"/>
+ </source>
+- <address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0002"/>
++ <address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0008"/>
+ </hostdev>
+ <redirdev bus="usb" type="tcp">
+ <source mode="connect" host="localhost" service="4000"/>
+
+Domain 'test-for-virtxml' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/data/cli/compare/virt-xml-edit-simple-redirdev.xml b/tests/data/cli/compare/virt-xml-edit-simple-redirdev.xml
index 52ffddfe..f1a0ff6c 100644
--- a/tests/data/cli/compare/virt-xml-edit-simple-redirdev.xml
+++ b/tests/data/cli/compare/virt-xml-edit-simple-redirdev.xml
@@ -1,5 +1,5 @@
</source>
- <rom bar="off"/>
+ <address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0002"/>
</hostdev>
- <redirdev bus="usb" type="tcp">
- <source mode="connect" host="localhost" service="4000"/>
diff --git a/tests/data/cli/compare/virt-xml-remove-hostdev-mdev.xml b/tests/data/cli/compare/virt-xml-remove-hostdev-mdev.xml
new file mode 100644
index 00000000..d4c33804
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-remove-hostdev-mdev.xml
@@ -0,0 +1,15 @@
+ </source>
+ <rom bar="off"/>
+ </hostdev>
+- <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
+- <source>
+- <address uuid="b1ae8bf6-38b0-4c81-9d44-78ce3f520496"/>
+- </source>
+- <address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0002"/>
+- </hostdev>
+ <redirdev bus="usb" type="tcp">
+ <source mode="connect" host="localhost" service="4000"/>
+ <protocol type="raw"/>
+
+Domain 'test-for-virtxml' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/data/testdriver/testsuite.xml b/tests/data/testdriver/testsuite.xml
index fd255138..a073cbce 100644
--- a/tests/data/testdriver/testsuite.xml
+++ b/tests/data/testdriver/testsuite.xml
@@ -259,6 +259,12 @@
</source>
<rom bar='off'/>
</hostdev>
+ <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
+ <source>
+ <address uuid="b1ae8bf6-38b0-4c81-9d44-78ce3f520496"/>
+ </source>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
+ </hostdev>
<serial type='null'/>
@@ -737,5 +743,31 @@
</capability>
</device>
+<device>
+ <name>mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110</name>
+ <path>/sys/devices/css0/0.0.0023/8e37ee90-2b51-45e3-9b25-bf8283c03110</path>
+ <parent>css_0_0_0023</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='vfio_ccw-io'/>
+ <iommuGroup number='0'/>
+ </capability>
+</device>
+
+<device>
+ <name>mdev_b1ae8bf6_38b0_4c81_9d44_78ce3f520496</name>
+ <path>/sys/devices/css0/0.0.0023/b1ae8bf6-38b0-4c81-9d44-78ce3f520496</path>
+ <parent>css_0_0_0023</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='vfio_ccw-io'/>
+ <iommuGroup number='0'/>
+ </capability>
+</device>
+
</node>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5f94e009..9f0cdfe9 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1274,6 +1274,7 @@ c.add_compare("--edit mac=00:11:7f:33:44:55 --network target=nic55", "edit-selec
c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder")
c.add_compare("--edit path=/dev/null --disk path=,target=fdb,boot_order=12", "edit-disk-unset") # --disk matching, using empty value to unset path
c.add_compare("--edit --memballoon none", "edit-disable-memballoon")
+c.add_compare("--edit address.devno=0x0002 --hostdev address.devno=0x0008", "edit-hostdev-mdev")
c = vixml.add_category("edit and start selection", "test-state-shutoff --print-diff --start")
c.add_compare("--define --edit target=vda --disk boot_order=1", "start-select-disk-bootorder")
@@ -1308,6 +1309,8 @@ c.add_compare("--remove-device --disk /dev/null", "remove-disk-path")
c.add_compare("--remove-device --video all", "remove-video-all")
c.add_compare("--remove-device --host-device 0x04b3:0x4485", "remove-hostdev-name")
c.add_compare("--remove-device --memballoon all", "remove-memballoon")
+c.add_compare("--add-device --hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110", "add-hostdev-mdev")
+c.add_compare("--remove-device --hostdev mdev_b1ae8bf6_38b0_4c81_9d44_78ce3f520496", "remove-hostdev-mdev")
c = vixml.add_category("add/rm devices and start", "test-state-shutoff --print-diff --start")
c.add_invalid("--add-device --pm suspend_to_disk=yes") # --add-device without a device
@@ -1318,6 +1321,7 @@ c.add_compare("--define --add-device --host-device usb_device_4b3_4485_noserial"
c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic-start")
c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage-start")
c.add_compare("--remove-device --disk /dev/null", "remove-disk-path-start")
+c.add_compare("--add-device --hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110", "add-hostdev-mdev-start")
c = vixml.add_category("add/rm devices OS KVM", "--connect %(URI-KVM)s test --print-diff --define")
c.add_compare("--add-device --disk %(EXISTIMG1)s", "kvm-add-disk-os-from-xml") # Guest OS (none) from XML
diff --git a/tests/utils.py b/tests/utils.py
index 16ba26b4..62443ca8 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -231,7 +231,7 @@ def diff_compare(actual_out, filename=None, expect_out=None):
open(filename, "w").write(actual_out)
expect_out = open(filename).read()
- diff = xmlutil.diff(expect_out, actual_out,
+ diff = xmlutil.diff(expect_out.rstrip(), actual_out.rstrip(),
filename or '', "Generated output")
if diff:
raise AssertionError("Conversion outputs did not match.\n%s" % diff)
--
2.31.1

View File

@ -0,0 +1,130 @@
From 55350d15d86be7ee188a47d62237434593c0da19 Mon Sep 17 00:00:00 2001
Message-ID: <55350d15d86be7ee188a47d62237434593c0da19.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 25 Mar 2024 13:25:32 +0100
Subject: [PATCH] testsuite: add test-spice vm definition
This will test spice related changes. Follow up patches will change this
behavior to remove spice related devices.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 7a03f3efa8d3b9d6146687bf8f3bf0d3ef39b562)
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
.../compare/virt-xml-change-spice-to-vnc.xml | 11 +++++
.../virt-xml-remove-spice-graphics.xml | 14 +++++++
tests/data/testdriver/testsuite.xml | 41 +++++++++++++++++++
tests/test_cli.py | 4 ++
4 files changed, 70 insertions(+)
create mode 100644 tests/data/cli/compare/virt-xml-change-spice-to-vnc.xml
create mode 100644 tests/data/cli/compare/virt-xml-remove-spice-graphics.xml
diff --git a/tests/data/cli/compare/virt-xml-change-spice-to-vnc.xml b/tests/data/cli/compare/virt-xml-change-spice-to-vnc.xml
new file mode 100644
index 000000000..edc667037
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-change-spice-to-vnc.xml
@@ -0,0 +1,11 @@
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+- <graphics type="spice" autoport="yes">
++ <graphics type="vnc" autoport="yes">
+ <listen type="address"/>
+ <image compression="off"/>
+ <gl enable="no"/>
+
+Domain 'test-spice' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml b/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml
new file mode 100644
index 000000000..ed9f2a584
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml
@@ -0,0 +1,14 @@
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+- <graphics type="spice" autoport="yes">
+- <listen type="address"/>
+- <image compression="off"/>
+- <gl enable="no"/>
+- </graphics>
+ <audio id="1" type="spice"/>
+ <video>
+ <model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
+
+Domain 'test-spice' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/data/testdriver/testsuite.xml b/tests/data/testdriver/testsuite.xml
index a073cbce5..d6cace017 100644
--- a/tests/data/testdriver/testsuite.xml
+++ b/tests/data/testdriver/testsuite.xml
@@ -96,6 +96,47 @@
</domain>
+<domain type='test'>
+ <name>test-spice</name>
+ <uuid>12345678-1234-FFFF-1234-12345678ABCD</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <vmport state='off'/>
+ <smm state='on'/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0' model='qemu-xhci' ports='15'/>
+ <channel type='spicevmc'>
+ <target type='virtio' name='com.redhat.spice.0'/>
+ </channel>
+ <graphics type='spice' autoport='yes' connected='fail'>
+ <listen type='address'/>
+ <image compression='off'/>
+ <gl enable='no'/>
+ </graphics>
+ <audio id='1' type='spice'/>
+ <video>
+ <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
+ </video>
+ <redirdev bus='usb' type='spicevmc'/>
+ <redirdev bus='usb' type='spicevmc'/>
+ </devices>
+</domain>
+
+
<domain type='test'>
<name>test-for-virtxml</name>
<metadata>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 532f456ae..04386f63b 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1318,6 +1318,10 @@ c.add_compare("--remove-device --memballoon all", "remove-memballoon")
c.add_compare("--add-device --hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110", "add-hostdev-mdev")
c.add_compare("--remove-device --hostdev mdev_b1ae8bf6_38b0_4c81_9d44_78ce3f520496", "remove-hostdev-mdev")
+c = vixml.add_category("edit/remove spice graphics", "test-spice --print-diff --define")
+c.add_compare("--edit --graphics type=vnc", "change-spice-to-vnc")
+c.add_compare("--remove-device --graphics type=spice", "remove-spice-graphics")
+
c = vixml.add_category("add/rm devices and start", "test-state-shutoff --print-diff --start")
c.add_invalid("--add-device --pm suspend_to_disk=yes") # --add-device without a device
c.add_invalid("--remove-device --clock utc") # --remove-device without a dev
--
2.48.1

View File

@ -0,0 +1,256 @@
From 5245be196682b78c225e67f211c02e3802ca4bd6 Mon Sep 17 00:00:00 2001
From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Date: Wed, 14 Apr 2021 17:18:55 +0200
Subject: [PATCH] virt-install: add mediated device
Add support to install a virtual server with passed-through mediated
device. Mediated device can be created using vGPU attached to
vfio_pci driver or DASD attached to vfio_ccw driver or APQNs attached
to vfio_ap driver.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
(cherry picked from commit 965480e8bc85caf8a4f36b4a2f07963067b63cf6)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1995125
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
.../cli/compare/virt-install-many-devices.xml | 19 +++++++++
tests/data/testdriver/testdriver.xml | 40 +++++++++++++++++++
tests/test_cli.py | 3 ++
tests/test_nodedev.py | 30 ++++++++++++++
virtinst/devices/hostdev.py | 36 ++++++++++++++++-
virtinst/nodedev.py | 4 ++
6 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index 49e9dcc7..3bd756b3 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -592,6 +592,25 @@
<char>/dev/pty7</char>
</source>
</hostdev>
+ <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ccw">
+ <address type="ccw" cssid="0xfe" ssid="0x1" devno="0x0008"/>
+ <source>
+ <address uuid="8e37ee90-2b51-45e3-9b25-bf8283c03110"/>
+ </source>
+ </hostdev>
+ <hostdev mode="subsystem" type="mdev" managed="no" model="vfio-ap">
+ <source>
+ <address uuid="11f92c9d-b0b0-4016-b306-a8071277f8b9"/>
+ </source>
+ </hostdev>
+ <hostdev mode="subsystem" type="mdev" managed="yes" model="vfio-pci" display="off" ramfb="off">
+ <address type="pci" domain="0" bus="1" slot="1" function="0">
+ <zpci uid="0x0001" fid="0x00000001"/>
+ </address>
+ <source>
+ <address uuid="4b20d080-1b54-4048-85b3-a6a62d165c01"/>
+ </source>
+ </hostdev>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="tcp">
<source host="localhost" service="4000"/>
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index ea90f0f7..b8d67bac 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -3645,5 +3645,45 @@ ba</description>
</capability>
</device>
+<device>
+ <name>mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110</name>
+ <path>/sys/devices/css0/0.0.0023/8e37ee90-2b51-45e3-9b25-bf8283c03110</path>
+ <parent>css_0_0_0023</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='vfio_ccw-io'/>
+ <iommuGroup number='0'/>
+ </capability>
+</device>
+
+<device>
+ <name>mdev_11f92c9d_b0b0_4016_b306_a8071277f8b9</name>
+ <path>/sys/devices/vfio_ap/matrix/11f92c9d-b0b0-4016-b306-a8071277f8b9</path>
+ <parent>ap_matrix</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='vfio_ap-passthrough'/>
+ <iommuGroup number='2'/>
+ <attr name='assign_adapter' value='1'/>
+ <attr name='assign_domain' value='2'/>
+ </capability>
+</device>
+
+<device>
+ <name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
+ <path>/sys/devices/pci0000:00/0000:00:02.0/4b20d080-1b54-4048-85b3-a6a62d165c01</path>
+ <parent>pci_0000_06_00_0</parent>
+ <driver>
+ <name>vfio_mdev</name>
+ </driver>
+ <capability type='mdev'>
+ <type id='nvidia-11'/>
+ <iommuGroup number='12'/>
+ </capability>
+</device>
</node>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5b174933..5f94e009 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -675,6 +675,9 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--hostdev wlan0,type=net
--hostdev /dev/vdz,type=storage
--hostdev /dev/pty7,type=misc
+--hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110,address.type=ccw,address.cssid=0xfe,address.ssid=0x1,address.devno=0x0008
+--hostdev mdev_11f92c9d_b0b0_4016_b306_a8071277f8b9
+--hostdev mdev_4b20d080_1b54_4048_85b3_a6a62d165c01,address.type=pci,address.domain=0x0000,address.bus=0x01,address.slot=0x01,address.function=0x0,address.zpci.uid=0x0001,address.zpci.fid=0x00000001
--filesystem /source,/target,alias.name=testfsalias,driver.ats=on,driver.iommu=off,driver.packed=on
diff --git a/tests/test_nodedev.py b/tests/test_nodedev.py
index 406e321f..79678bc8 100644
--- a/tests/test_nodedev.py
+++ b/tests/test_nodedev.py
@@ -126,6 +126,36 @@ def testDRMDevice():
assert dev.get_devnode("frob")
+def testDASDMdev():
+ conn = utils.URIs.open_testdriver_cached()
+ devname = "mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110"
+ dev = _nodeDevFromName(conn, devname)
+ assert dev.name == devname
+ assert dev.parent == "css_0_0_0023"
+ assert dev.device_type == "mdev"
+ assert dev.type_id == "vfio_ccw-io"
+
+
+def testAPQNMdev():
+ conn = utils.URIs.open_testdriver_cached()
+ devname = "mdev_11f92c9d_b0b0_4016_b306_a8071277f8b9"
+ dev = _nodeDevFromName(conn, devname)
+ assert dev.name == devname
+ assert dev.parent == "ap_matrix"
+ assert dev.device_type == "mdev"
+ assert dev.type_id == "vfio_ap-passthrough"
+
+
+def testPCIMdev():
+ conn = utils.URIs.open_testdriver_cached()
+ devname = "mdev_4b20d080_1b54_4048_85b3_a6a62d165c01"
+ dev = _nodeDevFromName(conn, devname)
+ assert dev.name == devname
+ assert dev.parent == "pci_0000_06_00_0"
+ assert dev.device_type == "mdev"
+ assert dev.type_id == "nvidia-11"
+
+
# NodeDevice 2 Device XML tests
def testNodeDev2USB1():
diff --git a/virtinst/devices/hostdev.py b/virtinst/devices/hostdev.py
index 3e9de2ad..e8d0fae2 100644
--- a/virtinst/devices/hostdev.py
+++ b/virtinst/devices/hostdev.py
@@ -4,6 +4,8 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
+import re
+
from .device import Device
from ..nodedev import NodeDevice
from ..xmlbuilder import XMLProperty
@@ -53,16 +55,45 @@ class DeviceHostdev(Device):
self.scsi_unit = nodedev.lun
self.managed = False
+ elif nodedev.device_type == nodedev.CAPABILITY_TYPE_MDEV:
+ self.type = "mdev"
+
+ if nodedev.type_id == "vfio_ccw-io":
+ self.model = "vfio-ccw"
+ self.managed = "no"
+
+ elif nodedev.type_id == "vfio_ap-passthrough":
+ self.model = "vfio-ap"
+ self.managed = "no"
+
+ elif (re.match("^nvidia-[0-9]{2}", nodedev.type_id) or
+ re.match("^i915-GVTg_V[0-9]_[0-9]", nodedev.type_id)):
+ self.model = "vfio-pci"
+ self.managed = "yes"
+ self.display = "off"
+ self.ramfb = "off"
+
+ else:
+ raise ValueError( # pragma: no cover
+ _("Don't know how to generate nodedev for mdev type id '%s'") %
+ nodedev.type_id)
+
+ self.uuid = nodedev.name[5:].replace('_', '-')
+
else:
raise ValueError(_("Unknown node device type %s") % nodedev)
_XML_PROP_ORDER = ["mode", "type", "managed", "vendor", "product",
- "domain", "bus", "slot", "function"]
+ "domain", "bus", "slot", "function", "model",
+ "display", "ramfb"]
mode = XMLProperty("./@mode")
type = XMLProperty("./@type")
managed = XMLProperty("./@managed", is_yesno=True)
+ model = XMLProperty("./@model")
+ display = XMLProperty("./@display")
+ ramfb = XMLProperty("./@ramfb")
vendor = XMLProperty("./source/vendor/@id")
product = XMLProperty("./source/product/@id")
@@ -92,6 +123,9 @@ class DeviceHostdev(Device):
# type=misc handling
storage_block = XMLProperty("./source/block")
+ # type=mdev
+ uuid = XMLProperty("./source/address/@uuid")
+
##################
# Default config #
diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py
index 9d2c8f10..97841794 100644
--- a/virtinst/nodedev.py
+++ b/virtinst/nodedev.py
@@ -40,6 +40,7 @@ class NodeDevice(XMLBuilder):
CAPABILITY_TYPE_SCSIBUS = "scsi_host"
CAPABILITY_TYPE_SCSIDEV = "scsi"
CAPABILITY_TYPE_DRM = "drm"
+ CAPABILITY_TYPE_MDEV = "mdev"
@staticmethod
def lookupNodedevFromString(conn, idstring):
@@ -168,6 +169,9 @@ class NodeDevice(XMLBuilder):
if len(self.devnodes) > 0:
return self.devnodes[0]
+ # type='mdev' options
+ type_id = XMLProperty("./capability/type/@id")
+
def _AddressStringToHostdev(conn, addrstr):
from .devices import DeviceHostdev
--
2.31.1

View File

@ -0,0 +1,164 @@
From bacab3883858b137f82ab2b3dea308289f65138c Mon Sep 17 00:00:00 2001
From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Date: Mon, 7 Jun 2021 11:34:21 +0200
Subject: [PATCH] virt-manager: enable MDEV support
Enable virt-manager GUI to support add, edit, remove, hot-plug and
hot-unplug of mediated devices (like DASDs, APQNs and PCIs) in virtual
server.
It is not possible to edit MDEV when a virtual server is in
running state, as this is not supported by libvirt.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
(cherry picked from commit 0e15cd51dfbdaa09f7d34ed1edce2f5416130361)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1995125
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
tests/data/testdriver/testdriver.xml | 39 ++++++++++++++++++++++++++++
tests/uitests/test_addhardware.py | 6 +++++
virtManager/addhardware.py | 19 +++++++++++++-
3 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index b8d67bac..5875732a 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -3645,6 +3645,27 @@ ba</description>
</capability>
</device>
+<device>
+ <name>css_0_0_0023</name>
+ <path>/sys/devices/css0/0.0.0023</path>
+ <parent>computer</parent>
+ <driver>
+ <name>vfio_ccw</name>
+ </driver>
+ <capability type='css'>
+ <cssid>0x0</cssid>
+ <ssid>0x0</ssid>
+ <devno>0x0023</devno>
+ <capability type='mdev_types'>
+ <type id='vfio_ccw-io'>
+ <name>I/O subchannel (Non-QDIO)</name>
+ <deviceAPI>vfio-ccw</deviceAPI>
+ <availableInstances>0</availableInstances>
+ </type>
+ </capability>
+ </capability>
+</device>
+
<device>
<name>mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110</name>
<path>/sys/devices/css0/0.0.0023/8e37ee90-2b51-45e3-9b25-bf8283c03110</path>
@@ -3658,6 +3679,24 @@ ba</description>
</capability>
</device>
+<device>
+ <name>ap_matrix</name>
+ <path>/sys/devices/vfio_ap/matrix</path>
+ <parent>computer</parent>
+ <driver>
+ <name>vfio_ap</name>
+ </driver>
+ <capability type='ap_matrix'>
+ <capability type='mdev_types'>
+ <type id='vfio_ap-passthrough'>
+ <name>VFIO AP Passthrough Device</name>
+ <deviceAPI>vfio-ap</deviceAPI>
+ <availableInstances>65536</availableInstances>
+ </type>
+ </capability>
+ </capability>
+</device>
+
<device>
<name>mdev_11f92c9d_b0b0_4016_b306_a8071277f8b9</name>
<path>/sys/devices/vfio_ap/matrix/11f92c9d-b0b0-4016-b306-a8071277f8b9</path>
diff --git a/tests/uitests/test_addhardware.py b/tests/uitests/test_addhardware.py
index ce3da57c..56acc2fa 100644
--- a/tests/uitests/test_addhardware.py
+++ b/tests/uitests/test_addhardware.py
@@ -459,6 +459,12 @@ def testAddHosts(app):
app.click_alert_button("device is already in use by", "Yes")
lib.utils.check(lambda: details.active)
+ # Add MDEV device
+ _open_addhw(app, details)
+ tab = _select_hw(addhw, "MDEV Host Device", "host-tab")
+ tab.find_fuzzy("mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110",
+ "table cell").click()
+ _finish(addhw, check=details)
def testAddChars(app):
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index cbf19f58..13b899c3 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -249,6 +249,10 @@ class vmmAddHardware(vmmGObjectUI):
add_hw_option(_("PCI Host Device"), "system-run", PAGE_HOSTDEV,
nodedev_enabled, nodedev_errstr, "pci")
+ add_hw_option(_("MDEV Host Device"), "system-run", PAGE_HOSTDEV,
+ self.conn.support.conn_nodedev(),
+ _("Connection does not support host device enumeration"),
+ "mdev")
add_hw_option(_("Video"), "video-display", PAGE_VIDEO, True,
_("Libvirt version does not support video devices."))
add_hw_option(_("Watchdog"), "device_pci", PAGE_WATCHDOG,
@@ -656,6 +660,9 @@ class vmmAddHardware(vmmGObjectUI):
(dehex(hostdev.domain), dehex(hostdev.bus),
dehex(hostdev.slot), dehex(hostdev.function)))
+ elif hostdev.uuid:
+ label += " %s" % (str(hostdev.uuid))
+
return label
@@ -775,6 +782,12 @@ class vmmAddHardware(vmmGObjectUI):
if dev.xmlobj.name == subdev.xmlobj.parent:
prettyname += " (%s)" % subdev.pretty_name()
+ if devtype == "mdev":
+ for parentdev in self.conn.list_nodedevs():
+ if dev.xmlobj.parent == parentdev.xmlobj.name:
+ prettyname = "%s %s" % (
+ parentdev.pretty_name(), prettyname)
+
model.append([dev.xmlobj, prettyname])
if len(model) == 0:
@@ -981,11 +994,13 @@ class vmmAddHardware(vmmGObjectUI):
if page == PAGE_HOSTDEV:
# Need to do this here, since we share the hostdev page
- # between two different HW options
+ # between different HW options
row = self._get_hw_selection()
devtype = "usb_device"
if row and row[5] == "pci":
devtype = "pci"
+ if row and row[5] == "mdev":
+ devtype = "mdev"
self._populate_hostdev_model(devtype)
if page == PAGE_CONTROLLER:
@@ -1036,6 +1051,8 @@ class vmmAddHardware(vmmGObjectUI):
row = self._get_hw_selection()
if row and row[5] == "pci":
return _("PCI Device")
+ if row and row[5] == "mdev":
+ return _("MDEV Device")
return _("USB Device")
raise RuntimeError("Unknown page %s" % page) # pragma: no cover
--
2.31.1

View File

@ -0,0 +1,194 @@
From da2cbdd5b6ff2b3f07eaf14044a59d4aee7db2a7 Mon Sep 17 00:00:00 2001
Message-ID: <da2cbdd5b6ff2b3f07eaf14044a59d4aee7db2a7.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 18 Sep 2024 12:02:59 -0400
Subject: [PATCH] virt-xml: Add `--edit --convert-to-vnc`
From: Cole Robinson <crobinso@redhat.com>
This wires up the guest.convert_to_vnc function to command line,
and documents it.
There's one suboption `qemu-vdagent=on|off`, defaulting to `off`
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 51c3f1c68736fecd133791e5f057abf43287d447)
Conflicts:
tests/test_cli.py
virtinst/virtxml.py
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
man/virt-xml.rst | 22 ++++++++++++++++
.../virt-xml-convert-to-vnc-vdagent.xml | 15 +++++++++++
.../cli/compare/virt-xml-convert-to-vnc.xml | 12 +++++++++
tests/test_cli.py | 6 +++++
virtinst/cli.py | 26 +++++++++++++++++++
virtinst/virtxml.py | 7 +++++
6 files changed, 88 insertions(+)
create mode 100644 tests/data/cli/compare/virt-xml-convert-to-vnc-vdagent.xml
create mode 100644 tests/data/cli/compare/virt-xml-convert-to-vnc.xml
diff --git a/man/virt-xml.rst b/man/virt-xml.rst
index 75c8be860..298246ca5 100644
--- a/man/virt-xml.rst
+++ b/man/virt-xml.rst
@@ -197,6 +197,28 @@ GUEST OS OPTIONS
See virt-install(1) documentation for more details about ``--os-variant``
+``--convert-to-vnc``
+^^^^^^^^^^^^^^^^^^^^
+
+**Syntax:** ``--convert-to-vnc`` [OPTIONS]
+
+Convert an existing VM to exclusively use a single VNC graphics device.
+
+It will attempt to remove all references to any non-VNC graphics config, like
+Spice. For example:
+
+* ``qxl`` devices will be replaced
+* all ``spicevmc`` and ``spiceport`` devices will be removed
+* spice GL will be converted to ``egl-headless``
+
+Sub options are:
+
+``qemu-vdagent=on|off``
+ Add a ``qemu-vdagent`` device if one is not already configured.
+ This replaces some functionality of the spice vdagent.
+ This defaults to ``off`` but that could change in the future.
+
+
XML OPTIONS
===========
diff --git a/tests/data/cli/compare/virt-xml-convert-to-vnc-vdagent.xml b/tests/data/cli/compare/virt-xml-convert-to-vnc-vdagent.xml
new file mode 100644
index 000000000..45764e132
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-convert-to-vnc-vdagent.xml
@@ -0,0 +1,15 @@
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
++ <channel type="qemu-vdagent">
++ <target type="virtio" name="com.redhat.spice.0"/>
++ </channel>
++ <graphics type="vnc" port="-1"/>
++ <video>
++ <model type="vga"/>
++ </video>
+ </devices>
+ </domain>
+
+Domain 'test' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/data/cli/compare/virt-xml-convert-to-vnc.xml b/tests/data/cli/compare/virt-xml-convert-to-vnc.xml
new file mode 100644
index 000000000..a13ee9b51
--- /dev/null
+++ b/tests/data/cli/compare/virt-xml-convert-to-vnc.xml
@@ -0,0 +1,12 @@
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
++ <graphics type="vnc" port="-1"/>
++ <video>
++ <model type="vga"/>
++ </video>
+ </devices>
+ </domain>
+
+Domain 'test' defined successfully.
+Changes will take effect after the domain is fully powered off.
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 04386f63b..b7241b2a0 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1222,6 +1222,12 @@ c.add_compare("--print-diff --remove-device --serial 1", "remove-console-dup", i
c.add_compare("--connect %(URI-KVM)s test-hyperv-uefi --edit --boot uefi", "hyperv-uefi-collision")
c.add_compare("--connect %(URI-KVM)s test-many-devices --edit --cpu host-copy", "edit-cpu-host-copy")
+# --convert-* tests
+c.add_compare("--connect %(URI-KVM-X86)s --print-diff --define --edit --convert-to-q35", "convert-to-q35", input_file=(_VIRTXMLDIR + "convert-to-q35-win10-in.xml"))
+c.add_compare("--connect %(URI-KVM-X86)s --print-diff --define --edit --convert-to-q35 num_pcie_root_ports=7", "convert-to-q35-numports", input_file=(_VIRTXMLDIR + "convert-to-q35-win10-in.xml"))
+c.add_compare("--connect %(URI-KVM-X86)s test --print-diff --define --edit --convert-to-vnc", "convert-to-vnc")
+c.add_compare("--connect %(URI-KVM-X86)s test --print-diff --define --edit --convert-to-vnc qemu-vdagent=on", "convert-to-vnc-vdagent")
+
c = vixml.add_category("simple edit diff", "test-for-virtxml --edit --print-diff --define")
c.add_compare("""--xml ./@foo=bar --xml xpath.delete=./currentMemory --xml ./new/element/test=1""", "edit-xpaths")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 390c54cd2..5f7bd20c6 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1303,6 +1303,8 @@ class VirtCLIParser(metaclass=_InitClass):
@cli_arg_name: The command line argument this maps to, so
"hostdev" for --hostdev
"""
+ OPTSTR_EMPTY = 1
+
guest_propname = None
remove_first = None
stub_none = True
@@ -1390,6 +1392,8 @@ class VirtCLIParser(metaclass=_InitClass):
self.optstr = optstr
self.guest = guest
self.editing = editing
+ if self.optstr == self.OPTSTR_EMPTY:
+ self.optstr = ""
self.optdict = _parse_optstr_to_dict(self.optstr,
self._virtargs, xmlutil.listify(self.remove_first)[:])
@@ -1627,6 +1631,28 @@ def parse_xmlcli(guest, options):
guest.add_xml_manual_action(manualaction)
+############################
+# --convert-to-vnc parsing #
+############################
+
+class ParserConvertToVNC(VirtCLIParser):
+ cli_arg_name = "convert_to_vnc"
+ supports_clearxml = False
+
+ @classmethod
+ def _virtcli_class_init(cls):
+ VirtCLIParser._virtcli_class_init_common(cls)
+ cls.add_arg("qemu-vdagent", "qemu_vdagent")
+
+ def parse(self, inst):
+ class ConvertToVNCData:
+ qemu_vdagent = None
+
+ inst = ConvertToVNCData()
+ super().parse(inst)
+ self.guest.convert_to_vnc(**inst.__dict__)
+
+
########################
# --unattended parsing #
########################
diff --git a/virtinst/virtxml.py b/virtinst/virtxml.py
index 640f70a87..46fdf1fe0 100644
--- a/virtinst/virtxml.py
+++ b/virtinst/virtxml.py
@@ -396,6 +396,13 @@ def parse_args():
cli.add_os_variant_option(parser, virtinstall=False)
+ conv = parser.add_argument_group(_("Conversion options"))
+ cli.ParserConvertToVNC.register()
+ conv.add_argument("--convert-to-vnc", nargs="?",
+ const=cli.VirtCLIParser.OPTSTR_EMPTY,
+ help=_("Convert an existing VM to use VNC graphics. "
+ "This removes any remnants of Spice graphics."))
+
g = parser.add_argument_group(_("XML options"))
cli.add_disk_option(g, editexample=True)
cli.add_net_option(g)
--
2.48.1

View File

@ -0,0 +1,77 @@
From 1822e898d556eb5bb80e5c01386b5ad65db01592 Mon Sep 17 00:00:00 2001
From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Date: Mon, 31 May 2021 21:54:26 +0200
Subject: [PATCH] virt-xml: add support for mediated devices
Provide support to add/remove MDEV in a guest domain, which is in
shut-off or running state (hotplug/unplug). Also support update of
already existing MDEV device, when the guest domain is in shut-off
state. Please note that libvirt does not support update of MDEV
device, when the guest domain is in running state.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
(cherry picked from commit 9363e1e692bb0d01184ecc7991d61c95542f690b)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1995125
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
virtinst/nodedev.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py
index 97841794..f54a311c 100644
--- a/virtinst/nodedev.py
+++ b/virtinst/nodedev.py
@@ -5,6 +5,7 @@
# See the COPYING file in the top-level directory.
import os
+import uuid
from .logger import log
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
@@ -25,6 +26,16 @@ def _compare_int(nodedev_val, hostdev_val):
return (nodedev_val == hostdev_val or hostdev_val == -1)
+def _compare_uuid(nodedev_val, hostdev_val):
+ try:
+ nodedev_val = uuid.UUID(nodedev_val)
+ hostdev_val = uuid.UUID(hostdev_val)
+ except Exception: # pragma: no cover
+ return -1
+
+ return (nodedev_val == hostdev_val)
+
+
class DevNode(XMLBuilder):
XML_NAME = "devnode"
@@ -82,6 +93,9 @@ class NodeDevice(XMLBuilder):
parent = XMLProperty("./parent")
device_type = XMLProperty("./capability/@type")
+ def get_mdev_uuid(self):
+ return self.name[5:].replace('_', '-')
+
def compare_to_hostdev(self, hostdev):
if self.device_type == "pci":
if hostdev.type != "pci":
@@ -101,6 +115,12 @@ class NodeDevice(XMLBuilder):
_compare_int(self.bus, hostdev.bus) and
_compare_int(self.device, hostdev.device))
+ if self.device_type == "mdev":
+ if hostdev.type != "mdev":
+ return False
+
+ return _compare_uuid(self.get_mdev_uuid(), hostdev.uuid)
+
return False
--
2.31.1

View File

@ -0,0 +1,30 @@
From 4c4c84de0505ede1fb10b517fa359b8307300d43 Mon Sep 17 00:00:00 2001
Message-ID: <4c4c84de0505ede1fb10b517fa359b8307300d43.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 12 Feb 2024 10:40:19 +0100
Subject: [PATCH] virtinst: fix compare for audio devices
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 2a0aa2d56bfdaf3612bf5182659486fc4dffbb7b)
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/devices/device.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/virtinst/devices/device.py b/virtinst/devices/device.py
index 132107efb..e46437144 100644
--- a/virtinst/devices/device.py
+++ b/virtinst/devices/device.py
@@ -131,6 +131,7 @@ class Device(XMLBuilder):
"interface": ["macaddr", "xmlindex"],
"input": ["bus", "type", "xmlindex"],
"sound": ["model", "xmlindex"],
+ "audio": ["type", "id"],
"video": ["model", "xmlindex"],
"watchdog": ["model", "xmlindex"],
"hostdev": ["type", "managed", "xmlindex",
--
2.48.1

View File

@ -0,0 +1,98 @@
From e3734f6e9120ed62238bcffb6bd0679b64b42c70 Mon Sep 17 00:00:00 2001
Message-ID: <e3734f6e9120ed62238bcffb6bd0679b64b42c70.1737975657.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 25 Mar 2024 14:39:20 +0100
Subject: [PATCH] virtinst: remove spice devices when removing last spice
graphics
When Spice graphics is used QEMU creates a Spice server and communicates
with Spice client using multiple channels. These channels are used by
the spice devices as well. Without the Spice graphics defined there is
no use for the other devices. In addition libvirt will report error for
such configuration.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit aaf85519142d672e7486020d9847358f36df4f70)
https://issues.redhat.com/browse/RHEL-17435
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
.../virt-xml-remove-spice-graphics.xml | 18 ++++++++++----
virtinst/guest.py | 24 +++++++++++++++++++
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml b/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml
index ed9f2a584..3d27d4121 100644
--- a/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml
+++ b/tests/data/cli/compare/virt-xml-remove-spice-graphics.xml
@@ -1,14 +1,24 @@
- <channel type="spicevmc">
- <target type="virtio" name="com.redhat.spice.0"/>
- </channel>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type="usb" index="0" model="qemu-xhci" ports="15"/>
+ <controller type="virtio-serial" index="0"/>
+- <channel type="spicevmc">
+- <target type="virtio" name="com.redhat.spice.0"/>
+- </channel>
- <graphics type="spice" autoport="yes">
- <listen type="address"/>
- <image compression="off"/>
- <gl enable="no"/>
- </graphics>
- <audio id="1" type="spice"/>
+- <audio id="1" type="spice"/>
<video>
<model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
+ </video>
+- <redirdev bus="usb" type="spicevmc">
+- </redirdev>
+- <redirdev bus="usb" type="spicevmc">
+- </redirdev>
+ </devices>
+ </domain>
Domain 'test-spice' defined successfully.
Changes will take effect after the domain is fully powered off.
diff --git a/virtinst/guest.py b/virtinst/guest.py
index fc7b0080a..7aa62be49 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -483,6 +483,7 @@ class Guest(XMLBuilder):
def remove_device(self, dev):
self.devices.remove_child(dev)
self._remove_duplicate_console(dev)
+ self._remove_spice_devices(dev)
devices = XMLChildProperty(_DomainDevices, is_single=True)
@@ -1044,3 +1045,26 @@ class Guest(XMLBuilder):
if condup:
log.debug("Found duplicate console device:\n%s", condup.get_xml())
self.devices.remove_child(condup)
+
+ def _remove_spice_audio(self):
+ for audio in self.devices.audio:
+ if audio.type == "spice":
+ self.devices.remove_child(audio)
+
+ def _remove_spice_channels(self):
+ for channel in self.devices.channel:
+ if channel.type == DeviceChannel.TYPE_SPICEVMC:
+ self.devices.remove_child(channel)
+
+ def _remove_spice_usbredir(self):
+ for redirdev in self.devices.redirdev:
+ if redirdev.type == "spicevmc":
+ self.devices.remove_child(redirdev)
+
+ def _remove_spice_devices(self, rmdev):
+ if rmdev.DEVICE_TYPE != "graphics" or self.has_spice():
+ return
+
+ self._remove_spice_audio()
+ self._remove_spice_channels()
+ self._remove_spice_usbredir()
--
2.48.1

View File

@ -0,0 +1,99 @@
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

View File

@ -7,29 +7,47 @@
# End local config
Name: virt-manager
Version: 5.0.0
Release: 1%{?dist}%{?extra_release}
Version: 3.2.0
Release: 4.1%{?dist}%{?extra_release}
%global verrel %{version}-%{release}
Summary: Desktop tool for managing virtual machines via libvirt
License: GPL-2.0-or-later
License: GPLv2+
BuildArch: noarch
URL: https://virt-manager.org/
Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.xz
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
Source1: symlinks
Patch1: virt-manager-Downstream-changes-to-RPM-spec-file.patch
Patch2: virt-manager-spec-update-link-to-virt-manager-sources.patch
Patch1: virt-manager-cli-introduce-resource-fibrechannel.appid-option.patch
Patch2: virt-manager-virt-install-add-mediated-device.patch
Patch3: virt-manager-virt-xml-add-support-for-mediated-devices.patch
Patch4: virt-manager-hostdev-use-method-get_mdev_uuid.patch
Patch5: virt-manager-tests-verify-MDEV-support.patch
Patch6: virt-manager-virt-manager-enable-MDEV-support.patch
Patch7: virt-manager-Handle-new-nodedev-name-for-mediated-devices.patch
Patch8: virt-manager-addstorage-Don-t-pass-None-to-widget.set_active.patch
Patch9: virt-manager-cli-add-ioapic.driver-to-features.patch
Patch10: virt-manager-console-fix-error-with-old-pygobject.patch
Patch11: virt-manager-cli-Add-basic-audio-type-XXX-id-Y-support.patch
Patch12: virt-manager-virtinst-unify-detection-of-duplicate-console-when-removing-device.patch
Patch13: virt-manager-virtinst-fix-compare-for-audio-devices.patch
Patch14: virt-manager-testsuite-add-test-spice-vm-definition.patch
Patch15: virt-manager-virtinst-remove-spice-devices-when-removing-last-spice-graphics.patch
Patch16: virt-manager-guest-add-convert_to_vnc.patch
Patch17: virt-manager-guest-remove-spiceport-devices-when-spice-is-removed.patch
Patch18: virt-manager-guest-convert_to_vnc-convert-video-device.patch
Patch19: virt-manager-virt-xml-Add-edit-convert-to-vnc.patch
Requires: virt-manager-common = %{verrel}
Requires: python3-gobject >= 3.31.3
Requires: gtk3 >= 3.22.0
Requires: python3-gobject
Requires: gtk3
Requires: libvirt-glib >= 0.0.9
Requires: gtk-vnc2
%if 0%{?fedora}
Requires: spice-gtk3
%endif
# We can work with gtksourceview 3 or gtksourceview4, rhel has only the older one
Requires: gtksourceview3
# virt-manager is one of those apps that people will often install onto
# a headless machine for use over SSH. This means the virt-manager dep
@ -45,10 +63,6 @@ Requires: dconf
# no ambiguity.
Requires: vte291
# We can use GtkTextView, gtksourceview 3 or gtksourceview4, recommend
# the latest one but don't make it a hard requirement
Recommends: gtksourceview4
# Weak dependencies for the common virt-manager usecase
Recommends: (libvirt-daemon-kvm or libvirt-daemon-qemu)
Recommends: libvirt-daemon-config-network
@ -60,7 +74,6 @@ BuildRequires: git
BuildRequires: gettext
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: meson
%description
@ -81,8 +94,8 @@ Requires: python3-requests
Requires: libosinfo >= 0.2.10
# Required for gobject-introspection infrastructure
Requires: python3-gobject-base
# Required for pulling files from iso media
Requires: xorriso
# Required for pulling files from iso media with isoinfo
Requires: genisoimage
%description common
Common files used by the different virt-manager interfaces, as well as
@ -122,35 +135,41 @@ git add .
git commit -q -a --allow-empty --author 'rpm-build <rpm-build>' -m symlinks
git config gc.auto 0
%autopatch
%build
%if 0%{?rhel}
%global _default_graphics -Ddefault-graphics=vnc
%if %{default_hvs}
%global _default_hvs --default-hvs %{default_hvs}
%endif
%meson \
-Ddefault-hvs=%{default_hvs} \
%{?_default_graphics} \
-Dupdate-icon-cache=false \
-Dcompile-schemas=false \
-Dtests=disabled
%meson_build
./setup.py configure \
%{?_default_hvs}
%install
%meson_install
./setup.py \
--no-update-icon-cache --no-compile-schemas \
install -O1 --root=%{buildroot}
%find_lang %{name}
%if 0%{?py_byte_compile:1}
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#manual-bytecompilation
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/virt-manager/
%py_byte_compile %{python3} %{buildroot}%{_datadir}/virt-manager/
%endif
# Replace '#!/usr/bin/env python3' with '#!/usr/bin/python3'
# The format is ideal for upstream, but not a distro. See:
# https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
for f in $(find %{buildroot} -type f -executable -print); do
sed -i "1 s|^#!/usr/bin/env python3|#!%{__python3}|" $f || :
done
%files
%doc README.md COPYING NEWS.md
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
@ -167,10 +186,8 @@ git commit -q -a --allow-empty --author 'rpm-build <rpm-build>' -m symlinks
%files common -f %{name}.lang
%license COPYING
%doc README.md NEWS.md
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/virtinst
@ -189,180 +206,97 @@ git commit -q -a --allow-empty --author 'rpm-build <rpm-build>' -m symlinks
%changelog
* Mon Dec 2 2024 Pavel Hrdina <phrdina@redhat.com> - 5.0.0-1
- Rebased to virt-manager-5.0.0 (RHEL-46783)
* Mon Jan 27 2025 Pavel Hrdina <phrdina@redhat.com> - 3.2.0-4.1.el8_10
- 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)
* Thu Mar 10 2022 Jonathon Jongsma <jjongsma@redhat.com> - 3.2.0-4
- console: fix error with old pygobject (rhbz#2026987)
* Fri Jan 21 2022 Jonathon Jongsma <jjongsma@redhat.com> - 3.2.0-3
- cli: add 'ioapic.driver' to --features (rhbz#2037202)
* Thu Dec 9 2021 Jonathon Jongsma <jjongsma@redhat.com> - 3.2.0-2
- addstorage: Don't pass None to widget.set_active() (rhbz#2026987)
* Fri Nov 19 2021 Jonathon Jongsma <jjongsma@redhat.com> - 3.2.0-1
- Rebased to virt-manager-3.2.0 (rhbz#2009080)
- The rebase also fixes the following bugs:
RHEL-50653, RHEL-65105, RHEL-62960, RHEL-46282, RHEL-65371
RHEL-65189, RHEL-66768
rhbz#2001794
- cli: introduce --resource fibrechannel.appid option (rhbz#2011327)
- virt-install: add mediated device (rhbz#1995125)
- virt-xml: add support for mediated devices (rhbz#1995125)
- hostdev: use method get_mdev_uuid() (rhbz#1995125)
- tests: verify MDEV support (rhbz#1995125)
- virt-manager: enable MDEV support (rhbz#1995125)
- Handle new nodedev name for mediated devices (rhbz#2020241)
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 4.1.0-8
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Nov 23 2020 Pavel Hrdina <phrdina@redhat.com> - 2.2.1-4
- virt-install: Use minutes instead of seconds on get_time_string() (rhbz#1777664)
- details: Fix showing the firmware type in case of firmware auto selection (rhbz#1857069)
- details: fix detection of firmware auto-selection (rhbz#1857069)
- domain: Fix VM deletion with firmare='efi' (rhbz#1869135)
- virt-xml: fix defined_xml_is_unchanged (rhbz#1857504)
* Tue Jun 25 2024 Jonathon Jongsma <jjongsma@redhat.com> - 4.1.0-7
- cloner: Sync <uuid> and <sysinfo> system uuid (RHEL-34608)
- virtinstall: fix regression with --boot and no install method (RHEL-34608)
- progress: Fix showing correct final total (RHEL-34608)
- virtinstall: Fix the allocating disk size printed by the progress bar (RHEL-34608)
- virtinstall: Hide total_size in the progress bar if it doesn't need (RHEL-34608)
- virt-install: Recommend '--boot uefi' (RHEL-34608)
- virt-install: Document Secure Boot setups (RHEL-34608)
- tests: Add more cloud-init and TPM test cases (RHEL-34608)
- installer: drop default TPM for --cloud-init install phase (RHEL-34608)
- Add gating for centos stream 10 (RHEL-34608)
- xmleditor: make gtksourceview optional (RHEL-35859)
* Mon Dec 2 2019 Pavel Hrdina <phrdina@redhat.com> - 2.2.1-3
- guest: Drop set_capabilities_defaults call from get_uefi_path (rhbz#1753644)
- devices: video: Simplify model hvm check (rhbz#1753644)
- domcapabilities: Get video devices (rhbz#1753644)
- domcapabilities: Add supports_video_bochs() (rhbz#1753644)
- video: Prefer "bochs" when it's supported. (rhbz#1753644)
- addhardware: Add "bochs" display to the video list (rhbz#1753644)
- osdict: Always return the most generic tree (rhbz#1749865)
- osdict: Choose the most appropriate tree when a profile is set (rhbz#1749865)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 4.1.0-6
- Bump release for June 2024 mass rebuild
* Fri Aug 16 2019 Pavel Hrdina <phrdina@redhat.com> - 2.2.1-2
- man: virt-install: Fix a couple of launchSecurity related typos (rhbz#1741846)
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 11 2019 Pavel Hrdina <phrdina@redhat.com> - 2.2.1-1
- Rebased to virt-manager-2.2.1 (rhbz#1726535)
- The rebase also fixes the following bugs:
rhbz#1727881, rhbz#1724287, rhbz#1727811
- spec: add gtksourceview3 dependency introduced by upstream (rhbz#1722820)
- guest: fix warning message when machine type is changed for secure boot (rhbz#1727811)
* Fri Sep 29 2023 Sandro Bonazzola <sbonazzo@redhat.com> - 4.1.0-4
- Drop spice-gtk3 on Fedora ELN as in CentOS Stream 9
- Resolves: fedora#2237969
* Mon Jun 24 2019 Pavel Hrdina <phrdina@redhat.com> - 2.2.0-2
- xmleditor: Handle gtksourceview3 as well as gtksourceview4 (rhbz#1722820)
- xmleditor: Fix the gtksource version checking (rhbz#1722820)
- spec: add gtksourceview3 dependency introduced by upstream (rhbz#1722820)
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Mon Jun 17 2019 Pavel Hrdina <phrdina@redhat.com> - 2.2.0-1
- Rebased to virt-manager-2.2.0 (rhbz#1721001)
- The rebase also fixes the following bugs:
rhbz#1718065, rhbz#1714304, rhbz#1709857, rhbz#1707379, rhbz#1700354
rhbz#1692489, rhbz#1690687, rhbz#1690685, rhbz#1683609, rhbz#1679018
rhbz#1677019, rhbz#1671599, rhbz#1667025, rhbz#1666597, rhbz#1663430
rhbz#1661867, rhbz#1660467, rhbz#1660123, rhbz#1659354, rhbz#1658511
rhbz#1648939, rhbz#1599139, rhbz#1508147, rhbz#1501608
- spec: add build dependencies that are now required for build (rhbz#1721001)
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Feb 8 2019 Pavel Hrdina <phrdina@redhat.com> - 2.0.0-4
- inspection: fix check of null icon (rhbz#1671278)
* Thu Aug 04 2022 Cole Robinson <crobinso@redhat.com> - 4.1.0-1
- Update to version 4.1.0
* Fri Feb 1 2019 Pavel Hrdina <phrdina@redhat.com> - 2.0.0-3
- diskbackend: Fix backtrace cloning with block storage (bz #1661986) (rhbz#1661986)
* Wed Aug 3 2022 Daniel. P. Berrange <berrange@redhat.com> - 4.0.0-3
- Fix compat with setuptools >= 61 (rhbz#2113754)
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Mar 02 2022 Cole Robinson <crobinso@redhat.com> - 4.0.0-1
- Update to version 4.0.0
* Sun Feb 20 2022 Cole Robinson <crobinso@redhat.com> - 3.2.0-6
- Update to latest git snapshot
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jan 11 2021 Cole Robinson <crobinso@redhat.com> - 3.2.0-2
- Fix 'domain not found' race (bz #1901081)
* Sat Nov 14 2020 Cole Robinson <crobinso@redhat.com> - 3.2.0-1
- Update to version 3.2.0
- Slim down filesystem device editor UI
- Fix TOCTTOU virt-install bugs (Martin Pitt)
- Several other bug fixes
* Wed Sep 30 2020 Cole Robinson <crobinso@redhat.com> - 3.1.0-1
- Update to version 3.1.0
* Tue Sep 15 2020 Cole Robinson <crobinso@redhat.com> - 3.0.0-1
- Update to version 3.0.0
* Mon Aug 31 2020 Cole Robinson <aintdiscole@gmail.com> - 2.2.1-6
- spec: Switch to latest Fedora bytecompile macros
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-5
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jul 03 2019 Cole Robinson <crobinso@redhat.com> - 2.2.1-1
- Rebased to version 2.2.1
- CVE-2019-10183: Replace --unattended user-password and admin-password with
user-password-file and admin-password-file (Fabiano Fidêncio)
- Consistent --memballoon default across non-x86 (Andrea Bolognani)
- virt-install: add --numatune memnode.* (Athina Plaskasoviti)
- Drop hard dep on gtksourceview4, gtksourceview3 is fine as well
* Tue Jun 18 2019 Cole Robinson <crobinso@redhat.com> - 2.2.0-2
- Add missing dep on gtksourceview
* Mon Jun 17 2019 Cole Robinson <crobinso@redhat.com> - 2.2.0-1
- Rebased to version 2.2.0
- libvirt XML viewing and editing UI for new and existing domain, pools,
volumes, networks
- virt-install: libosinfo --unattended support (Fabiano Fidêncio, Cole
Robinson)
- Improve CPU model security defaults (Pavel Hrdina)
- virt-install: new --install option. Ex: virt-install --install fedora29
- virt-install: new --install kernel=,initrd=
- virt-install: --disk, --memory, --name defaults from libosinfo (Fabiano
Fidêncio, Cole Robinson)
- virt-install: add device suboption aliases which consistently match
libvirt XML naming
- virt-xml: new --start, --no-define options (Marc Hartmayer)
- virt-install: Add driver_queues argument to --controller (Vasudeva Kamath)
- RISC-V support (Andrea Bolognani)
- Device default improvements for non-x86 KVM (Andrea Bolognani)
- Redesigned 'New Network' wizard
- libguestfs inspection improvements (Pino Toscano)
- virt-install: Add support for xenbus controller (Jim Fehlig)
- cli: Add --disk wwn=,rawio= (Athina Plaskasoviti)
- cli: Add --memballoon autodeflate=,stats.period= (Athina Plaskasoviti)
- cli: Add --iothreads (Athina Plaskasoviti)
- cli: Add --numatune memory.placement (Athina Plaskasoviti)
- cli: Add --launchSecurity option (Erik Skultety)
- cli: Fill in --memorybacking options
- cli: --smartcard: support database= and certificate[0-9]*=
- cli: --sysinfo: Add chasis suboptions
- cli: --metadata: add genid= and genid_enable=
- cli: --vcpus: add vcpus.vcpu[0-9]* config
- cli: fill in all common char source options for --serial, --parellel,
--console, --channel, --smartcard, --rng, --redirdev
* Wed Apr 03 2019 Cole Robinson <crobinso@redhat.com> - 2.1.0-2
- Fix --initrd-inject with f30 URLs (bz #1686464)
* Sun Feb 03 2019 Cole Robinson <crobinso@redhat.com> - 2.1.0-1
- Rebased to version 2.1.0
- Bash autocompletion support (Lin Ma, Cole Robinson)
- UI and command line --vsock support (Slavomir Kaslev)
- virt-xml: Add --os-variant option (Andrea Bolognani)
- virt-install: use libosinfo cpu, mem, disk size defaults (Fabiano
Fidencio)
- virt-install: Better usage of libosinfo -unknown distro IDs (Fabiano
Fidencio)
- virt-install: More usage of libosinfo for ISO --location detection
- virt-install: Add --location LOCATION,kernel=X,initrd=Y for pointing to
kernel/initrd in media that virt-install/libosinfo fails to detect
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Dec 21 2018 Pavel Hrdina <phrdina@redhat.com> - 2.0.0-2
- virt-install: Fix description for --os-variant (rhbz#1649406)
- virt-install: Add "Guest OS" options group (rhbz#1649406)
- virt-xml: Accept --os-variant option (rhbz#1649406)
- tests: Add some tests for virt-xml with KVM (rhbz#1649406)
- virt-xml: Start using --os-variant (rhbz#1649406)
- cli: s390x+graphics specified, use video=virtio (bz #1654994) (rhbz#1654994)
* Mon Oct 15 2018 Cole Robinson <crobinso@redhat.com> - 2.0.0-1
- Rebased to version 2.0.0
- Finish port to Python 3
- Improved VM defaults: q35 PCIe, usb3, CPU host-model
- Search based OS selection UI for new VMs
- Track OS name for lifetime of domain in <metadata> XML
- Host interface management UI has been completely removed
- Show domain IP on interface details page
* Fri Sep 07 2018 Cole Robinson <crobinso@redhat.com> - 1.6.0-1.3.3.git3bc7ff24c
- Enable arm32+uefi (bz #1613996)
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.0-0.3.git3bc7ff24c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.6.0-0.2.git3bc7ff24c
- Rebuilt for Python 3.7
- Use q35 default for appropriate OS (bz #1599777)
* Thu Apr 26 2018 Cole Robinson <crobinso@redhat.com> - 1.6.0-0.1.git3bc7ff24c
- Update to latest git snapshot, contains python3 port
@ -1174,7 +1108,7 @@ git commit -q -a --allow-empty --author 'rpm-build <rpm-build>' -m symlinks
- Disable wizard sensitivity while creating VM
* Thu Oct 19 2006 Daniel P. Berrange <berrange@redhat.com> - 0.2.5-1.fc7
- Switch to use python-virtinst instead of python-xeninst due to
- Switch to use python-virtinst instead of python-xeninst due to
renaming of original package
- Disable keyboard accelerators when grabbing mouse to avoid things like
Ctrl-W closing the local window, instead of remote window bz 210364

View File

@ -1,6 +0,0 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: libvirt-ci.virt-install.brew-build.gating.x86_64.tier1.functional}

View File

@ -1 +0,0 @@
SHA512 (virt-manager-5.0.0.tar.xz) = d0cb7eb844fc98ad29413717e5fa5834bc6f9f6cb6b9339b59c2721bb37a58f71280e3d2a04a64a6021614626329d76c92474f826bb1d9b7a9040b479f20d4e8

View File

@ -1,41 +0,0 @@
From 35127dbaac817e9d78aaa6a97021eb9b18d63b12 Mon Sep 17 00:00:00 2001
Message-ID: <35127dbaac817e9d78aaa6a97021eb9b18d63b12.1733152262.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 29 Nov 2024 20:48:04 +0100
Subject: [PATCH] Downstream changes to RPM spec file
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virt-manager.spec.in | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/virt-manager.spec.in b/virt-manager.spec.in
index c22ed32b5..353491111 100644
--- a/virt-manager.spec.in
+++ b/virt-manager.spec.in
@@ -23,7 +23,9 @@ Requires: python3-gobject >= 3.31.3
Requires: gtk3 >= 3.22.0
Requires: libvirt-glib >= 0.0.9
Requires: gtk-vnc2
+%if 0%{?fedora}
Requires: spice-gtk3
+%endif
# virt-manager is one of those apps that people will often install onto
# a headless machine for use over SSH. This means the virt-manager dep
@@ -104,8 +106,13 @@ machine).
%build
+%if 0%{?rhel}
+%global _default_graphics -Ddefault-graphics=vnc
+%endif
+
%meson \
-Ddefault-hvs=%{default_hvs} \
+ %{?_default_graphics} \
-Dupdate-icon-cache=false \
-Dcompile-schemas=false \
-Dtests=disabled
--
2.47.0

View File

@ -1,28 +0,0 @@
From d399e1504f45aa02eb70347a038c1410890db9c4 Mon Sep 17 00:00:00 2001
Message-ID: <d399e1504f45aa02eb70347a038c1410890db9c4.1733152262.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 29 Nov 2024 20:59:27 +0100
Subject: [PATCH] spec: update link to virt-manager sources
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit b74730ebb6556dcbcc3b4e4993c79304c309cab4)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virt-manager.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt-manager.spec.in b/virt-manager.spec.in
index 353491111..0ffdf577c 100644
--- a/virt-manager.spec.in
+++ b/virt-manager.spec.in
@@ -15,7 +15,7 @@ Summary: Desktop tool for managing virtual machines via libvirt
License: GPL-2.0-or-later
BuildArch: noarch
URL: https://virt-manager.org/
-Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.xz
+Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.xz
Requires: virt-manager-common = %{verrel}
--
2.47.0