import virt-manager-3.2.0-4.el8

This commit is contained in:
CentOS Sources 2022-05-10 03:04:42 -04:00 committed by Stepan Oksanichenko
parent 51c17ca244
commit bb92865522
29 changed files with 1185 additions and 822 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/virt-manager-2.2.1.tar.gz SOURCES/virt-manager-3.2.0.tar.gz

View File

@ -1 +1 @@
9360a95515b8e2245f1bbed5769824cafdb15baa SOURCES/virt-manager-2.2.1.tar.gz f620494a41f898422581846ccf38b0e4540ea54e SOURCES/virt-manager-3.2.0.tar.gz

View File

@ -1 +1,5 @@
data/hicolor icons data/hicolor icons
tests/testdriver.xml data/testdriver/testdriver.xml
tests/data/urldetect/debian/buster/main/installer-arm64 installer-amd64/
tests/data/urldetect/debian/buster/main/installer-ppc64el installer-amd64/
tests/data/urldetect/debian/buster/main/installer-s390x installer-amd64/

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

@ -1,39 +0,0 @@
From 6903bfe50e46cab6cb3e7720511a364f89e9cba8 Mon Sep 17 00:00:00 2001
Message-Id: <6903bfe50e46cab6cb3e7720511a364f89e9cba8@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 2 Oct 2019 10:45:28 +0200
Subject: [PATCH] addhardware: Add "bochs" display to the video list
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit d9736db9d983d01c03929de226365dbf56a791a3)
https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/addhardware.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 842eada1..881f0e02 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -663,7 +663,7 @@ class vmmAddHardware(vmmGObjectUI):
if guest.conn.is_xen():
return ["xen", "vga"]
if guest.conn.is_qemu() or guest.conn.is_test():
- return ["vga", "qxl", "virtio"]
+ return ["vga", "bochs", "qxl", "virtio"]
return []
@staticmethod
--
2.23.0

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,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

@ -1,49 +0,0 @@
From d3d7b75a5926059733871a90c106be8190e166a9 Mon Sep 17 00:00:00 2001
Message-Id: <d3d7b75a5926059733871a90c106be8190e166a9@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 15 Jan 2020 10:34:12 +0800
Subject: [PATCH] details: Fix showing the firmware type in case of firmware
auto selection
From: Lin Ma <lma@suse.com>
For a shutoff VM, If user select uefi firmware auto selection, e.g.
<os firmware='efi'>
...
</os>
Its firmware information is set to 'BIOS' in details, This is incorrect.
This fixes it.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Lin Ma <lma@suse.com>
(cherry picked from commit 15a9502b7b7a263c4d66ff2b3f31c209f58fe0b4)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1857069
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/details/details.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index 51d170e9..7b0a501f 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -2017,8 +2017,11 @@ class vmmDetails(vmmGObjectUI):
# Firmware
domcaps = self.vm.get_domain_capabilities()
- firmware = domcaps.label_for_firmware_path(
- self.vm.get_xmlobj().os.loader)
+ if self.vm.get_xmlobj().is_uefi():
+ firmware = 'UEFI'
+ else:
+ firmware = domcaps.label_for_firmware_path(
+ self.vm.get_xmlobj().os.loader)
if self.widget("overview-firmware").is_visible():
uiutil.set_list_selection(
self.widget("overview-firmware"), firmware)
--
2.26.2

View File

@ -1,39 +0,0 @@
From 082ac77cee8141494f1185a0debf958694639e4f Mon Sep 17 00:00:00 2001
Message-Id: <082ac77cee8141494f1185a0debf958694639e4f@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 21 Jul 2020 12:33:56 +0200
Subject: [PATCH] details: fix detection of firmware auto-selection
Commit <15a9502b7b7a263c4d66ff2b3f31c209f58fe0b4> fixed firmware
detection but incorrectly. It will always show only "UEFI" even if
the firmware auto-selection is not used because the function is_uefi()
checks both the old style and the new auto-selection.
We have to check only for the auto-selection option.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit e8bf16b983558010cc9645e09eb36117e9e4fba4)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1857069
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/details/details.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index 7b0a501f..4d67d8b1 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -2017,7 +2017,7 @@ class vmmDetails(vmmGObjectUI):
# Firmware
domcaps = self.vm.get_domain_capabilities()
- if self.vm.get_xmlobj().is_uefi():
+ if self.vm.get_xmlobj().os.firmware == "efi":
firmware = 'UEFI'
else:
firmware = domcaps.label_for_firmware_path(
--
2.26.2

View File

@ -1,49 +0,0 @@
From 5ba6467d88383edcdb940949d98f6f212ad3739d Mon Sep 17 00:00:00 2001
Message-Id: <5ba6467d88383edcdb940949d98f6f212ad3739d@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 3 Oct 2019 15:41:44 -0400
Subject: [PATCH] devices: video: Simplify model hvm check
From: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 651e5b6d753930a2e7536efa4e6d20f57b038e80)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/devices/video.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
index 3d8ab939..3ebc561f 100644
--- a/virtinst/devices/video.py
+++ b/virtinst/devices/video.py
@@ -27,6 +27,8 @@ class DeviceVideo(Device):
@staticmethod
def default_model(guest):
+ if not guest.os.is_hvm():
+ return None
if guest.os.is_pseries():
return "vga"
if guest.os.is_arm_machvirt() or guest.os.is_riscv_virt():
@@ -37,11 +39,9 @@ class DeviceVideo(Device):
if guest.has_gl():
return "virtio"
return "qxl"
- if guest.os.is_hvm():
- if guest.conn.is_qemu():
- return "qxl"
- return "vga"
- return None
+ if guest.conn.is_qemu():
+ return "qxl"
+ return "vga"
def set_defaults(self, guest):
if not self.model:
--
2.23.0

View File

@ -1,40 +0,0 @@
From b17d858ccca69ed09fec0a254e133210fef08e17 Mon Sep 17 00:00:00 2001
Message-Id: <b17d858ccca69ed09fec0a254e133210fef08e17@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 8 Sep 2020 15:15:14 -0400
Subject: [PATCH] domain: Fix VM deletion with firmare='efi'
From: Cole Robinson <crobinso@redhat.com>
Our check for nvram was not complete for that case
https://bugzilla.redhat.com/show_bug.cgi?id=1869135
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 38cd19b0c31788cb5e6d16cfa122d52a8c7f630d)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/object/domain.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index f61f0f53..e83f1b11 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -271,9 +271,10 @@ class vmmDomain(vmmLibvirtObject):
return str(i)
def has_nvram(self):
- return bool(self.get_xmlobj().os.loader_ro is True and
- self.get_xmlobj().os.loader_type == "pflash" and
- self.get_xmlobj().os.nvram)
+ return bool(self.get_xmlobj().os.firmware == 'efi' or
+ (self.get_xmlobj().os.loader_ro is True and
+ self.get_xmlobj().os.loader_type == "pflash" and
+ self.get_xmlobj().os.nvram))
def is_persistent(self):
return bool(self._backend.isPersistent())
--
2.26.2

View File

@ -1,46 +0,0 @@
From ff8352b596afe056cefea56a2e4c296d8b804d52 Mon Sep 17 00:00:00 2001
Message-Id: <ff8352b596afe056cefea56a2e4c296d8b804d52@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 3 Oct 2019 10:47:15 +0200
Subject: [PATCH] domcapabilities: Add supports_video_bochs()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
Returns whether bochs display is supported, according to the domain
capabilities.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 2e20b128a1a1f064c5036d3d3d0cf5b09117b9da)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/domcapabilities.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 9cc27bc2..82fed84b 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -325,6 +325,14 @@ class DomainCapabilities(XMLBuilder):
"""
return bool(self.features.sev.supported)
+ def supports_video_bochs(self):
+ """
+ Returns False if either libvirt or qemu do not have support to bochs
+ video type.
+ """
+ models = self.devices.video.get_enum("modelType").get_values()
+ return bool("bochs" in models)
+
XML_NAME = "domainCapabilities"
os = XMLChildProperty(_OS, is_single=True)
cpu = XMLChildProperty(_CPU, is_single=True)
--
2.23.0

View File

@ -1,39 +0,0 @@
From 129bc32090c147fe7239d137c17b1bee2d817024 Mon Sep 17 00:00:00 2001
Message-Id: <129bc32090c147fe7239d137c17b1bee2d817024@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 3 Oct 2019 10:44:52 +0200
Subject: [PATCH] domcapabilities: Get video devices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
domcapabilities already handles disk and hostdev. Let's add support for
getting video devices as well.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 1547e16d62736c861a0e4dadeb86ef372d2698bd)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/domcapabilities.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index f11f18aa..9cc27bc2 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -95,6 +95,7 @@ class _Devices(_CapsBlock):
XML_NAME = "devices"
hostdev = XMLChildProperty(_make_capsblock("hostdev"), is_single=True)
disk = XMLChildProperty(_make_capsblock("disk"), is_single=True)
+ video = XMLChildProperty(_make_capsblock("video"), is_single=True)
class _Features(_CapsBlock):
--
2.23.0

View File

@ -1,36 +0,0 @@
From cc52485e148de49bfee0b1200b3c6d0bc633e607 Mon Sep 17 00:00:00 2001
Message-Id: <cc52485e148de49bfee0b1200b3c6d0bc633e607@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 3 Oct 2019 15:35:59 -0400
Subject: [PATCH] guest: Drop set_capabilities_defaults call from get_uefi_path
From: Cole Robinson <crobinso@redhat.com>
Callers need to handle this themselves, and all callers do AFAICT
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 534f2e03d077306af4309babd30d92ea3ec4e8c0)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/guest.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 41357644..7559d843 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -541,8 +541,6 @@ class Guest(XMLBuilder):
"""
If UEFI firmware path is found, return it, otherwise raise an error
"""
- if not self.os.arch:
- self.set_capabilities_defaults()
domcaps = self.lookup_domcaps()
if not domcaps.supports_uefi_xml():
--
2.23.0

View File

@ -1,35 +0,0 @@
From 31d04f52cf61d0cc87291515d7a92d2db93b86e2 Mon Sep 17 00:00:00 2001
Message-Id: <31d04f52cf61d0cc87291515d7a92d2db93b86e2@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 8 Jul 2019 10:44:43 +0200
Subject: [PATCH] guest: fix warning message when machine type is changed for
secure boot
Introduced by commit <3586d1897>.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1727811
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 3c6e85375d0cd87dcf8ac70b41db0d899851338e)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/guest.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index ef227d17..41357644 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -586,7 +586,8 @@ class Guest(XMLBuilder):
self.os.loader_secure = True
if self.os.machine and "q35" not in self.os.machine:
log.warning("Changing machine type from '%s' to 'q35' "
- "which is required for UEFI secure boot.")
+ "which is required for UEFI secure boot.",
+ self.os.machine)
self.os.machine = "q35"
def disable_hyperv_for_uefi(self):
--
2.21.0

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

@ -1,49 +0,0 @@
From 6a5ca07b8dccbd87a5c896336b09ea37bf80a01a Mon Sep 17 00:00:00 2001
Message-Id: <6a5ca07b8dccbd87a5c896336b09ea37bf80a01a@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 14 Aug 2019 09:45:19 +0200
Subject: [PATCH] man: virt-install: Fix a couple of launchSecurity related
typos
From: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3d5a72e18afcfcdbab35429aeb89d55f48304399)
https://bugzilla.redhat.com/show_bug.cgi?id=1741846
Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
man/virt-install.pod | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/virt-install.pod b/man/virt-install.pod
index d8bd4127..8660f843 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -389,11 +389,11 @@ Configure guest power management features. Example:
Use --pm=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsPowerManagement>
-=item B<--launch-security> TYPE[,OPTS]
+=item B<--launchSecurity> TYPE[,OPTS]
Enable launch security for the guest, e.g. AMD SEV.
-Use --launch-security=? to see a list of all available sub options. Complete
+Use --launchSecurity=? to see a list of all available sub options. Complete
details at L<https://libvirt.org/formatdomain.html#launchSecurity>. Example
invocations:
# This will use a default policy 0x03
@@ -1867,7 +1867,7 @@ refer to libvirt docs for a detailed explanation.
--controller type=scsi,model=virtio-scsi,driver.iommu=on \
--controller type=virtio-serial,driver.iommu=on \
--network network=default,model=virtio,driver.iommu=on \
- --rng driver,iommu=on \
+ --rng /dev/random,driver.iommu=on \
--memballoon driver.iommu=on \
--launchSecurity sev
--
2.21.0

View File

@ -1,107 +0,0 @@
From b41f086d40bd0703f1776589dd4ea5579d0fd520 Mon Sep 17 00:00:00 2001
Message-Id: <b41f086d40bd0703f1776589dd4ea5579d0fd520@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 6 Sep 2019 18:06:08 +0200
Subject: [PATCH] osdict: Always return the most generic tree
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
Some OSes, as Fedora, have variants (which we rely to be standardised on
osinfo-db side), which we can use to return the most generic tree
possible, in case no profile is specified, in order to avoid failing to
install a "Workstation" system because a "Server" variant tree was used.
https://bugzilla.redhat.com/show_bug.cgi?id=1749865
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 0f1acc9f8f392eaf5edd30ce239728afd1f924cf)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
tests/osdict.py | 4 ++++
virtinst/osdict.py | 39 ++++++++++++++++++++++++++++++++++-----
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/tests/osdict.py b/tests/osdict.py
index eb0d4f86..9fb477bd 100644
--- a/tests/osdict.py
+++ b/tests/osdict.py
@@ -52,11 +52,15 @@ class TestOSDB(unittest.TestCase):
def test_tree_url(self):
f26 = OSDB.lookup_os("fedora26")
+ f29 = OSDB.lookup_os("fedora29")
winxp = OSDB.lookup_os("winxp")
# Valid tree URL
assert "fedoraproject.org" in f26.get_location("x86_64")
+ # Most generic tree URL
+ assert "Everything" in f29.get_location("x86_64")
+
# Has tree URLs, but none for arch
try:
f26.get_location("ia64")
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 64d8bdb8..a53e4249 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -592,8 +592,36 @@ class _OsVariant(object):
return "inst.repo"
+ def _get_generic_location(self, treelist, arch, profile):
+ if not hasattr(Libosinfo.Tree, "get_os_variants"):
+ for tree in treelist:
+ if tree.get_architecture() == arch:
+ return tree.get_url()
+ return None
+
+ fallback_tree = None
+ if not profile:
+ profile = "Everything"
+
+ for tree in treelist:
+ if tree.get_architecture() != arch:
+ continue
+
+ variant_list = tree.get_os_variants()
+ if variant_list.get_length() == 0:
+ return tree.get_url()
+
+ fallback_tree = tree
+ for i in range(variant_list.get_length()):
+ variant = variant_list.get_nth(i)
+ if profile in variant.get_name():
+ return tree.get_url()
+
+ if fallback_tree:
+ return fallback_tree.get_url()
+ return None
- def get_location(self, arch):
+ def get_location(self, arch, profile=None):
treelist = []
if self._os:
treelist = list(_OsinfoIter(self._os.get_tree_list()))
@@ -605,10 +633,11 @@ class _OsVariant(object):
# Some distros have more than one URL for a specific architecture,
# which is the case for Fedora and different variants (Server,
# Workstation). Later on, we'll have to differentiate that and return
- # the right one.
- for tree in treelist:
- if tree.get_architecture() == arch:
- return tree.get_url()
+ # the right one. However, for now, let's just rely on returning the
+ # most generic tree possible.
+ location = self._get_generic_location(treelist, arch, profile)
+ if location:
+ return location
raise RuntimeError(
_("OS '%s' does not have a URL location for the %s architecture") %
--
2.23.0

View File

@ -1,111 +0,0 @@
From ec270ec272eb6986b4967df63e74ee60656e1e12 Mon Sep 17 00:00:00 2001
Message-Id: <ec270ec272eb6986b4967df63e74ee60656e1e12@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 11 Sep 2019 18:19:09 +0200
Subject: [PATCH] osdict: Choose the most appropriate tree when a profile is
set
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
As some OSes, as Fedora, have variants (which we rely to be standardised
on osinfo-db side), let's select the most appropriate variant according
to the selected profile of the unattended installation.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit d6d97c658771f75d2a1fdfeeac02ee7bfb106b88)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749865
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
tests/osdict.py | 4 ++++
virt-install | 14 +++++++++-----
virtinst/osdict.py | 6 +++++-
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/tests/osdict.py b/tests/osdict.py
index 9fb477bd..9058b39e 100644
--- a/tests/osdict.py
+++ b/tests/osdict.py
@@ -61,6 +61,10 @@ class TestOSDB(unittest.TestCase):
# Most generic tree URL
assert "Everything" in f29.get_location("x86_64")
+ # Specific tree
+ assert "Server" in f29.get_location("x86_64", "jeos")
+ assert "Workstation" in f29.get_location("x86_64", "desktop")
+
# Has tree URLs, but none for arch
try:
f26.get_location("ia64")
diff --git a/virt-install b/virt-install
index af6c75bf..009d03e1 100755
--- a/virt-install
+++ b/virt-install
@@ -386,9 +386,9 @@ def show_warnings(options, guest, installer, osdata):
# Guest building helpers #
##########################
-def get_location_for_os(guest, osname):
+def get_location_for_os(guest, osname, profile=None):
osinfo = virtinst.OSDB.lookup_os(osname, raise_error=True)
- location = osinfo.get_location(guest.os.arch)
+ location = osinfo.get_location(guest.os.arch, profile)
print_stdout(_("Using {osname} --location {url}").format(
osname=osname, url=location))
return location
@@ -399,6 +399,7 @@ def build_installer(options, guest, installdata):
location = None
location_kernel = None
location_initrd = None
+ unattended_data = None
extra_args = options.extra_args
install_bootdev = installdata.bootdev
@@ -413,8 +414,12 @@ def build_installer(options, guest, installdata):
else:
extra_args = [installdata.kernel_args]
+ if options.unattended:
+ unattended_data = cli.parse_unattended(options.unattended)
+
if install_os:
- location = get_location_for_os(guest, install_os)
+ profile = unattended_data.profile if unattended_data else None
+ location = get_location_for_os(guest, install_os, profile)
elif options.location:
(location,
location_kernel,
@@ -443,8 +448,7 @@ def build_installer(options, guest, installdata):
install_kernel_args=install_kernel_args,
no_install=no_install)
- if options.unattended:
- unattended_data = cli.parse_unattended(options.unattended)
+ if unattended_data:
installer.set_unattended_data(unattended_data)
if extra_args:
installer.set_extra_args(extra_args)
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index a53e4249..ad2a7f2d 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -600,7 +600,11 @@ class _OsVariant(object):
return None
fallback_tree = None
- if not profile:
+ if profile == "jeos":
+ profile = "Server"
+ elif profile == "desktop":
+ profile = "Workstation"
+ elif not profile:
profile = "Everything"
for tree in treelist:
--
2.23.0

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

@ -1,44 +0,0 @@
From 0cc2b81575b0ce04edaa4a94db91f1cc37292ea6 Mon Sep 17 00:00:00 2001
Message-Id: <0cc2b81575b0ce04edaa4a94db91f1cc37292ea6@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 3 Oct 2019 10:50:34 +0200
Subject: [PATCH] video: Prefer "bochs" when it's supported.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
Preferring "bochs" display device is the way to go when dealing with a
Linux guest using UEFI and that's quite well described here:
https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/
https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 8f4c53ea960459516794ba533060a176cc26f121)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1753644
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/devices/video.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
index 3ebc561f..fcca91b6 100644
--- a/virtinst/devices/video.py
+++ b/virtinst/devices/video.py
@@ -39,6 +39,9 @@ class DeviceVideo(Device):
if guest.has_gl():
return "virtio"
return "qxl"
+ if (guest.is_uefi() and
+ guest.lookup_domcaps().supports_video_bochs()):
+ return "bochs"
if guest.conn.is_qemu():
return "qxl"
return "vga"
--
2.23.0

View File

@ -1,47 +0,0 @@
From 8676750b73bda178cfe0f278e76547711910f71d Mon Sep 17 00:00:00 2001
Message-Id: <8676750b73bda178cfe0f278e76547711910f71d@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 25 Jul 2019 14:09:53 +0200
Subject: [PATCH] virt-install: Use minutes instead of seconds on
get_time_string()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Fabiano Fidêncio <fidencio@redhat.com>
get_time_string() currently uses self._wait_secs, while it should use
self._wait_mins, resulting on confusing messages when using `--wait`
option, as shown below:
fidencio@laerte ~/src/upstream/virt-manager $ ./virt-install --install fedora30 --unattended --wait 20
...
Waiting 1200 minutes for installation to complete.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 414ffa5ef82548d502a4de98d40228a68bdb29c1)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1777664
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virt-install | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt-install b/virt-install
index 009d03e1..022f947d 100755
--- a/virt-install
+++ b/virt-install
@@ -614,7 +614,7 @@ class WaitHandler:
self._start_time = time.time()
def get_time_string(self):
- timestr = _(" %d minutes") % self._wait_secs
+ timestr = _(" %d minutes") % self._wait_mins
if self._wait_forever:
timestr = ""
ret = _("Waiting%(time_string)s for installation to complete.") % {
--
2.26.2

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,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

@ -1,39 +0,0 @@
From f018551b9dbf9afc56b44be1af59f29781b6b548 Mon Sep 17 00:00:00 2001
Message-Id: <f018551b9dbf9afc56b44be1af59f29781b6b548@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 3 Dec 2019 13:02:21 +0100
Subject: [PATCH] virt-xml: fix defined_xml_is_unchanged
Commit <53f075ab76e1c372474ae0d88f202e487d9f213f> added a warning if the
VM XML is not changed after removing default devices but the code was
incorrect. We have to compare strings instead of string vs Guest object
and also the condition was inverted.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 29f9f5f2d7f47fe6cc3333f2a9e6c6209db5a8f3)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1857504
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virt-xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/virt-xml b/virt-xml
index 71445c9f..7b0174c9 100755
--- a/virt-xml
+++ b/virt-xml
@@ -105,8 +105,8 @@ def get_domain_and_guest(conn, domstr):
def defined_xml_is_unchanged(conn, domain, original_xml):
rawxml = get_xmldesc(domain, inactive=True)
- new_xml = virtinst.Guest(conn, parsexml=rawxml)
- return new_xml != original_xml
+ new_xml = virtinst.Guest(conn, parsexml=rawxml).get_xml()
+ return new_xml == original_xml
################
--
2.26.2

View File

@ -1,15 +1,5 @@
# This package depends on automagic byte compilation
# https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
%global _python_bytecompile_extra 1
# -*- rpm-spec -*- # -*- rpm-spec -*-
# RPM doesn't detect that code in /usr/share is python3, this forces it
# https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build#Python_bytecompilation
%global __python %{__python3}
%bcond_with virtconvert
%global with_guestfs 0 %global with_guestfs 0
%global default_hvs "qemu,xen,lxc" %global default_hvs "qemu,xen,lxc"
@ -17,7 +7,7 @@
# End local config # End local config
Name: virt-manager Name: virt-manager
Version: 2.2.1 Version: 3.2.0
Release: 4%{?dist}%{?extra_release} Release: 4%{?dist}%{?extra_release}
%global verrel %{version}-%{release} %global verrel %{version}-%{release}
@ -28,21 +18,16 @@ URL: https://virt-manager.org/
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
Source1: symlinks Source1: symlinks
Patch1: virt-manager-guest-fix-warning-message-when-machine-type-is-changed-for-secure-boot.patch Patch1: virt-manager-cli-introduce-resource-fibrechannel.appid-option.patch
Patch2: virt-manager-man-virt-install-Fix-a-couple-of-launchSecurity-related-typos.patch Patch2: virt-manager-virt-install-add-mediated-device.patch
Patch3: virt-manager-guest-Drop-set_capabilities_defaults-call-from-get_uefi_path.patch Patch3: virt-manager-virt-xml-add-support-for-mediated-devices.patch
Patch4: virt-manager-devices-video-Simplify-model-hvm-check.patch Patch4: virt-manager-hostdev-use-method-get_mdev_uuid.patch
Patch5: virt-manager-domcapabilities-Get-video-devices.patch Patch5: virt-manager-tests-verify-MDEV-support.patch
Patch6: virt-manager-domcapabilities-Add-supports_video_bochs.patch Patch6: virt-manager-virt-manager-enable-MDEV-support.patch
Patch7: virt-manager-video-Prefer-bochs-when-it-s-supported.patch Patch7: virt-manager-Handle-new-nodedev-name-for-mediated-devices.patch
Patch8: virt-manager-addhardware-Add-bochs-display-to-the-video-list.patch Patch8: virt-manager-addstorage-Don-t-pass-None-to-widget.set_active.patch
Patch9: virt-manager-osdict-Always-return-the-most-generic-tree.patch Patch9: virt-manager-cli-add-ioapic.driver-to-features.patch
Patch10: virt-manager-osdict-Choose-the-most-appropriate-tree-when-a-profile-is-set.patch Patch10: virt-manager-console-fix-error-with-old-pygobject.patch
Patch11: virt-manager-virt-install-Use-minutes-instead-of-seconds-on-get_time_string.patch
Patch12: virt-manager-details-Fix-showing-the-firmware-type-in-case-of-firmware-auto-selection.patch
Patch13: virt-manager-details-fix-detection-of-firmware-auto-selection.patch
Patch14: virt-manager-domain-Fix-VM-deletion-with-firmare-efi.patch
Patch15: virt-manager-virt-xml-fix-defined_xml_is_unchanged.patch
Requires: virt-manager-common = %{verrel} Requires: virt-manager-common = %{verrel}
@ -77,9 +62,9 @@ Recommends: libvirt-daemon-config-network
Suggests: python3-libguestfs Suggests: python3-libguestfs
BuildRequires: git BuildRequires: git
BuildRequires: intltool BuildRequires: gettext
BuildRequires: /usr/bin/pod2man
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-docutils
%description %description
@ -118,9 +103,6 @@ Requires: libvirt-client
Provides: virt-install Provides: virt-install
Provides: virt-clone Provides: virt-clone
Provides: virt-xml Provides: virt-xml
%if %{with virtconvert}
Provides: virt-convert
%endif
%description -n virt-install %description -n virt-install
Package includes several command line utilities, including virt-install Package includes several command line utilities, including virt-install
@ -141,7 +123,7 @@ while read lnk target; do
fi fi
done <%{_sourcedir}/symlinks || exit 1 done <%{_sourcedir}/symlinks || exit 1
git add . git add .
git commit -q -a --author 'rpm-build <rpm-build>' -m symlinks git commit -q -a --allow-empty --author 'rpm-build <rpm-build>' -m symlinks
git config gc.auto 0 git config gc.auto 0
@ -164,9 +146,9 @@ git config gc.auto 0
install -O1 --root=%{buildroot} install -O1 --root=%{buildroot}
%find_lang %{name} %find_lang %{name}
%if %{without virtconvert} %if 0%{?py_byte_compile:1}
find %{buildroot} -name virt-convert\* -delete # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#manual-bytecompilation
rm -rf %{buildroot}/%{_datadir}/%{name}/virtconv %py_byte_compile %{python3} %{buildroot}%{_datadir}/virt-manager/
%endif %endif
# Replace '#!/usr/bin/env python3' with '#!/usr/bin/python3' # Replace '#!/usr/bin/env python3' with '#!/usr/bin/python3'
@ -184,23 +166,19 @@ done
%{_mandir}/man1/%{name}.1* %{_mandir}/man1/%{name}.1*
%{_datadir}/%{name}/ui/*.ui %{_datadir}/%{name}/ui/*.ui
%{_datadir}/%{name}/virt-manager
%{_datadir}/%{name}/virtManager %{_datadir}/%{name}/virtManager
%{_datadir}/%{name}/icons %{_datadir}/%{name}/icons
%{_datadir}/icons/hicolor/*/apps/* %{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop %{_datadir}/applications/%{name}.desktop
%{_datadir}/glib-2.0/schemas/org.virt-manager.virt-manager.gschema.xml %{_datadir}/glib-2.0/schemas/org.virt-manager.virt-manager.gschema.xml
%{_datadir}/metainfo/%{name}.appdata.xml
%files common -f %{name}.lang %files common -f %{name}.lang
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%if %{with virtconvert}
%{_datadir}/%{name}/virtconv
%endif
%{_datadir}/%{name}/virtinst %{_datadir}/%{name}/virtinst
@ -209,10 +187,6 @@ done
%{_mandir}/man1/virt-clone.1* %{_mandir}/man1/virt-clone.1*
%{_mandir}/man1/virt-xml.1* %{_mandir}/man1/virt-xml.1*
%{_datadir}/%{name}/virt-install
%{_datadir}/%{name}/virt-clone
%{_datadir}/%{name}/virt-xml
%{_datadir}/bash-completion/completions/virt-install %{_datadir}/bash-completion/completions/virt-install
%{_datadir}/bash-completion/completions/virt-clone %{_datadir}/bash-completion/completions/virt-clone
%{_datadir}/bash-completion/completions/virt-xml %{_datadir}/bash-completion/completions/virt-xml
@ -221,15 +195,29 @@ done
%{_bindir}/virt-clone %{_bindir}/virt-clone
%{_bindir}/virt-xml %{_bindir}/virt-xml
%if %{with virtconvert}
%{_bindir}/virt-convert
%{_datadir}/bash-completion/completions/virt-convert
%{_datadir}/%{name}/virt-convert
%{_mandir}/man1/virt-convert.1*
%endif
%changelog %changelog
* 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:
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)
* Mon Nov 23 2020 Pavel Hrdina <phrdina@redhat.com> - 2.2.1-4 * 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) - 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 showing the firmware type in case of firmware auto selection (rhbz#1857069)