Sync from SUSE:SLFO:Main virt-manager revision 1e077814a00fc7df88daa558ef5682bd

This commit is contained in:
Adrian Schröter 2024-05-04 01:45:43 +02:00
commit 3b8ccbbe54
116 changed files with 14206 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,95 @@
Subject: cli: --disk: Add driver.metadata_cache options
From: Lin Ma lma@suse.com Tue Aug 16 12:59:57 2022 +0800
Date: Wed Aug 17 09:57:29 2022 -0400:
Git: 11a887ece5b5bab287ff77b09337dc44c4e6e976
Properly setting the metadata cache size can provide better performance
in case of using big qcow2 images.
This patch introduces two driver options:
* driver.metadata_cache.max_size
* driver.metadata_cache.max_size.unit
E.g. --disk ...,driver.type=qcow2,\
driver.metadata_cache.max_size=2,\
driver.metadata_cache.max_size.unit=MiB
BTW, Metadata cache size control is currently supported only for qcow2.
Regarding how to properly caluclate the cache size of qcow2, Please refer
to qemu's documentation.
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index a73343a9..a33dc16a 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -423,6 +423,15 @@
</source>
<target dev="vdu" bus="virtio"/>
</disk>
+ <disk type="file" device="disk">
+ <driver name="qemu" type="qcow2">
+ <metadata_cache>
+ <max_size unit="KiB">2048</max_size>
+ </metadata_cache>
+ </driver>
+ <source file="/tmp/disk1.qcow2"/>
+ <target dev="vdv" bus="virtio"/>
+ </disk>
<controller type="usb" index="0" model="ich9-ehci1">
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
</controller>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 774db098..259ac78c 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -605,6 +605,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--disk path=/fooroot.img,size=.0001,transient=on
--disk source.dir=/
--disk type=nvme,source.type=pci,source.managed=no,source.namespace=2,source.address.domain=0x0001,source.address.bus=0x02,source.address.slot=0x00,source.address.function=0x0
+--disk /tmp/disk1.qcow2,size=16,driver.type=qcow2,driver.metadata_cache.max_size=2048,driver.metadata_cache.max_size.unit=KiB
--network user,mac=12:34:56:78:11:22,portgroup=foo,link_state=down,rom_bar=on,rom_file=/tmp/foo
diff --git a/virtinst/cli.py b/virtinst/cli.py
index c4dffd34..042b500f 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -3497,6 +3497,8 @@ class ParserDisk(VirtCLIParser):
"driver.io": "io",
"driver.name": "driver_name",
"driver.type": "driver_type",
+ "driver.metadata_cache.max_size": "metadata_cache.max_size",
+ "driver.metadata_cache.max_size.unit": "metadata_cache.max_size.unit",
}
def _add_advertised_aliases(self):
@@ -3696,6 +3698,11 @@ class ParserDisk(VirtCLIParser):
cls.add_arg("driver.queues", "driver_queues")
cls.add_arg("driver.error_policy", "error_policy")
+ cls.add_arg("driver.metadata_cache.max_size",
+ "driver_metadata_cache_max_size")
+ cls.add_arg("driver.metadata_cache.max_size.unit",
+ "driver_metadata_cache_max_size_unit")
+
cls.add_arg("iotune.read_bytes_sec", "iotune_rbs")
cls.add_arg("iotune.write_bytes_sec", "iotune_wbs")
cls.add_arg("iotune.total_bytes_sec", "iotune_tbs")
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index dc59fd13..9609ebac 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -481,6 +481,11 @@ class DeviceDisk(Device):
driver_iothread = XMLProperty("./driver/@iothread", is_int=True)
driver_queues = XMLProperty("./driver/@queues", is_int=True)
+ driver_metadata_cache_max_size = XMLProperty(
+ "./driver/metadata_cache/max_size", is_int=True)
+ driver_metadata_cache_max_size_unit = XMLProperty(
+ "./driver/metadata_cache/max_size/@unit")
+
error_policy = XMLProperty("./driver/@error_policy")
serial = XMLProperty("./serial")
wwn = XMLProperty("./wwn")

View File

@ -0,0 +1,20 @@
Subject: tests: cli: Fix test output after previous commit
From: Cole Robinson crobinso@redhat.com Wed Aug 17 10:21:31 2022 -0400
Date: Wed Aug 17 10:21:31 2022 -0400:
Git: 7295ebfb02e1a6ebcc1fc94c4aecfe8e21a0e567
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index a33dc16a..c27512d1 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -424,7 +424,7 @@
<target dev="vdu" bus="virtio"/>
</disk>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2">
+ <driver name="qemu" type="qcow2" discard="unmap">
<metadata_cache>
<max_size unit="KiB">2048</max_size>
</metadata_cache>

View File

@ -0,0 +1,41 @@
Subject: fsdetails: Fix an error with source.socket of virtiofs
From: Lin Ma lma@suse.com Tue Aug 16 12:59:36 2022 +0800
Date: Wed Aug 17 10:24:10 2022 -0400:
Git: 58f5e36da76277bfc7fb4d87293be60ef6e0cbc1
Using the source.socket of virtiofs needs a virtiofsd daemon launched
outside of libvirtd, So the filesystem UI doesn't support it yet. If
users need it they can set it manually in the XML editor.
But if we view the filesystem info of such a VM on the details page,
It fails with this error message:
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/details/details.py", line 1713, in _refresh_page
self._refresh_filesystem_page(dev)
File "/usr/share/virt-manager/virtManager/details/details.py", line 2241, in _refresh_filesystem_page
self.fsDetails.set_dev(dev)
File "/usr/share/virt-manager/virtManager/device/fsdetails.py", line 193, in set_dev
self.widget("fs-source").set_text(dev.source)
TypeError: Argument 1 does not allow None as a value
This patch fixes above issue by leaving the 'source path' info blank in
case of source.socket.
In this case, Considering that showing 'target path' info without source
info is kind of meaningless, So this patch leaves the 'target path' info
blank as well.
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/virtManager/device/fsdetails.py b/virtManager/device/fsdetails.py
index 40868d1c..b9956e1d 100644
--- a/virtManager/device/fsdetails.py
+++ b/virtManager/device/fsdetails.py
@@ -190,7 +190,7 @@ class vmmFSDetails(vmmGObjectUI):
self.widget("fs-format-combo"), dev.driver_format)
if dev.type != DeviceFilesystem.TYPE_RAM:
- self.widget("fs-source").set_text(dev.source)
+ self.widget("fs-source").set_text(dev.source or "")
else:
self.widget("fs-ram-source-spin").set_value(int(dev.source) // 1024)
self.widget("fs-target").set_text(dev.target or "")

View File

@ -0,0 +1,20 @@
Subject: cli: Drop unnecessary --disk prop aliases
From: Cole Robinson crobinso@redhat.com Wed Aug 17 10:27:36 2022 -0400
Date: Wed Aug 17 10:27:36 2022 -0400:
Git: 4b150735720d8a54c153e10a1bc760d252594004
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 042b500f..388c5263 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -3497,8 +3497,6 @@ class ParserDisk(VirtCLIParser):
"driver.io": "io",
"driver.name": "driver_name",
"driver.type": "driver_type",
- "driver.metadata_cache.max_size": "metadata_cache.max_size",
- "driver.metadata_cache.max_size.unit": "metadata_cache.max_size.unit",
}
def _add_advertised_aliases(self):

View File

@ -0,0 +1,25 @@
Subject: tests: testdriver: Add filesystem socket example
From: Cole Robinson crobinso@redhat.com Wed Aug 17 10:29:31 2022 -0400
Date: Wed Aug 17 10:29:31 2022 -0400:
Git: 1b87e3e54c782da39cf30b100a22f70c37bfcddd
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index b213863d..7c94e698 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -599,6 +599,13 @@ Foo bar baz &amp; yeah boii &lt; &gt; yeahfoo
<source file='/root/container.vmdk'/>
<target dir='/home'/>
</filesystem>
+ <filesystem type='mount'>
+ <driver type='virtiofs' queue='1024'/>
+ <source socket='/tmp/sock'/>
+ <target dir='tag'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </filesystem>
+
<!-- tpm devices -->
<tpm model='tpm-tis'>

View File

@ -0,0 +1,45 @@
Subject: virtinstall: split no_install conditional apart to track code coverage
From: Cole Robinson crobinso@redhat.com Sat Aug 20 09:42:47 2022 -0400
Date: Sat Aug 20 09:47:49 2022 -0400:
Git: 1cb0be4002445e5755ead2423b5a4e9e06f0a3cb
Each bit here is part of the CLI API, we need to be sure we are
covering each one. Extend the test suite to hit one case we are missing
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1017,7 +1017,9 @@ c = vinst.add_category("misc-install", "
c.add_compare("--connect %s --os-variant generic" % (utils.URIs.test_suite), "noargs-fail", use_default_args=False) # No arguments
c.add_compare("--connect %s --os-variant fedora26" % (utils.URIs.test_suite), "osvariant-noargs-fail", use_default_args=False) # No arguments
c.add_compare("--connect %s --os-variant fedora26 --pxe --print-xml" % (utils.URIs.test_suite), "osvariant-defaults-pxe", use_default_args=False) # No arguments
+c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-generate=yes,disable=no --sysinfo system.serial=foobar", "cloud-init-options1", env={"VIRTINST_TEST_SUITE_PRINT_CLOUDINIT": "1"}) # --cloud-init root-password-generate, with --sysinfo override
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init", "cloud-init-default", env={"VIRTINST_TEST_SUITE_CLOUDINIT": "1"}) # default --cloud-init behavior is root-password-generate=yes,disable=yes
+c.add_valid("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init", env={"VIRTINST_TEST_SUITE_CLOUDINIT": "1"}) # default --cloud-init, but without implied --print-xml, to hit some specific code paths
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-generate=yes,disable=no --sysinfo system.serial=foobar", "cloud-init-options1", env={"VIRTINST_TEST_SUITE_PRINT_CLOUDINIT": "1"}) # --cloud-init root-password-generate, with --sysinfo override
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-file=%(ADMIN-PASSWORD-FILE)s,root-ssh-key=%(XMLDIR)s/cloudinit/ssh-key.txt,clouduser-ssh-key=%(XMLDIR)s/cloudinit/ssh-key2.txt --boot smbios.mode=none", "cloud-init-options2", env={"VIRTINST_TEST_SUITE_PRINT_CLOUDINIT": "1"}) # --cloud-init root-password-file with smbios.mode override
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init ssh-key=%(XMLDIR)s/cloudinit/ssh-key.txt", "cloud-init-options3", env={"VIRTINST_TEST_SUITE_PRINT_CLOUDINIT": "1"}) # --cloud-init ssh-key
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -429,11 +429,15 @@ def build_installer(options, guest, inst
install_bootdev = "network"
elif installdata.is_set:
pass
- elif (options.import_install or
- options.xmlonly or
- options.boot or
- options.cloud_init or
- options.unattended):
+ elif options.xmlonly:
+ no_install = True
+ elif options.import_install:
+ no_install = True
+ elif options.boot:
+ no_install = True
+ elif options.cloud_init:
+ no_install = True
+ elif options.unattended:
no_install = True
installer = virtinst.Installer(guest.conn,

View File

@ -0,0 +1,42 @@
Subject: virtinstall: fix regression with --boot and no install method
From: Cole Robinson crobinso@redhat.com Sat Aug 20 09:54:01 2022 -0400
Date: Sat Aug 20 09:54:01 2022 -0400:
Git: e94786c066696781a821f5a4bcef3c377e4bc5e5
Anything passed to --boot should imply --install no_install=yes
in the absence of other --install options. This is historically
what we've done but we regressed in 4.1.0
Resolves: https://github.com/virt-manager/virt-manager/issues/426
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -967,6 +967,7 @@ c.add_valid("--os-variant generic --pxe
c.add_valid("--os-variant winxp --ram 32 --cdrom %(EXISTIMG1)s", grep="32 MiB is less than the recommended 64 MiB") # Windows. Catch memory warning
c.add_valid("--osinfo generic --pxe --autostart") # --autostart flag
c.add_valid("--cdrom %(EXISTIMG2)s --os-variant win2k3 --print-step 2") # HVM windows install, print 3rd stage XML
+c.add_valid("--memory 512 --osinfo generic --boot cdrom") # --boot XXX should imply --install no_install
c.add_compare("--location location=%(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install", "initrd-inject") # initrd-inject
c.add_compare("--cdrom http://example.com/path/to/some.iso --os-variant detect=yes,require=no", "cdrom-url")
c.add_compare("--pxe --print-step all --os-variant none", "simple-pxe") # Diskless PXE install
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -433,7 +433,7 @@ def build_installer(options, guest, inst
no_install = True
elif options.import_install:
no_install = True
- elif options.boot:
+ elif options.boot_was_set:
no_install = True
elif options.cloud_init:
no_install = True
@@ -645,6 +645,7 @@ def _build_options_guest(conn, options):
def build_guest_instance(conn, options):
installdata = cli.parse_install(options.install)
osdata = cli.parse_os_variant(options.os_variant or installdata.os)
+ options.boot_was_set = bool(options.boot)
if options.reinstall:
dummy1, guest, dummy2 = cli.get_domain_and_guest(conn, options.reinstall)

View File

@ -0,0 +1,22 @@
Subject: tests: Add a compat check for linux2020 in amd-sev test case
From: Lin Ma lma@suse.com Fri Aug 19 18:18:09 2022 +0800
Date: Sat Aug 20 09:59:27 2022 -0400:
Git: c22a876e9a63cb7114e2b008f2e24682c8bbef3e
It avoids amd-sev test failure if using older osinfo-db.
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index cc1d3da2..9f6c3bc0 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1108,7 +1108,7 @@ c.add_compare("--connect " + utils.URIs.kvm_x86_remote + " --import --disk %(EXI
c.add_compare("--connect %(URI-KVM-X86)s --os-variant fedora26 --graphics spice --controller usb,model=none", "graphics-usb-disable")
c.add_compare("--osinfo generic --boot uefi --disk size=1", "boot-uefi")
c.add_compare("--osinfo generic --boot uefi --disk size=1 --tpm none --connect " + utils.URIs.kvm_x86_oldfirmware, "boot-uefi-oldcaps")
-c.add_compare("--osinfo linux2020 --boot uefi --launchSecurity sev --connect " + utils.URIs.kvm_amd_sev, "amd-sev")
+c.add_compare("--osinfo linux2020 --boot uefi --launchSecurity sev --connect " + utils.URIs.kvm_amd_sev, "amd-sev", prerun_check=no_osinfo_linux2020_virtio)
c.add_invalid("--disk none --location nfs:example.com/fake --nonetworks", grep="NFS URL installs are no longer supported")
c.add_invalid("--disk none --boot network --machine foobar", grep="domain type None with machine 'foobar'")

View File

@ -0,0 +1,117 @@
Subject: cli: --cpu: Add maxphysaddr.{mode,bits} options
From: Lin Ma lma@suse.com Fri Aug 19 18:18:50 2022 +0800
Date: Sat Aug 20 10:03:11 2022 -0400:
Git: fbdf05162606e4d70506b65d0dd647a59f229253
This commit added support for cpu physical address bits control, It's
useful for VMs with huge amount of ram.
E.g.
--cpu Cascadelake-Server,maxphysaddr.mode=emulate,maxphysaddr.bits=46
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index c27512d1..e4a7da8f 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -194,6 +194,7 @@
<bandwidth initiator="0" target="2" cache="1" type="access" value="409600" unit="KiB"/>
</interconnects>
</numa>
+ <maxphysaddr mode="emulate" bits="46"/>
</cpu>
<clock offset="utc">
<timer name="pit" tickpolicy="catchup" present="yes"/>
diff --git a/tests/data/cli/compare/virt-install-testdriver-edgecases.xml b/tests/data/cli/compare/virt-install-testdriver-edgecases.xml
index f129d089..3cc385c0 100644
--- a/tests/data/cli/compare/virt-install-testdriver-edgecases.xml
+++ b/tests/data/cli/compare/virt-install-testdriver-edgecases.xml
@@ -17,7 +17,9 @@
<pae/>
<vmport state="off"/>
</features>
- <cpu mode="host-passthrough" migratable="on"/>
+ <cpu mode="host-passthrough" migratable="on">
+ <maxphysaddr mode="passthrough"/>
+ </cpu>
<clock offset="utc"/>
<pm>
<suspend-to-mem enabled="no"/>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 9f6c3bc0..ef27276a 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -511,7 +511,8 @@ numa.interconnects.latency0.initiator=0,numa.interconnects.latency0.target=0,num
numa.interconnects.latency1.initiator=0,numa.interconnects.latency1.target=2,numa.interconnects.latency1.cache=1,numa.interconnects.latency1.type=access,numa.interconnects.latency1.value=10,numa.interconnects.latency1.unit=ns,\
numa.interconnects.bandwidth0.initiator=0,numa.interconnects.bandwidth0.target=0,numa.interconnects.bandwidth0.type=access,numa.interconnects.bandwidth0.value=204800,\
numa.interconnects.bandwidth1.initiator=0,numa.interconnects.bandwidth1.target=2,numa.interconnects.bandwidth1.cache=1,numa.interconnects.bandwidth1.type=access,numa.interconnects.bandwidth1.value=409600,numa.interconnects.bandwidth1.unit=KiB,\
-cache.mode=emulate,cache.level=3
+cache.mode=emulate,cache.level=3,\
+maxphysaddr.mode=emulate,maxphysaddr.bits=46
--numatune 1,2,3,5-7,^6,mode=strict,\
@@ -880,7 +881,7 @@ c.add_compare("--pxe "
# Hitting test driver specific output
c.add_compare("--connect " + utils.URIs.test_suite + " "
-"--cpu host-passthrough,migratable=on " # migratable=on is only accepted with host-passthrough
+"--cpu host-passthrough,migratable=on,maxphysaddr.mode=passthrough " # migratable=on is only accepted with host-passthrough
"--seclabel label=foobar.label,a1,z2,b3,relabel=yes,type=dynamic " # fills in default model=testModel
"--tpm default " # --tpm default when domcaps missing
"",
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 388c5263..5ac8266b 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2386,6 +2386,9 @@ class ParserCPU(VirtCLIParser):
cls.add_arg("cache.level", "cache.level")
cls.add_arg("cache.mode", "cache.mode")
+ cls.add_arg("maxphysaddr.mode", "maxphysaddr.mode")
+ cls.add_arg("maxphysaddr.bits", "maxphysaddr.bits")
+
# CPU features
# These are handled specially in _parse
cls.add_arg("force", None, lookup_cb=None, cb=cls.set_feature_cb)
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index 5de42b4e..c635932e 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -102,6 +102,17 @@ class _CPUFeature(XMLBuilder):
policy = XMLProperty("./@policy")
+class _CPUMaxphysaddr(XMLBuilder):
+ """
+ Class for generating XML for <cpu> child node <maxphysaddr>.
+ """
+ XML_NAME = "maxphysaddr"
+ _XML_PROP_ORDER = ["mode", "bits"]
+
+ mode = XMLProperty("./@mode")
+ bits = XMLProperty("./@bits", is_int=True)
+
+
##############
# NUMA cells #
##############
@@ -211,7 +222,7 @@ class DomainCpu(XMLBuilder):
_XML_PROP_ORDER = ["mode", "match", "check", "migratable",
"model", "model_fallback", "model_vendor_id", "vendor",
"topology", "cache", "features",
- "cells", "latencies", "bandwidths"]
+ "cells", "latencies", "bandwidths", "maxphysaddr"]
##################
@@ -242,6 +253,8 @@ class DomainCpu(XMLBuilder):
latencies = XMLChildProperty(_NUMALatency, relative_xpath="./numa/interconnects")
bandwidths = XMLChildProperty(_NUMABandwidth, relative_xpath="./numa/interconnects")
+ maxphysaddr = XMLChildProperty(_CPUMaxphysaddr, is_single=True)
+
#############################
# Special CPU mode handling #

View File

@ -0,0 +1,24 @@
Subject: virt-install: --help required options are wrong
From: Cole Robinson crobinso@redhat.com Sun Aug 21 16:08:37 2022 -0400
Date: Sun Aug 21 16:10:55 2022 -0400:
Git: a254ece0f0497d062a0e4c94dc45619649ea4922
Nowadays it could be as simple as `virt-install --install fedora36`.
Trying to represent the interdepencies here is not worth it, but
let's keep a simple string around to avoid the default parser
usage string, which is huge
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -1019,7 +1019,7 @@ def xml_to_print(guest, installer, xmlon
def parse_args():
parser = cli.setupParser(
- "%(prog)s --name NAME --memory MB STORAGE INSTALL [options]",
+ "%(prog)s OPTIONS",
_("Create a new virtual machine from specified install media."),
introspection_epilog=True)
cli.add_connect_option(parser)

View File

@ -0,0 +1,85 @@
Subject: cloner: Sync <uuid> and <sysinfo> system uuid
From: Cole Robinson crobinso@redhat.com Sun Aug 21 16:21:10 2022 -0400
Date: Sun Aug 21 16:21:10 2022 -0400:
Git: b0d0516736320315a70f74aff3759fb35dd35d9d
Otherwise libvirt errors like:
ERROR UUID mismatch between <uuid> and <sysinfo>
https://bugzilla.redhat.com/show_bug.cgi?id=2038040
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/cli/compare/virt-clone-auto-unmanaged.xml b/tests/data/cli/compare/virt-clone-auto-unmanaged.xml
index 21a9a639..f2043be2 100644
--- a/tests/data/cli/compare/virt-clone-auto-unmanaged.xml
+++ b/tests/data/cli/compare/virt-clone-auto-unmanaged.xml
@@ -1,6 +1,11 @@
<domain type="test">
<name>origtest-clone</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <sysinfo type="smbios">
+ <system>
+ <entry name="uuid">00000000-1111-2222-3333-444444444444</entry>
+ </system>
+ </sysinfo>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
diff --git a/tests/data/cli/compare/virt-clone-unmanaged-preserve.xml b/tests/data/cli/compare/virt-clone-unmanaged-preserve.xml
index 3bdbbbe3..c003ed3e 100644
--- a/tests/data/cli/compare/virt-clone-unmanaged-preserve.xml
+++ b/tests/data/cli/compare/virt-clone-unmanaged-preserve.xml
@@ -1,6 +1,11 @@
<domain type="test">
<name>clonetest</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <sysinfo type="smbios">
+ <system>
+ <entry name="uuid">00000000-1111-2222-3333-444444444444</entry>
+ </system>
+ </sysinfo>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
diff --git a/tests/data/cli/virtclone/clone-disk.xml b/tests/data/cli/virtclone/clone-disk.xml
index da1eb0a6..2f6e916d 100644
--- a/tests/data/cli/virtclone/clone-disk.xml
+++ b/tests/data/cli/virtclone/clone-disk.xml
@@ -1,6 +1,11 @@
<domain type='test' id='1'>
<name>origtest</name>
<uuid>db69fa1f-eef0-e567-3c20-3ef16f10376b</uuid>
+ <sysinfo type='smbios'>
+ <system>
+ <entry name='uuid'>db69fa1f-eef0-e567-3c20-3ef16f10376b</entry>
+ </system>
+ </sysinfo>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
diff --git a/virtinst/cloner.py b/virtinst/cloner.py
index 34a702f9..9334513c 100644
--- a/virtinst/cloner.py
+++ b/virtinst/cloner.py
@@ -352,8 +352,7 @@ class Cloner(object):
"""
self._new_guest.id = None
self._new_guest.title = None
- self._new_guest.uuid = None
- self._new_guest.uuid = Guest.generate_uuid(self.conn)
+ self.set_clone_uuid(Guest.generate_uuid(self.conn))
for dev in self._new_guest.devices.graphics:
if dev.port and dev.port != -1:
@@ -408,6 +407,9 @@ class Cloner(object):
Override the new VMs generated UUId
"""
self._new_guest.uuid = uuid
+ for sysinfo in self._new_guest.sysinfo:
+ if sysinfo.system_uuid:
+ sysinfo.system_uuid = uuid
def set_replace(self, val):
"""

View File

@ -0,0 +1,34 @@
Subject: virt-install: --unattended and --cloud-init conflict
From: Cole Robinson crobinso@redhat.com Sun Aug 21 16:47:26 2022 -0400
Date: Sun Aug 21 16:47:26 2022 -0400:
Git: 999ccb85e3e4189386786256cdf70cf5238cf785
Make it an explicit error, otherwise unattended is preferred and
cloud-init is ignored
https://bugzilla.redhat.com/show_bug.cgi?id=2117157
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1116,6 +1116,7 @@ c.add_invalid("--disk none --boot networ
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm", grep="any virtualization options for architecture 'mips'")
c.add_invalid("--nodisks --boot network --paravirt --arch mips", grep=" 'xen' for architecture 'mips'")
c.add_invalid("--osinfo generic --launchSecurity sev --connect " + utils.URIs.kvm_amd_sev, grep="SEV launch security requires a Q35 UEFI machine")
+c.add_invalid("--disk none --cloud-init --unattended --install fedora30", grep="--unattended and --cloud-init can not")
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -411,6 +411,9 @@ def build_installer(options, guest, inst
else:
extra_args = [installdata.kernel_args]
+ if options.unattended and options.cloud_init:
+ fail("--unattended and --cloud-init can not be specified together.")
+
if options.unattended:
unattended_data = cli.parse_unattended(options.unattended)

View File

@ -0,0 +1,31 @@
Subject: virt-install: Reuse cli.fail_conflicting
From: Cole Robinson crobinso@redhat.com Mon Aug 22 10:15:46 2022 -0400
Date: Mon Aug 22 10:16:19 2022 -0400:
Git: 1d64a678d31829051444e1bf29d86f800e13de39
For the --unattended + --cloud-init conflict
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1116,7 +1116,7 @@ c.add_invalid("--disk none --boot networ
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm", grep="any virtualization options for architecture 'mips'")
c.add_invalid("--nodisks --boot network --paravirt --arch mips", grep=" 'xen' for architecture 'mips'")
c.add_invalid("--osinfo generic --launchSecurity sev --connect " + utils.URIs.kvm_amd_sev, grep="SEV launch security requires a Q35 UEFI machine")
-c.add_invalid("--disk none --cloud-init --unattended --install fedora30", grep="--unattended and --cloud-init can not")
+c.add_invalid("--disk none --cloud-init --unattended --install fedora30", grep="Cannot use --unattended and --cloud-init at the same time")
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -412,7 +412,7 @@ def build_installer(options, guest, inst
extra_args = [installdata.kernel_args]
if options.unattended and options.cloud_init:
- fail("--unattended and --cloud-init can not be specified together.")
+ cli.fail_conflicting("--unattended", "--cloud-init")
if options.unattended:
unattended_data = cli.parse_unattended(options.unattended)

View File

@ -0,0 +1,74 @@
Subject: cli: support --boot loader.stateless=
From: Cole Robinson crobinso@redhat.com Mon Oct 17 11:54:37 2022 -0400
Date: Mon Oct 17 11:54:37 2022 -0400:
Git: 15ddeae6cb405bad10bc62164b14117646e9127e
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/cli/compare/virt-install-singleton-config-2.xml b/tests/data/cli/compare/virt-install-singleton-config-2.xml
index d567d188..27c69c11 100644
--- a/tests/data/cli/compare/virt-install-singleton-config-2.xml
+++ b/tests/data/cli/compare/virt-install-singleton-config-2.xml
@@ -11,7 +11,7 @@
<vcpu cpuset="1,3-5">2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
- <loader readonly="yes" secure="no" type="rom">/tmp/foo</loader>
+ <loader readonly="yes" secure="no" type="rom" stateless="yes">/tmp/foo</loader>
<smbios mode="emulate"/>
<boot dev="network"/>
<boot dev="hd"/>
@@ -112,7 +112,7 @@
<vcpu cpuset="1,3-5">2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
- <loader readonly="yes" secure="no" type="rom">/tmp/foo</loader>
+ <loader readonly="yes" secure="no" type="rom" stateless="yes">/tmp/foo</loader>
<boot dev="hd"/>
<smbios mode="emulate"/>
</os>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 9d4e5ae3..3d299c12 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -832,7 +832,7 @@ c.add_compare("--pxe "
"--cpuset 1,3-5 " # setting compat --cpuset when --vcpus is not present
# --boot loader settings here, or they will conflict with firmware=efi
# in other test cases
-"--boot loader_ro=yes,loader.type=rom,loader=/tmp/foo,loader_secure=no "
+"--boot loader_ro=yes,loader.type=rom,loader=/tmp/foo,loader_secure=no,loader.stateless=yes"
# 'default' handling for solo devices
"""
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 5ac8266b..8dbffeb6 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2861,6 +2861,7 @@ class ParserBoot(VirtCLIParser):
cls.add_arg("loader.readonly", "loader_ro", is_onoff=True)
cls.add_arg("loader.type", "loader_type")
cls.add_arg("loader.secure", "loader_secure", is_onoff=True)
+ cls.add_arg("loader.stateless", "loader_stateless", is_onoff=True)
# Guest-Based bootloader options
cls.add_arg("firmware", "firmware")
diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index e2cea755..4310e623 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -86,6 +86,7 @@ class DomainOs(XMLBuilder):
_XML_PROP_ORDER = [
"firmware", "os_type", "arch", "machine", "firmware_features",
"loader", "loader_ro", "loader_secure", "loader_type",
+ "loader_stateless",
"nvram", "nvram_template",
"init", "initargs", "initenvs", "initdir", "inituser", "initgroup",
"kernel", "initrd", "kernel_args", "dtb", "acpi_tb", "acpi_tb_type",
@@ -100,6 +101,7 @@ class DomainOs(XMLBuilder):
loader_ro = XMLProperty("./loader/@readonly", is_yesno=True)
loader_type = XMLProperty("./loader/@type")
loader_secure = XMLProperty("./loader/@secure", is_yesno=True)
+ loader_stateless = XMLProperty("./loader/@stateless", is_yesno=True)
# BIOS bootloader options
def _get_bootorder(self):

View File

@ -0,0 +1,161 @@
Subject: diskbackend: Drop support for sheepdog
From: Lin Ma lma@suse.com Wed Nov 2 20:45:43 2022 +0800
Date: Mon Nov 7 10:10:00 2022 -0500:
Git: 4a2df064839f71ed94320771507b1271d041e397
The sheepdog project is no longer actively developed, Libvirt removed
the support for sheepdog storage backend since v8.8.0, Let's drop it.
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/tests/data/cli/compare/virt-xml-build-disk-domain.xml b/tests/data/cli/compare/virt-xml-build-disk-domain.xml
index 1a08b20e..6d9f7160 100644
--- a/tests/data/cli/compare/virt-xml-build-disk-domain.xml
+++ b/tests/data/cli/compare/virt-xml-build-disk-domain.xml
@@ -1,5 +1,5 @@
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/pool-dir/testvol1.img"/>
- <target dev="vdag" bus="virtio"/>
+ <target dev="vdaf" bus="virtio"/>
</disk>
diff --git a/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml b/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml
index 055a8f04..49c9bd4a 100644
--- a/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml
+++ b/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml
@@ -1,5 +1,5 @@
<disk type="volume" device="disk">
<driver name="qemu" type="raw"/>
<source volume="sdfg1" pool="pool-disk"/>
- <target dev="vdag" bus="virtio"/>
+ <target dev="vdaf" bus="virtio"/>
</disk>
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index 7c94e698..04476b22 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -294,26 +294,19 @@ Foo bar baz &amp; yeah boii &lt; &gt; yeahfoo
</source>
<target dev='vdac' bus='virtio'/>
</disk>
- <disk type='network' device='disk'>
- <driver name='qemu' type='raw'/>
- <source protocol='sheepdog' name='image,with,commas'>
- <host name='example.org' port='6000'/>
- </source>
- <target dev='vdad' bus='virtio'/>
- </disk>
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<source protocol='gluster' name='test-volume/test-gluster2.raw'>
<host name='192.168.1.100'/>
</source>
- <target dev='vdae' bus='virtio'/>
+ <target dev='vdad' bus='virtio'/>
</disk>
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<source protocol='nbd'>
<host transport='unix' socket='relative.sock'/>
</source>
- <target dev='vdaf' bus='virtio'/>
+ <target dev='vdae' bus='virtio'/>
</disk>
<!-- bus usb -->
@@ -2171,35 +2164,6 @@ ba</description>
</pool>
-<pool type='sheepdog'>
- <name>pool-sheepdog</name>
- <uuid>581381f8-a13f-4f7c-89b5-9c9b71c64834</uuid>
- <capacity unit='bytes'>107374182400</capacity>
- <allocation unit='bytes'>53687091200</allocation>
- <available unit='bytes'>53687091200</available>
- <source>
- <host name='localhost' port='7000'/>
- <name>mysheeppool</name>
- </source>
-
- <volume type='network'>
- <name>vol_sheepdog</name>
- <key>sheep/vol_sheepdog</key>
- <capacity unit='bytes'>1024</capacity>
- <allocation unit='bytes'>0</allocation>
- <target>
- <path>sheepdog:vol_sheepdog</path>
- <format type='unknown'/>
- <permissions>
- <mode>0600</mode>
- <owner>-1</owner>
- <group>-1</group>
- </permissions>
- </target>
- </volume>
-</pool>
-
-
<pool type='gluster'>
<name>pool-gluster</name>
<uuid>7b83ef6d-28da-44f1-841f-2011320f13b0</uuid>
diff --git a/virtManager/object/storagepool.py b/virtManager/object/storagepool.py
index 563526bb..1b4da515 100644
--- a/virtManager/object/storagepool.py
+++ b/virtManager/object/storagepool.py
@@ -32,7 +32,6 @@ POOL_TYPE_DESCS = {
StoragePool.TYPE_MPATH: _("Multipath Device Enumerator"),
StoragePool.TYPE_GLUSTER: _("Gluster Filesystem"),
StoragePool.TYPE_RBD: _("RADOS Block Device/Ceph"),
- StoragePool.TYPE_SHEEPDOG: _("Sheepdog Filesystem"),
StoragePool.TYPE_ZFS: _("ZFS Pool"),
}
@@ -128,7 +127,6 @@ class vmmStoragePool(vmmLibvirtObject):
]
if not clone:
supported.extend([
- StoragePool.TYPE_SHEEPDOG,
StoragePool.TYPE_ZFS,
])
return pool_type in supported
diff --git a/virtinst/storage.py b/virtinst/storage.py
index 509f5cb0..3c5d39bb 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -82,7 +82,6 @@ class StoragePool(_StorageObject):
TYPE_MPATH = "mpath"
TYPE_GLUSTER = "gluster"
TYPE_RBD = "rbd"
- TYPE_SHEEPDOG = "sheepdog"
TYPE_ZFS = "zfs"
@staticmethod
@@ -311,7 +310,7 @@ class StoragePool(_StorageObject):
def supports_source_name(self):
return self.type in [self.TYPE_LOGICAL, self.TYPE_GLUSTER,
- self.TYPE_RBD, self.TYPE_SHEEPDOG, self.TYPE_ZFS]
+ self.TYPE_RBD, self.TYPE_ZFS]
def supports_source_path(self):
@@ -323,7 +322,7 @@ class StoragePool(_StorageObject):
def supports_hosts(self):
return self.type in [
self.TYPE_NETFS, self.TYPE_ISCSI, self.TYPE_GLUSTER,
- self.TYPE_RBD, self.TYPE_SHEEPDOG]
+ self.TYPE_RBD]
def supports_format(self):
return self.type in [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_DISK]
@@ -340,8 +339,7 @@ class StoragePool(_StorageObject):
return StorageVolume.TYPE_BLOCK
if (self.type == StoragePool.TYPE_GLUSTER or
self.type == StoragePool.TYPE_RBD or
- self.type == StoragePool.TYPE_ISCSI or
- self.type == StoragePool.TYPE_SHEEPDOG):
+ self.type == StoragePool.TYPE_ISCSI):
return StorageVolume.TYPE_NETWORK
return StorageVolume.TYPE_FILE

View File

@ -0,0 +1,249 @@
Subject: Fix pylint/pycodestyle warnings with latest versions
From: Cole Robinson crobinso@redhat.com Tue Dec 13 10:51:14 2022 -0500
Date: Tue Dec 13 11:23:45 2022 -0500:
Git: bb1afaba29019605a240a57d6b3ca8eb36341d9b
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/setup.py b/setup.py
index b45d315a..4bf29f25 100755
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ import setuptools.command.install_egg_info
#
# Newer setuptools will transparently support 'import distutils' though.
# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
-import distutils.command.build # pylint: disable=wrong-import-order
+import distutils.command.build # pylint: disable=wrong-import-order,deprecated-module
SYSPREFIX = sysconfig.get_config_var("prefix")
diff --git a/tests/test_disk.py b/tests/test_disk.py
index ef065157..9127371b 100644
--- a/tests/test_disk.py
+++ b/tests/test_disk.py
@@ -82,6 +82,7 @@ def test_disk_dir_searchable(monkeypatch):
searchdata = virtinst.DeviceDisk.check_path_search(conn,
tmpdir + "/footest")
assert searchdata.uid == os.getuid()
+ # pylint: disable=use-implicit-booleaness-not-comparison
assert searchdata.fixlist == []
# Remove perms on the tmpdir, now it should report failures
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 0a8e33d3..aec48dd2 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -371,8 +371,8 @@ class vmmAddHardware(vmmGObjectUI):
msg = _("These changes will take effect after "
"the next guest shutdown.")
- dtype = (hotplug_err and
- Gtk.MessageType.WARNING or Gtk.MessageType.INFO)
+ dtype = (Gtk.MessageType.WARNING if hotplug_err else
+ Gtk.MessageType.INFO)
hotplug_msg = ""
if hotplug_err:
hotplug_msg += (hotplug_err[0] + "\n\n" +
@@ -1560,7 +1560,7 @@ class vmmAddHardware(vmmGObjectUI):
controller_num = [x for x in controllers if
(x.type == controller_type)]
if len(controller_num) > 0:
- index_new = max([x.index for x in controller_num]) + 1
+ index_new = max(x.index for x in controller_num) + 1
dev.index = index_new
dev.type = controller_type
diff --git a/virtManager/details/sshtunnels.py b/virtManager/details/sshtunnels.py
index 9afc1e13..cb7ca7c0 100644
--- a/virtManager/details/sshtunnels.py
+++ b/virtManager/details/sshtunnels.py
@@ -22,7 +22,7 @@ class ConnectionInfo(object):
"""
def __init__(self, conn, gdev):
self.gtype = gdev.type
- self.gport = gdev.port and str(gdev.port) or None
+ self.gport = str(gdev.port) if gdev.port else None
self.gsocket = (gdev.listens and gdev.listens[0].socket) or gdev.socket
self.gaddr = gdev.listen or "127.0.0.1"
self.gtlsport = gdev.tlsPort or None
diff --git a/virtManager/lib/statsmanager.py b/virtManager/lib/statsmanager.py
index 28495495..ece130ab 100644
--- a/virtManager/lib/statsmanager.py
+++ b/virtManager/lib/statsmanager.py
@@ -66,7 +66,7 @@ class _VMStatsList(vmmGObject):
expected = self.config.get_stats_history_length()
current = len(self._stats)
if current > expected: # pragma: no cover
- del(self._stats[expected:current])
+ del self._stats[expected:current]
def _calculate_rate(record_name):
ret = 0.0
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index 2d6f5bca..1570b952 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -1306,10 +1306,10 @@ class vmmDomain(vmmLibvirtObject):
def get_arch(self):
return self.get_xmlobj().os.arch
def get_init(self):
- import pipes
+ import shlex
init = self.get_xmlobj().os.init
initargs = " ".join(
- [pipes.quote(i.val) for i in self.get_xmlobj().os.initargs])
+ [shlex.quote(i.val) for i in self.get_xmlobj().os.initargs])
return init, initargs
def get_emulator(self):
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 8dbffeb6..7615f743 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -85,7 +85,7 @@ class VirtHelpFormatter(argparse.RawDescriptionHelpFormatter):
'''
oldwrap = None
- # pylint: disable=arguments-differ
+ # pylint: disable=arguments-differ,protected-access
def _split_lines(self, *args, **kwargs):
def return_default():
return argparse.RawDescriptionHelpFormatter._split_lines(
@@ -1690,7 +1690,7 @@ def convert_old_force(options):
if options.force:
if not options.check:
options.check = "all=off"
- del(options.force)
+ del options.force
class ParserCheck(VirtCLIParser):
@@ -2281,7 +2281,7 @@ class ParserCPU(VirtCLIParser):
policy = "disable"
if policy:
- del(self.optdict[key])
+ del self.optdict[key]
converted[policy].append(key[1:])
self.optdict.update(converted)
@@ -2753,7 +2753,7 @@ class ParserBoot(VirtCLIParser):
if cliname not in inst.BOOT_DEVICES:
continue
- del(self.optdict[cliname])
+ del self.optdict[cliname]
if cliname not in boot_order:
boot_order.append(cliname)
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index d22ce6a2..1b5b6bf6 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -334,7 +334,7 @@ class DomainCapabilities(XMLBuilder):
"""
Return True if we know how to setup UEFI for the passed arch
"""
- return self.arch in list(self._uefi_arch_patterns.keys())
+ return self.arch in self._uefi_arch_patterns
def supports_uefi_loader(self):
"""
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index ef695914..f9fcc3fa 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -32,7 +32,7 @@ def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
else:
# Previously known object
current[name] = origmap[name]
- del(origmap[name])
+ del origmap[name]
return (list(origmap.values()), list(new.values()), list(current.values()))
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 8fcc8ce1..130c8e28 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -67,7 +67,7 @@ def check_cdrom_option_error(options):
def convert_old_printxml(options):
if options.xmlstep:
options.xmlonly = options.xmlstep
- del(options.xmlstep)
+ del options.xmlstep
def convert_old_sound(options):
@@ -135,10 +135,10 @@ def convert_old_disks(options):
else:
_do_convert_old_disks(options)
- del(options.file_paths)
- del(options.disksize)
- del(options.sparse)
- del(options.nodisks)
+ del options.file_paths
+ del options.disksize
+ del options.sparse
+ del options.nodisks
log.debug("Distilled --disk options: %s", options.disk)
@@ -147,7 +147,7 @@ def convert_old_os_options(options):
return
log.warning(
_("--os-type is deprecated and does nothing. Please stop using it."))
- del(options.old_os_type)
+ del options.old_os_type
def convert_old_memory(options):
@@ -204,9 +204,9 @@ def convert_old_networks(options):
networks[idx] = networks[idx].replace(prefix + ":",
prefix + "=")
- del(options.mac)
- del(options.bridge)
- del(options.nonetworks)
+ del options.mac
+ del options.bridge
+ del options.nonetworks
options.network = networks
log.debug("Distilled --network options: %s", options.network)
@@ -224,7 +224,7 @@ def convert_old_graphics(options):
if graphics and (vnc or sdl or keymap or vncport or vnclisten):
fail(_("Cannot mix --graphics and old style graphical options"))
- optnum = sum([bool(g) for g in [vnc, nographics, sdl, graphics]])
+ optnum = sum(bool(g) for g in [vnc, nographics, sdl, graphics])
if optnum > 1:
raise ValueError(_("Can't specify more than one of VNC, SDL, "
"--graphics or --nographics"))
diff --git a/virtinst/xmlbuilder.py b/virtinst/xmlbuilder.py
index 07a9e319..dd78038e 100644
--- a/virtinst/xmlbuilder.py
+++ b/virtinst/xmlbuilder.py
@@ -262,9 +262,9 @@ class XMLProperty(_XMLPropertyBase):
self._is_onoff = is_onoff
self._do_abspath = do_abspath
- conflicts = sum([int(bool(i)) for i in
+ conflicts = sum(int(bool(i)) for i in
[self._is_bool, self._is_int,
- self._is_yesno, self._is_onoff]])
+ self._is_yesno, self._is_onoff])
if conflicts > 1:
raise xmlutil.DevError("Conflict property converter options.")
@@ -343,7 +343,7 @@ class XMLProperty(_XMLPropertyBase):
propstore = xmlbuilder._propstore
if self.propname in propstore:
- del(propstore[self.propname])
+ del propstore[self.propname]
propstore[self.propname] = val
def _nonxml_fget(self, xmlbuilder):

View File

@ -0,0 +1,19 @@
Subject: tests: cpio: set owner to 0:0
From: Weijia Wang 9713184+wegank@users.noreply.github.com Sat Aug 6 19:00:07 2022 +0000
Date: Tue Dec 13 13:45:16 2022 -0500:
Git: 75a25e37660c5578587f4a7a75917cf98d77cf7e
diff --git a/virtinst/install/installerinject.py b/virtinst/install/installerinject.py
index 0b2a9bc5..98d88cf8 100644
--- a/virtinst/install/installerinject.py
+++ b/virtinst/install/installerinject.py
@@ -20,7 +20,7 @@ def _run_initrd_commands(initrd, tempdir):
stderr=subprocess.PIPE,
cwd=tempdir)
cpio_proc = subprocess.Popen(['cpio', '--create', '--null', '--quiet',
- '--format=newc', '--owner=root:root'],
+ '--format=newc', '--owner=0:0'],
stdin=find_proc.stdout,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,

View File

@ -0,0 +1,28 @@
Subject: addhardware: Fix backtrace when controller.index is None
From: Cole Robinson crobinso@redhat.com Tue Dec 13 13:49:35 2022 -0500
Date: Tue Dec 13 13:49:35 2022 -0500:
Git: 67832d3097cd6451833c30452d6991896e05933c
When creating a new VM, in the customize wizard we can't depend on
index= value being set (virtinst doesn't do it for example).
For example, this causes a backtrace when adding two virtio-scsi
controllers via the Customize wizard, or adding an extra
virtio-scsi controller to an aarch64 CDROM install.
Reported-by: Charles Arnold <carnold@suse.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index aec48dd2..a1dd3261 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -1560,7 +1560,7 @@ class vmmAddHardware(vmmGObjectUI):
controller_num = [x for x in controllers if
(x.type == controller_type)]
if len(controller_num) > 0:
- index_new = max(x.index for x in controller_num) + 1
+ index_new = max(int(x.index or 0) for x in controller_num) + 1
dev.index = index_new
dev.type = controller_type

View File

@ -0,0 +1,492 @@
Subject: Clean up FileChooser usage a bit
From: Cole Robinson crobinso@redhat.com Tue Dec 13 15:09:35 2022 -0500
Date: Wed Dec 14 12:31:17 2022 -0500:
Git: cbc5b897077671a675faf48603d9714527d84c83
* Move browse_reason handling entirely into storagebrowser.py
* Open code some of the browse_local logic at the few callers
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index a1dd3261..df902374 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -1590,8 +1590,8 @@ class vmmAddHardware(vmmGObjectUI):
textent.set_text(path)
reason = (isdir and
- self.config.CONFIG_DIR_FS or
- self.config.CONFIG_DIR_IMAGE)
+ vmmStorageBrowser.REASON_FS or
+ vmmStorageBrowser.REASON_IMAGE)
if self._storagebrowser is None:
self._storagebrowser = vmmStorageBrowser(self.conn)
diff --git a/virtManager/config.py b/virtManager/config.py
index 8379697c..2c81b061 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -133,51 +133,6 @@ class _SettingsWrapper(object):
class vmmConfig(object):
- # key names for saving last used paths
- CONFIG_DIR_IMAGE = "image"
- CONFIG_DIR_ISO_MEDIA = "isomedia"
- CONFIG_DIR_FLOPPY_MEDIA = "floppymedia"
- CONFIG_DIR_SCREENSHOT = "screenshot"
- CONFIG_DIR_FS = "fs"
-
- # Metadata mapping for browse types. Prob shouldn't go here, but works
- # for now.
- browse_reason_data = {
- CONFIG_DIR_IMAGE: {
- "enable_create": True,
- "storage_title": _("Locate or create storage volume"),
- "local_title": _("Locate existing storage"),
- "dialog_type": Gtk.FileChooserAction.SAVE,
- "choose_button": Gtk.STOCK_OPEN,
- "gsettings_key": "image",
- },
-
- CONFIG_DIR_SCREENSHOT: {
- "gsettings_key": "screenshot",
- },
-
- CONFIG_DIR_ISO_MEDIA: {
- "enable_create": False,
- "storage_title": _("Locate ISO media volume"),
- "local_title": _("Locate ISO media"),
- "gsettings_key": "media",
- },
-
- CONFIG_DIR_FLOPPY_MEDIA: {
- "enable_create": False,
- "storage_title": _("Locate floppy media volume"),
- "local_title": _("Locate floppy media"),
- "gsettings_key": "media",
- },
-
- CONFIG_DIR_FS: {
- "enable_create": False,
- "storage_title": _("Locate directory volume"),
- "local_title": _("Locate directory volume"),
- "dialog_type": Gtk.FileChooserAction.SELECT_FOLDER,
- },
- }
-
CONSOLE_SCALE_NEVER = 0
CONSOLE_SCALE_FULLSCREEN = 1
CONSOLE_SCALE_ALWAYS = 2
@@ -627,23 +582,15 @@ class vmmConfig(object):
# Default directory location dealings
- def get_default_directory(self, conn, _type):
- ignore = conn
- browsedata = self.browse_reason_data.get(_type, {})
- key = browsedata.get("gsettings_key", None)
- path = None
-
- if key:
- path = self.conf.get("/paths/%s-default" % key)
-
- log.debug("directory for type=%s returning=%s", _type, path)
+ def get_default_directory(self, gsettings_key):
+ path = self.conf.get("/paths/%s-default" % gsettings_key)
+ log.debug("directory for gsettings_key=%s returning=%s",
+ gsettings_key, path)
return path
- def set_default_directory(self, folder, _type):
- browsedata = self.browse_reason_data.get(_type, {})
- key = browsedata.get("gsettings_key", None)
- if not key:
+ def set_default_directory(self, gsettings_key, folder):
+ if not folder or folder.startswith("/dev"):
return # pragma: no cover
-
- log.debug("saving directory for type=%s to %s", key, folder)
- self.conf.set("/paths/%s-default" % key, folder)
+ log.debug("saving directory for gsettings_key=%s to %s",
+ gsettings_key, folder)
+ self.conf.set("/paths/%s-default" % gsettings_key, folder)
diff --git a/virtManager/createpool.py b/virtManager/createpool.py
index 66457b51..a3e9a99a 100644
--- a/virtManager/createpool.py
+++ b/virtManager/createpool.py
@@ -381,9 +381,8 @@ class vmmCreatePool(vmmGObjectUI):
self._show_options_by_pool()
def _browse_source_cb(self, src):
- source = self.err.browse_local(self.conn,
+ source = self.err.browse_local(
_("Choose source path"),
- dialog_type=Gtk.FileChooserAction.OPEN,
start_folder="/dev")
if source:
self.widget("pool-source-path").get_child().set_text(source)
@@ -394,7 +393,7 @@ class vmmCreatePool(vmmGObjectUI):
if current:
startfolder = os.path.dirname(current)
- target = self.err.browse_local(self.conn,
+ target = self.err.browse_local(
_("Choose target directory"),
dialog_type=Gtk.FileChooserAction.SELECT_FOLDER,
start_folder=startfolder)
diff --git a/virtManager/createvm.py b/virtManager/createvm.py
index 7e5ded68..95aff71b 100644
--- a/virtManager/createvm.py
+++ b/virtManager/createvm.py
@@ -1280,11 +1280,11 @@ class vmmCreateVM(vmmGObjectUI):
def _browse_file(self, cbwidget, cb=None, is_media=False, is_dir=False):
if is_media:
- reason = self.config.CONFIG_DIR_ISO_MEDIA
+ reason = vmmStorageBrowser.REASON_ISO_MEDIA
elif is_dir:
- reason = self.config.CONFIG_DIR_FS
+ reason = vmmStorageBrowser.REASON_FS
else:
- reason = self.config.CONFIG_DIR_IMAGE
+ reason = vmmStorageBrowser.REASON_IMAGE
if cb:
callback = cb
diff --git a/virtManager/createvol.py b/virtManager/createvol.py
index 58453038..ea82964a 100644
--- a/virtManager/createvol.py
+++ b/virtManager/createvol.py
@@ -208,7 +208,7 @@ class vmmCreateVolume(vmmGObjectUI):
self._storage_browser.set_finish_cb(cb)
self._storage_browser.topwin.set_modal(self.topwin.get_modal())
self._storage_browser.set_browse_reason(
- self.config.CONFIG_DIR_IMAGE)
+ vmmStorageBrowser.REASON_IMAGE)
self._storage_browser.show(self.topwin)
diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index 757e18ad..1970d0aa 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -1089,7 +1089,7 @@ class vmmDetails(vmmGObjectUI):
def _browse_file(self, callback, reason=None):
if not reason:
- reason = self.config.CONFIG_DIR_IMAGE
+ reason = vmmStorageBrowser.REASON_IMAGE
if self.storage_browser is None:
self.storage_browser = vmmStorageBrowser(self.conn)
@@ -1235,9 +1235,9 @@ class vmmDetails(vmmGObjectUI):
def _disk_source_browse_clicked_cb(self, src):
disk = self._get_hw_row()[HW_LIST_COL_DEVICE]
if disk.is_floppy():
- reason = self.config.CONFIG_DIR_FLOPPY_MEDIA
+ reason = vmmStorageBrowser.REASON_FLOPPY_MEDIA
else:
- reason = self.config.CONFIG_DIR_ISO_MEDIA
+ reason = vmmStorageBrowser.REASON_ISO_MEDIA
def cb(ignore, path):
self._mediacombo.set_path(path)
diff --git a/virtManager/device/fsdetails.py b/virtManager/device/fsdetails.py
index b9956e1d..555c745a 100644
--- a/virtManager/device/fsdetails.py
+++ b/virtManager/device/fsdetails.py
@@ -268,8 +268,8 @@ class vmmFSDetails(vmmGObjectUI):
textent.set_text(path)
reason = (isdir and
- self.config.CONFIG_DIR_FS or
- self.config.CONFIG_DIR_IMAGE)
+ vmmStorageBrowser.REASON_FS or
+ vmmStorageBrowser.REASON_IMAGE)
if self._storage_browser is None:
self._storage_browser = vmmStorageBrowser(self.conn)
diff --git a/virtManager/error.py b/virtManager/error.py
index 8d78efae..593c89ca 100644
--- a/virtManager/error.py
+++ b/virtManager/error.py
@@ -3,6 +3,7 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
+import os
import sys
import textwrap
import traceback
@@ -231,49 +232,38 @@ class vmmErrorDialog(vmmGObject):
return response
- def browse_local(self, conn, dialog_name, start_folder=None,
+ def browse_local(self, dialog_name, start_folder=None,
_type=None, dialog_type=None,
- browse_reason=None,
- choose_button=None, default_name=None):
+ choose_button=None, default_name=None,
+ confirm_overwrite=False):
"""
Helper function for launching a filechooser
@dialog_name: String to use in the title bar of the filechooser.
- @conn: vmmConnection used by calling class
@start_folder: Folder the filechooser is viewing at startup
@_type: File extension to filter by (e.g. "iso", "png")
@dialog_type: Maps to FileChooserDialog 'action'
- @browse_reason: The vmmConfig.CONFIG_DIR* reason we are browsing.
- If set, this will override the 'folder' parameter with the gsettings
- value, and store the user chosen path.
"""
- import os
-
- # Initial setup
- overwrite_confirm = False
- dialog_type = dialog_type or Gtk.FileChooserAction.OPEN
-
- if dialog_type == Gtk.FileChooserAction.SAVE:
- if choose_button is None:
- choose_button = Gtk.STOCK_SAVE
- overwrite_confirm = True
-
+ if dialog_type is None:
+ dialog_type = Gtk.FileChooserAction.OPEN
if choose_button is None:
choose_button = Gtk.STOCK_OPEN
+ buttons = (Gtk.STOCK_CANCEL,
+ Gtk.ResponseType.CANCEL,
+ choose_button,
+ Gtk.ResponseType.ACCEPT)
+
fcdialog = Gtk.FileChooserDialog(title=dialog_name,
parent=self.get_parent(),
action=dialog_type,
- buttons=(Gtk.STOCK_CANCEL,
- Gtk.ResponseType.CANCEL,
- choose_button,
- Gtk.ResponseType.ACCEPT))
+ buttons=buttons)
fcdialog.set_default_response(Gtk.ResponseType.ACCEPT)
if default_name:
fcdialog.set_current_name(default_name)
- fcdialog.set_do_overwrite_confirmation(overwrite_confirm)
+ fcdialog.set_do_overwrite_confirmation(confirm_overwrite)
# Set file match pattern (ex. *.png)
if _type is not None:
@@ -289,11 +279,6 @@ class vmmErrorDialog(vmmGObject):
f.set_name(name)
fcdialog.set_filter(f)
- # Set initial dialog folder
- if browse_reason:
- start_folder = self.config.get_default_directory(
- conn, browse_reason)
-
if start_folder is not None:
if os.access(start_folder, os.R_OK):
fcdialog.set_current_folder(start_folder)
@@ -304,10 +289,6 @@ class vmmErrorDialog(vmmGObject):
ret = fcdialog.get_filename()
fcdialog.destroy()
- # Store the chosen directory in gsettings if necessary
- if ret and browse_reason and not ret.startswith("/dev"):
- self.config.set_default_directory(
- os.path.dirname(ret), browse_reason)
return ret
diff --git a/virtManager/storagebrowse.py b/virtManager/storagebrowse.py
index b5fa9a2e..c5a26519 100644
--- a/virtManager/storagebrowse.py
+++ b/virtManager/storagebrowse.py
@@ -4,6 +4,10 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
+import os
+
+from gi.repository import Gtk
+
from virtinst import log
from .lib import uiutil
@@ -11,15 +15,53 @@ from .baseclass import vmmGObjectUI
from .hoststorage import vmmHostStorage
+class _BrowseReasonMetadata:
+ def __init__(self, browse_reason):
+ self.enable_create = False
+ self.storage_title = None
+ self.local_title = None
+ self.gsettings_key = None
+ self.dialog_type = None
+
+ if browse_reason == vmmStorageBrowser.REASON_IMAGE:
+ self.enable_create = True
+ self.local_title = _("Locate existing storage")
+ self.storage_title = _("Locate or create storage volume")
+ self.dialog_type = Gtk.FileChooserAction.SAVE
+ self.gsettings_key = "image"
+
+ if browse_reason == vmmStorageBrowser.REASON_ISO_MEDIA:
+ self.local_title = _("Locate ISO media")
+ self.storage_title = _("Locate ISO media volume")
+ self.gsettings_key = "media"
+
+ if browse_reason == vmmStorageBrowser.REASON_FLOPPY_MEDIA:
+ self.local_title = _("Locate floppy media")
+ self.storage_title = _("Locate floppy media volume")
+ self.gsettings_key = "media"
+
+ if browse_reason == vmmStorageBrowser.REASON_FS:
+ self.local_title = _("Locate directory volume")
+ self.storage_title = _("Locate directory volume")
+ self.dialog_type = Gtk.FileChooserAction.SELECT_FOLDER
+
+ if browse_reason is None:
+ self.enable_create = True
+ self.storage_title = _("Choose Storage Volume")
+
+
class vmmStorageBrowser(vmmGObjectUI):
+ REASON_IMAGE = "image"
+ REASON_ISO_MEDIA = "isomedia"
+ REASON_FLOPPY_MEDIA = "floppymedia"
+ REASON_FS = "fs"
+
def __init__(self, conn):
vmmGObjectUI.__init__(self, "storagebrowse.ui", "vmm-storage-browse")
self.conn = conn
self._first_run = False
self._finish_cb = None
-
- # Passed to browse_local
self._browse_reason = None
self.storagelist = vmmHostStorage(self.conn, self.builder, self.topwin,
@@ -103,15 +145,10 @@ class vmmStorageBrowser(vmmGObjectUI):
def set_browse_reason(self, reason):
self._browse_reason = reason
- data = self.config.browse_reason_data.get(self._browse_reason, {})
- allow_create = True
- title = _("Choose Storage Volume")
- if data:
- allow_create = data["enable_create"]
- title = data["storage_title"]
+ data = _BrowseReasonMetadata(self._browse_reason)
- self.topwin.set_title(title)
- self.storagelist.widget("vol-add").set_sensitive(allow_create)
+ self.topwin.set_title(data.storage_title)
+ self.storagelist.widget("vol-add").set_sensitive(data.enable_create)
#############
@@ -128,7 +165,7 @@ class vmmStorageBrowser(vmmGObjectUI):
self._finish(volume.get_target_path())
def _vol_sensitive_cb(self, fmt):
- if ((self._browse_reason == self.config.CONFIG_DIR_FS) and
+ if ((self._browse_reason == vmmStorageBrowser.REASON_FS) and
fmt != 'dir'):
return False
return True
@@ -139,22 +176,27 @@ class vmmStorageBrowser(vmmGObjectUI):
####################
def _browse_local(self):
- dialog_type = None
- dialog_name = None
- choose_button = None
-
- data = self.config.browse_reason_data.get(self._browse_reason)
- if data:
- dialog_name = data["local_title"] or None
- dialog_type = data.get("dialog_type")
- choose_button = data.get("choose_button")
-
- filename = self.err.browse_local(self.conn,
- dialog_type=dialog_type, browse_reason=self._browse_reason,
- dialog_name=dialog_name, choose_button=choose_button)
- if filename:
- log.debug("Browse local chose path=%s", filename)
- self._finish(filename)
+ data = _BrowseReasonMetadata(self._browse_reason)
+ gsettings_key = data.gsettings_key
+
+ if gsettings_key:
+ start_folder = self.config.get_default_directory(gsettings_key)
+
+ filename = self.err.browse_local(
+ dialog_type=data.dialog_type,
+ dialog_name=data.local_title,
+ start_folder=start_folder)
+
+ if not filename:
+ return
+
+ log.debug("Browse local chose path=%s", filename)
+
+ if gsettings_key:
+ self.config.set_default_directory(
+ gsettings_key, os.path.dirname(filename))
+
+ self._finish(filename)
def _finish(self, path):
if self._finish_cb:
diff --git a/virtManager/vmwindow.py b/virtManager/vmwindow.py
index 3ac4a6a4..d5549454 100644
--- a/virtManager/vmwindow.py
+++ b/virtManager/vmwindow.py
@@ -548,24 +548,31 @@ class vmmVMWindow(vmmGObjectUI):
ret = ret.buffer # pragma: no cover
import datetime
+ import os
now = str(datetime.datetime.now()).split(".")[0].replace(" ", "_")
default = "Screenshot_%s_%s.png" % (self.vm.get_name(), now)
- path = self.err.browse_local(
- self.vm.conn, _("Save Virtual Machine Screenshot"),
+ start_folder = self.config.get_default_directory("screenshot")
+
+ filename = self.err.browse_local(
+ _("Save Virtual Machine Screenshot"),
_type=("png", _("PNG files")),
dialog_type=Gtk.FileChooserAction.SAVE,
- browse_reason=self.config.CONFIG_DIR_SCREENSHOT,
- default_name=default)
- if not path: # pragma: no cover
+ choose_button=Gtk.STOCK_SAVE,
+ start_folder=start_folder,
+ default_name=default,
+ confirm_overwrite=True)
+ if not filename: # pragma: no cover
log.debug("No screenshot path given, skipping save.")
return
- filename = path
if not filename.endswith(".png"):
filename += ".png" # pragma: no cover
open(filename, "wb").write(ret)
+ self.config.set_default_directory(
+ "screenshot", os.path.dirname(filename))
+
########################
# Details page refresh #

View File

@ -0,0 +1,51 @@
Subject: guest: Query availability of usb redirdevs in domcaps
From: Lin Ma lma@suse.com Thu Nov 10 15:57:08 2022 +0800
Date: Wed Dec 14 12:44:54 2022 -0500:
Git: 8cc6ee8da36d518ec928c072822bbee6ebe2e362
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 1b5b6bf6..91f51f9f 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -113,6 +113,7 @@ class _Devices(_CapsBlock):
graphics = XMLChildProperty(_make_capsblock("graphics"), is_single=True)
tpm = XMLChildProperty(_make_capsblock("tpm"), is_single=True)
filesystem = XMLChildProperty(_make_capsblock("filesystem"), is_single=True)
+ redirdev = XMLChildProperty(_make_capsblock("redirdev"), is_single=True)
class _Features(_CapsBlock):
@@ -448,6 +449,18 @@ class DomainCapabilities(XMLBuilder):
return self.devices.graphics.get_enum("type").has_value("spice")
+ def supports_redirdev_usb(self):
+ """
+ Return False if libvirt explicitly advertises no support for
+ USB redirect
+ """
+ if self.devices.redirdev.supported is None:
+ # Follow the original behavior in case of talking to older
+ # libvirt.
+ return True
+
+ return self.devices.redirdev.get_enum("bus").has_value("usb")
+
def supports_filesystem_virtiofs(self):
"""
Return True if libvirt advertises support for virtiofs
diff --git a/virtinst/guest.py b/virtinst/guest.py
index e6636022..1d1e2ee9 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -1155,6 +1155,8 @@ class Guest(XMLBuilder):
self.add_device(dev)
def _add_spice_usbredir(self):
+ if not self.lookup_domcaps().supports_redirdev_usb():
+ return
if self.skip_default_usbredir:
return
if self.devices.redirdev:

View File

@ -0,0 +1,51 @@
Subject: guest: Query availability of spicevmc channels in domcaps
From: Lin Ma lma@suse.com Thu Nov 10 15:57:24 2022 +0800
Date: Wed Dec 14 12:44:54 2022 -0500:
Git: 180154d752a33f6b26643184e6aa19dcb110e0eb
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 91f51f9f..db08bf65 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -114,6 +114,7 @@ class _Devices(_CapsBlock):
tpm = XMLChildProperty(_make_capsblock("tpm"), is_single=True)
filesystem = XMLChildProperty(_make_capsblock("filesystem"), is_single=True)
redirdev = XMLChildProperty(_make_capsblock("redirdev"), is_single=True)
+ channel = XMLChildProperty(_make_capsblock("channel"), is_single=True)
class _Features(_CapsBlock):
@@ -449,6 +450,18 @@ class DomainCapabilities(XMLBuilder):
return self.devices.graphics.get_enum("type").has_value("spice")
+ def supports_channel_spicevmc(self):
+ """
+ Return False if libvirt explicitly advertises no support for
+ spice channel
+ """
+ if self.devices.channel.supported is None:
+ # Follow the original behavior in case of talking to older
+ # libvirt.
+ return True
+
+ return self.devices.channel.get_enum("type").has_value("spicevmc")
+
def supports_redirdev_usb(self):
"""
Return False if libvirt explicitly advertises no support for
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 1d1e2ee9..c2244ae3 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -1127,6 +1127,8 @@ class Guest(XMLBuilder):
self.add_device(ctrl)
def _add_spice_channels(self):
+ if not self.lookup_domcaps().supports_channel_spicevmc():
+ return
if self.skip_default_channel:
return
for chn in self.devices.channel:

View File

@ -0,0 +1,20 @@
Subject: tests: Add domcaps coverage for usb-redir/spicevmc channel checks
From: Lin Ma lma@suse.com Thu Nov 10 15:57:43 2022 +0800
Date: Wed Dec 14 12:44:54 2022 -0500:
Git: c313209455b2c5fd34560f469af4737a6c8e6fdb
Signed-off-by: Lin Ma <lma@suse.com>
diff --git a/tests/test_capabilities.py b/tests/test_capabilities.py
index d102e51b..70c9de6f 100644
--- a/tests/test_capabilities.py
+++ b/tests/test_capabilities.py
@@ -92,6 +92,8 @@ def testDomainCapabilitiesx86():
assert caps.supports_filesystem_virtiofs()
assert caps.supports_memorybacking_memfd()
+ assert caps.supports_redirdev_usb()
+ assert caps.supports_channel_spicevmc()
xml = open(DATADIR + "/kvm-x86_64-domcaps-amd-sev.xml").read()
caps = DomainCapabilities(utils.URIs.open_testdriver_cached(), xml)

View File

@ -0,0 +1,264 @@
Subject: tests: Update to latest kvm domcaps
From: Cole Robinson crobinso@redhat.com Wed Dec 14 12:44:13 2022 -0500
Date: Wed Dec 14 12:45:05 2022 -0500:
Git: b5d6dfaa0dab6c65b3ae4264e62302f2d93a69d4
And add some test coverage exclusions, needed for previous patches
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/capabilities/kvm-x86_64-domcaps-latest.xml b/tests/data/capabilities/kvm-x86_64-domcaps-latest.xml
index ee586e1a..ebcc9ec4 100644
--- a/tests/data/capabilities/kvm-x86_64-domcaps-latest.xml
+++ b/tests/data/capabilities/kvm-x86_64-domcaps-latest.xml
@@ -1,7 +1,7 @@
<domainCapabilities>
<path>/usr/bin/qemu-system-x86_64</path>
<domain>kvm</domain>
- <machine>pc-q35-6.1</machine>
+ <machine>pc-q35-7.0</machine>
<arch>x86_64</arch>
<vcpu max='288'/>
<iothreads supported='yes'/>
@@ -12,6 +12,8 @@
<loader supported='yes'>
<value>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</value>
<value>/usr/share/edk2/ovmf/OVMF_CODE.fd</value>
+ <value>/usr/share/edk2/ovmf/OVMF.amdsev.fd</value>
+ <value>/usr/share/edk2/ovmf/OVMF.inteltdx.fd</value>
<enum name='type'>
<value>rom</value>
<value>pflash</value>
@@ -40,91 +42,91 @@
</enum>
</mode>
<mode name='host-model' supported='yes'>
- <model fallback='forbid'>Cooperlake</model>
+ <model fallback='forbid'>Skylake-Client-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='pdcm'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
- <feature policy='require' name='mpx'/>
+ <feature policy='require' name='clflushopt'/>
<feature policy='require' name='umip'/>
+ <feature policy='require' name='pku'/>
<feature policy='require' name='md-clear'/>
+ <feature policy='require' name='stibp'/>
+ <feature policy='require' name='arch-capabilities'/>
+ <feature policy='require' name='ssbd'/>
<feature policy='require' name='xsaves'/>
+ <feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='ibpb'/>
<feature policy='require' name='ibrs'/>
<feature policy='require' name='amd-stibp'/>
<feature policy='require' name='amd-ssbd'/>
+ <feature policy='require' name='rdctl-no'/>
+ <feature policy='require' name='ibrs-all'/>
+ <feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='mds-no'/>
+ <feature policy='require' name='pschange-mc-no'/>
<feature policy='disable' name='hle'/>
<feature policy='disable' name='rtm'/>
- <feature policy='disable' name='avx512f'/>
- <feature policy='disable' name='avx512dq'/>
- <feature policy='disable' name='clwb'/>
- <feature policy='disable' name='avx512cd'/>
- <feature policy='disable' name='avx512bw'/>
- <feature policy='disable' name='avx512vl'/>
- <feature policy='disable' name='avx512vnni'/>
- <feature policy='disable' name='avx-vnni'/>
- <feature policy='disable' name='avx512-bf16'/>
- <feature policy='disable' name='taa-no'/>
</mode>
<mode name='custom' supported='yes'>
- <model usable='yes'>qemu64</model>
- <model usable='yes'>qemu32</model>
- <model usable='no'>phenom</model>
- <model usable='yes'>pentium3</model>
- <model usable='yes'>pentium2</model>
- <model usable='yes'>pentium</model>
- <model usable='yes'>n270</model>
- <model usable='yes'>kvm64</model>
- <model usable='yes'>kvm32</model>
- <model usable='yes'>coreduo</model>
- <model usable='yes'>core2duo</model>
- <model usable='no'>athlon</model>
- <model usable='yes'>Westmere-IBRS</model>
- <model usable='yes'>Westmere</model>
- <model usable='no'>Snowridge</model>
- <model usable='no'>Skylake-Server-noTSX-IBRS</model>
- <model usable='no'>Skylake-Server-IBRS</model>
- <model usable='no'>Skylake-Server</model>
- <model usable='yes'>Skylake-Client-noTSX-IBRS</model>
- <model usable='no'>Skylake-Client-IBRS</model>
- <model usable='no'>Skylake-Client</model>
- <model usable='yes'>SandyBridge-IBRS</model>
- <model usable='yes'>SandyBridge</model>
- <model usable='yes'>Penryn</model>
- <model usable='no'>Opteron_G5</model>
- <model usable='no'>Opteron_G4</model>
- <model usable='no'>Opteron_G3</model>
- <model usable='yes'>Opteron_G2</model>
- <model usable='yes'>Opteron_G1</model>
- <model usable='yes'>Nehalem-IBRS</model>
- <model usable='yes'>Nehalem</model>
- <model usable='yes'>IvyBridge-IBRS</model>
- <model usable='yes'>IvyBridge</model>
- <model usable='no'>Icelake-Server-noTSX</model>
- <model usable='no'>Icelake-Server</model>
- <model usable='no' deprecated='yes'>Icelake-Client-noTSX</model>
- <model usable='no' deprecated='yes'>Icelake-Client</model>
- <model usable='yes'>Haswell-noTSX-IBRS</model>
- <model usable='yes'>Haswell-noTSX</model>
- <model usable='no'>Haswell-IBRS</model>
- <model usable='no'>Haswell</model>
- <model usable='no'>EPYC-Rome</model>
- <model usable='no'>EPYC-Milan</model>
- <model usable='no'>EPYC-IBPB</model>
- <model usable='no'>EPYC</model>
- <model usable='no'>Dhyana</model>
- <model usable='no'>Cooperlake</model>
- <model usable='yes'>Conroe</model>
- <model usable='no'>Cascadelake-Server-noTSX</model>
- <model usable='no'>Cascadelake-Server</model>
- <model usable='yes'>Broadwell-noTSX-IBRS</model>
- <model usable='yes'>Broadwell-noTSX</model>
- <model usable='no'>Broadwell-IBRS</model>
- <model usable='no'>Broadwell</model>
- <model usable='yes'>486</model>
+ <model usable='yes' vendor='unknown'>qemu64</model>
+ <model usable='yes' vendor='unknown'>qemu32</model>
+ <model usable='no' vendor='AMD'>phenom</model>
+ <model usable='yes' vendor='unknown'>pentium3</model>
+ <model usable='yes' vendor='unknown'>pentium2</model>
+ <model usable='yes' vendor='unknown'>pentium</model>
+ <model usable='yes' vendor='Intel'>n270</model>
+ <model usable='yes' vendor='unknown'>kvm64</model>
+ <model usable='yes' vendor='unknown'>kvm32</model>
+ <model usable='yes' vendor='Intel'>coreduo</model>
+ <model usable='yes' vendor='Intel'>core2duo</model>
+ <model usable='no' vendor='AMD'>athlon</model>
+ <model usable='yes' vendor='Intel'>Westmere-IBRS</model>
+ <model usable='yes' vendor='Intel'>Westmere</model>
+ <model usable='no' vendor='Intel'>Snowridge</model>
+ <model usable='no' vendor='Intel'>Skylake-Server-noTSX-IBRS</model>
+ <model usable='no' vendor='Intel'>Skylake-Server-IBRS</model>
+ <model usable='no' vendor='Intel'>Skylake-Server</model>
+ <model usable='yes' vendor='Intel'>Skylake-Client-noTSX-IBRS</model>
+ <model usable='no' vendor='Intel'>Skylake-Client-IBRS</model>
+ <model usable='no' vendor='Intel'>Skylake-Client</model>
+ <model usable='yes' vendor='Intel'>SandyBridge-IBRS</model>
+ <model usable='yes' vendor='Intel'>SandyBridge</model>
+ <model usable='yes' vendor='Intel'>Penryn</model>
+ <model usable='no' vendor='AMD'>Opteron_G5</model>
+ <model usable='no' vendor='AMD'>Opteron_G4</model>
+ <model usable='no' vendor='AMD'>Opteron_G3</model>
+ <model usable='yes' vendor='AMD'>Opteron_G2</model>
+ <model usable='yes' vendor='AMD'>Opteron_G1</model>
+ <model usable='yes' vendor='Intel'>Nehalem-IBRS</model>
+ <model usable='yes' vendor='Intel'>Nehalem</model>
+ <model usable='yes' vendor='Intel'>IvyBridge-IBRS</model>
+ <model usable='yes' vendor='Intel'>IvyBridge</model>
+ <model usable='no' vendor='Intel'>Icelake-Server-noTSX</model>
+ <model usable='no' vendor='Intel'>Icelake-Server</model>
+ <model usable='no' deprecated='yes' vendor='Intel'>Icelake-Client-noTSX</model>
+ <model usable='no' deprecated='yes' vendor='Intel'>Icelake-Client</model>
+ <model usable='yes' vendor='Intel'>Haswell-noTSX-IBRS</model>
+ <model usable='yes' vendor='Intel'>Haswell-noTSX</model>
+ <model usable='no' vendor='Intel'>Haswell-IBRS</model>
+ <model usable='no' vendor='Intel'>Haswell</model>
+ <model usable='no' vendor='AMD'>EPYC-Rome</model>
+ <model usable='no' vendor='AMD'>EPYC-Milan</model>
+ <model usable='no' vendor='AMD'>EPYC-IBPB</model>
+ <model usable='no' vendor='AMD'>EPYC</model>
+ <model usable='no' vendor='Hygon'>Dhyana</model>
+ <model usable='no' vendor='Intel'>Cooperlake</model>
+ <model usable='yes' vendor='Intel'>Conroe</model>
+ <model usable='no' vendor='Intel'>Cascadelake-Server-noTSX</model>
+ <model usable='no' vendor='Intel'>Cascadelake-Server</model>
+ <model usable='yes' vendor='Intel'>Broadwell-noTSX-IBRS</model>
+ <model usable='yes' vendor='Intel'>Broadwell-noTSX</model>
+ <model usable='no' vendor='Intel'>Broadwell-IBRS</model>
+ <model usable='no' vendor='Intel'>Broadwell</model>
+ <model usable='yes' vendor='unknown'>486</model>
</mode>
</cpu>
<memoryBacking supported='yes'>
@@ -161,6 +163,7 @@
<value>vnc</value>
<value>spice</value>
<value>egl-headless</value>
+ <value>dbus</value>
</enum>
</graphics>
<video supported='yes'>
@@ -191,10 +194,7 @@
<value>scsi</value>
</enum>
<enum name='capsType'/>
- <enum name='pciBackend'>
- <value>default</value>
- <value>vfio</value>
- </enum>
+ <enum name='pciBackend'/>
</hostdev>
<rng supported='yes'>
<enum name='model'>
@@ -224,7 +224,23 @@
<value>passthrough</value>
<value>emulator</value>
</enum>
+ <enum name='backendVersion'>
+ <value>1.2</value>
+ <value>2.0</value>
+ </enum>
</tpm>
+ <redirdev supported='yes'>
+ <enum name='bus'>
+ <value>usb</value>
+ </enum>
+ </redirdev>
+ <channel supported='yes'>
+ <enum name='type'>
+ <value>pty</value>
+ <value>unix</value>
+ <value>spicevmc</value>
+ </enum>
+ </channel>
</devices>
<features>
<gic supported='no'/>
@@ -233,6 +249,7 @@
<backingStoreInput supported='yes'/>
<backup supported='yes'/>
<sev supported='no'/>
+ <sgx supported='no'/>
</features>
</domainCapabilities>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index c2244ae3..123abfb2 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -1128,7 +1128,7 @@ class Guest(XMLBuilder):
def _add_spice_channels(self):
if not self.lookup_domcaps().supports_channel_spicevmc():
- return
+ return # pragma: no cover
if self.skip_default_channel:
return
for chn in self.devices.channel:
@@ -1158,7 +1158,7 @@ class Guest(XMLBuilder):
def _add_spice_usbredir(self):
if not self.lookup_domcaps().supports_redirdev_usb():
- return
+ return # pragma: no cover
if self.skip_default_usbredir:
return
if self.devices.redirdev:

View File

@ -0,0 +1,109 @@
Subject: progress: Fix showing correct final total
From: Cole Robinson crobinso@redhat.com Wed Dec 14 12:57:10 2022 -0500
Date: Wed Dec 14 13:01:48 2022 -0500:
Git: 4114fa1aa827b836d3a1d11c2ac2d367c9bb0463
Reproducer:
Reproducer:
./virt-install --connect test:///default \
--location tests/data/fakemedia/fake-f26-netinst.iso
Before:
Starting install...
Retrieving 'vmlinuz' | 0 B 00:00:00 ...
Retrieving 'initrd.img' | 0 B 00:00:00 ...
After:
Starting install...
Retrieving 'vmlinuz' | 9 B 00:00:00 ...
Retrieving 'initrd.img' | 9 B 00:00:00 ...
progress.end() currently only reports the total amount of bytes
that were last written to the UI. It should report the total amount
that's been passed to update().
Reported-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/meter/meter1.txt b/tests/data/meter/meter1.txt
index a3f7c7d2..7e154c97 100644
--- a/tests/data/meter/meter1.txt
+++ b/tests/data/meter/meter1.txt
@@ -9,4 +9,4 @@ Meter text test 20% [=== ] 413 B/s | 2.0 kB 00:19 ETA
Meter text test 40% [======- ] 731 B/s | 3.9 kB 00:08 ETA
-Meter text test | 3.9 kB 00:04 ...
+Meter text test | 4.4 kB 00:04 ...
diff --git a/tests/data/meter/meter2.txt b/tests/data/meter/meter2.txt
index 93e93dc3..7ccc3163 100644
--- a/tests/data/meter/meter2.txt
+++ b/tests/data/meter/meter2.txt
@@ -9,4 +9,4 @@ Meter text test 20% [=======
Meter text test 40% [============== ] 731 B/s | 3.9 kB 00:00:08 ETA
-Meter text test | 3.9 kB 00:00:04 ...
+Meter text test | 4.4 kB 00:00:04 ...
diff --git a/tests/data/meter/meter3.txt b/tests/data/meter/meter3.txt
index 474e40f7..6f66608f 100644
--- a/tests/data/meter/meter3.txt
+++ b/tests/data/meter/meter3.txt
@@ -4,4 +4,4 @@ Meter text test 67 B/s | 200 B 00:02
Meter text test 413 B/s | 2.0 kB 00:03
Meter text test 731 B/s | 3.9 kB 00:04
-Meter text test | 3.9 kB 00:04
+Meter text test | 4.4 kB 00:04
diff --git a/tests/data/meter/meter5.txt b/tests/data/meter/meter5.txt
index 1d232a5d..7142a971 100644
--- a/tests/data/meter/meter5.txt
+++ b/tests/data/meter/meter5.txt
@@ -9,4 +9,4 @@ Meter text test 1000% [================] 413 B/s | 2.0 kB --:-- ETA
Meter text test 2000% [================] 731 B/s | 3.9 kB --:-- ETA
-Meter text test | 3.9 kB 00:04 !!!
+Meter text test | 4.4 kB 00:04 !!!
diff --git a/tests/data/meter/meter6.txt b/tests/data/meter/meter6.txt
index 07d99bfd..dd5d3d47 100644
--- a/tests/data/meter/meter6.txt
+++ b/tests/data/meter/meter6.txt
@@ -9,4 +9,4 @@ Meter text test 100% [================] 413 B/s | 2.0 kB --:-- ETA
Meter text test 100% [================] 731 B/s | 3.9 kB --:-- ETA
-Meter text test | 3.9 kB 00:04
+Meter text test | 4.4 kB 00:04
diff --git a/tests/test_misc.py b/tests/test_misc.py
index aa610f4d..20f5a626 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -178,7 +178,9 @@ def test_misc_meter():
m.update(2000)
with unittest.mock.patch("time.time", return_value=5.0):
m.update(4000)
- with unittest.mock.patch("time.time", return_value=6.0):
+ with unittest.mock.patch("time.time", return_value=5.1):
+ m.update(4500)
+ with unittest.mock.patch("time.time", return_value=5.5):
m.end()
# Basic output testing
diff --git a/virtinst/_progresspriv.py b/virtinst/_progresspriv.py
index 5a31a18c..a035c9c4 100644
--- a/virtinst/_progresspriv.py
+++ b/virtinst/_progresspriv.py
@@ -112,10 +112,10 @@ class BaseMeter:
assert type(amount_read) is int
now = time.time()
+ self.last_amount_read = amount_read
+ self.re.update(amount_read, now)
if (not self.last_update_time or
(now >= self.last_update_time + self.update_period)):
- self.re.update(amount_read, now)
- self.last_amount_read = amount_read
self.last_update_time = now
self._do_update(amount_read)

View File

@ -0,0 +1,27 @@
Subject: virtinstall: Fix the allocating disk size printed by the progress bar
From: Toshiki Sonoda sonoda.toshiki@fujitsu.com Wed Nov 9 18:33:56 2022 +0900
Date: Wed Dec 14 13:07:26 2022 -0500:
Git: 39c7a443146433766e4e71e48ab59145c74924b3
When a sparse file is created during a disk allocation,
virt-install prints not the created disk size but a sparse file size.
Therefore, we fix to print the created disk size during disk allocation
instead of the size of the sparse file by updating the meter with the
self.capacity.
Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Signed-off-by: Haruka Ohata <ohata.haruka@fujitsu.com>
diff --git a/virtinst/storage.py b/virtinst/storage.py
index 3c5d39bb..f9a9f7a7 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -695,6 +695,7 @@ class StorageVolume(_StorageObject):
log.debug("Using vol create flags=%s", createflags)
vol = self.pool.createXML(xml, createflags)
+ meter.update(self.capacity)
meter.end()
log.debug("Storage volume '%s' install complete.", self.name)
return vol

View File

@ -0,0 +1,72 @@
Subject: virtinstall: Hide total_size in the progress bar if it doesn't need
From: Toshiki Sonoda sonoda.toshiki@fujitsu.com Wed Nov 9 18:33:57 2022 +0900
Date: Wed Dec 14 13:18:36 2022 -0500:
Git: 6ec00474a659158f20248d6af3771d1a12ddac7b
virt-install prints the total_size value to the progress bar even if it
is meaningless.
This value can be confusing to user, so for execute prosess that doesn't
copy files (total_size = 0B), we hide the total_size value.
For example, 'Creating domain...' doesn't need to print the total_size
value.
Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Signed-off-by: Haruka Ohata <ohata.haruka@fujitsu.com>
diff --git a/tests/data/meter/meter-zero.txt b/tests/data/meter/meter-zero.txt
new file mode 100644
index 00000000..fc81f21f
--- /dev/null
+++ b/tests/data/meter/meter-zero.txt
@@ -0,0 +1,4 @@
+
+Meter text test 100% [================] 0 B/s | 0 B --:-- ETA
+
+Meter text test | 00:02
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 20f5a626..2cabc338 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -224,6 +224,20 @@ def test_misc_meter():
out = meter.output.getvalue().replace("\r", "\n")
utils.diff_compare(out, os.path.join(utils.DATADIR, "meter", "meter6.txt"))
+ def _test_meter_zero(m, startval=0, text="Meter text test"):
+ with unittest.mock.patch("time.time", return_value=1.0):
+ m.start(text, startval)
+ with unittest.mock.patch("time.time", return_value=3.0):
+ m.update(0)
+ with unittest.mock.patch("time.time", return_value=3.1):
+ m.end()
+
+ # meter with size 0 and startval size 0
+ meter = _progresspriv.TextMeter(output=io.StringIO())
+ _test_meter_zero(meter, 0)
+ out = meter.output.getvalue().replace("\r", "\n")
+ utils.diff_compare(out, os.path.join(utils.DATADIR, "meter", "meter-zero.txt"))
+
# BaseMeter coverage
meter = _progresspriv.BaseMeter()
_test_meter_values(meter)
diff --git a/virtinst/_progresspriv.py b/virtinst/_progresspriv.py
index a035c9c4..207c6479 100644
--- a/virtinst/_progresspriv.py
+++ b/virtinst/_progresspriv.py
@@ -247,11 +247,15 @@ class TextMeter(BaseMeter):
tl = TerminalLine(8)
# For big screens, make it more readable.
use_hours = bool(tl.llen > 80)
- ui_size = tl.add(' | %5sB' % total_size)
ui_time = tl.add(' %s' % format_time(self.re.elapsed_time(),
use_hours))
ui_end, not_done = _term_add_end(tl, self.size, amount_read)
- dummy = not_done
+ if not not_done and amount_read == 0:
+ # Doesn't need to print total_size
+ ui_size = tl.add(' | %5s ' % ' ')
+ else:
+ ui_size = tl.add(' | %5sB' % total_size)
+
out = '\r%-*.*s%s%s%s\n' % (tl.rest(), tl.rest(), self.text,
ui_size, ui_time, ui_end)
self.output.write(out)

View File

@ -0,0 +1,24 @@
Subject: asyncjob: Fix backtrace when no cursor theme installed
From: Cole Robinson crobinso@redhat.com Thu Jan 19 11:13:56 2023 -0500
Date: Thu Jan 19 11:40:37 2023 -0500:
Git: cc4a39ea94f42bc92765eb3bb56e2b7f9198be67
Fixes: https://github.com/virt-manager/virt-manager/issues/479
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
index 32d9c0a1..46692ace 100644
--- a/virtManager/asyncjob.py
+++ b/virtManager/asyncjob.py
@@ -265,9 +265,7 @@ class vmmAsyncJob(vmmGObjectUI):
self.topwin.present()
if not self.cancel_cb and self.show_progress:
- gdk_window = self.topwin.get_window()
- gdk_window.set_cursor(
- Gdk.Cursor.new_from_name(gdk_window.get_display(), "progress"))
+ self._set_cursor("progress")
self._bg_thread.start()

View File

@ -0,0 +1,19 @@
Subject: asyncjob: Remove unused import
From: Cole Robinson crobinso@redhat.com Thu Jan 19 11:59:20 2023 -0500
Date: Thu Jan 19 11:59:20 2023 -0500:
Git: fe86f4639f6e055f1e107fed9e0eb8be3fb2a66f
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
index 46692ace..958320b2 100644
--- a/virtManager/asyncjob.py
+++ b/virtManager/asyncjob.py
@@ -7,7 +7,6 @@
import threading
import traceback
-from gi.repository import Gdk
from gi.repository import GLib
import libvirt

View File

@ -0,0 +1,36 @@
Subject: Packit: initial enablement
From: Lokesh Mandvekar lsm5@fedoraproject.org Mon Dec 5 17:14:30 2022 +0530
Date: Thu Jan 19 14:04:42 2023 -0500:
Git: a63b40aae3835a8b82b23755f1ed45e526af80f9
This commit enables Packit `copr_build` tasks which will run on every PR
and build RPMS using the spec file present upstream with Source0 as
the archive created from HEAD commit of the PR.
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
diff --git a/.packit.yaml b/.packit.yaml
new file mode 100644
index 00000000..15798fe9
--- /dev/null
+++ b/.packit.yaml
@@ -0,0 +1,19 @@
+# See the documentation for more information:
+# https://packit.dev/docs/configuration/
+
+upstream_package_name: virt-manager
+downstream_package_name: virt-manager
+
+specfile_path: virt-manager.spec
+
+jobs:
+ - job: copr_build
+ # Run on every PR
+ trigger: pull_request
+ # Defaults to x86_64 unless architecture is explicitly specified
+ targets:
+ - fedora-rawhide-aarch64
+ - fedora-rawhide-i386
+ - fedora-rawhide-ppc64le
+ - fedora-rawhide-s390x
+ - fedora-rawhide-x86_64

View File

@ -0,0 +1,31 @@
Subject: virt-install: Recommend '--boot uefi'
From: Andrea Bolognani abologna@redhat.com Mon Dec 12 19:32:32 2022 +0100
Date: Thu Feb 9 11:41:00 2023 -0500:
Git: f2b5aaf458764ec7ecf105038e5f2f7cc26b6c17
Firmware autoselection is the way to go in most cases, so
recommend that instead of telling users that they should provide
all information manually.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
diff --git a/man/virt-install.rst b/man/virt-install.rst
index 3a6e8dcd..684f2265 100644
--- a/man/virt-install.rst
+++ b/man/virt-install.rst
@@ -955,13 +955,13 @@ Some examples:
Configure the VM to boot from UEFI. In order for virt-install to know the
correct UEFI parameters, libvirt needs to be advertising known UEFI binaries
via domcapabilities XML, so this will likely only work if using properly
- configured distro packages.
+ configured distro packages. This is the recommended UEFI setup.
``--boot loader=/.../OVMF_CODE.fd,loader.readonly=yes,loader.type=pflash,nvram.template=/.../OVMF_VARS.fd,loader_secure=no``
Specify that the virtual machine use the custom OVMF binary as boot firmware,
mapped as a virtual flash chip. In addition, request that libvirt instantiate
the VM-specific UEFI varstore from the custom "/.../OVMF_VARS.fd" varstore
- template. This is the recommended UEFI setup, and should be used if
+ template. This setup is not recommended, and should only be used if
--boot uefi doesn't know about your UEFI binaries. If your UEFI firmware
supports Secure boot feature you can enable it via loader_secure.

View File

@ -0,0 +1,51 @@
Subject: virt-install: Document Secure Boot setups
From: Andrea Bolognani abologna@redhat.com Mon Dec 12 19:38:22 2022 +0100
Date: Thu Feb 9 11:41:00 2023 -0500:
Git: 33ff193ee9fcfdb74f95d946a1b93239a1a12a61
Provide ready to use recipes for explicitly enabling and
explicitly disabling Secure Boot, as well as a pointer to
the more extensive information found on the libvirt website.
Setting loader_secure=yes is only one part of a proper Secure
Boot setup, so stop documenting it in the section about manual
firmware selection to avoid confusion.
https://bugzilla.redhat.com/show_bug.cgi?id=2112154
https://bugzilla.redhat.com/show_bug.cgi?id=2149971
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
diff --git a/man/virt-install.rst b/man/virt-install.rst
index 684f2265..a0df7328 100644
--- a/man/virt-install.rst
+++ b/man/virt-install.rst
@@ -957,13 +957,26 @@ Some examples:
via domcapabilities XML, so this will likely only work if using properly
configured distro packages. This is the recommended UEFI setup.
+``--boot uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=yes,firmware.feature1.name=enrolled-keys,firmware.feature1.enabled=yes``
+ Configure the VM to boot from UEFI with Secure Boot support enabled.
+ Only signed operating systems will be able to boot with this configuration.
+
+``--boot uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no``
+ Configure the VM to boot from UEFI with Secure Boot support disabled.
+ This configuration allows both signed and unsigned operating systems to
+ run.
+
+ Additional information about the ``secure-boot`` and
+ ``enrolled-keys`` firmware features and how they can be used to
+ influence firmware selection is available at
+ https://libvirt.org/kbase/secureboot.html
+
``--boot loader=/.../OVMF_CODE.fd,loader.readonly=yes,loader.type=pflash,nvram.template=/.../OVMF_VARS.fd,loader_secure=no``
Specify that the virtual machine use the custom OVMF binary as boot firmware,
mapped as a virtual flash chip. In addition, request that libvirt instantiate
the VM-specific UEFI varstore from the custom "/.../OVMF_VARS.fd" varstore
template. This setup is not recommended, and should only be used if
- --boot uefi doesn't know about your UEFI binaries. If your UEFI firmware
- supports Secure boot feature you can enable it via loader_secure.
+ --boot uefi doesn't know about your UEFI binaries.
Use --boot=? to see a list of all available sub options.
Complete details at https://libvirt.org/formatdomain.html#elementsOS

View File

@ -0,0 +1,97 @@
Subject: cloner: clone serial files
From: Oleg Vasilev oleg.vasilev@virtuozzo.com Wed Nov 30 22:01:08 2022 +0600
Date: Wed Mar 22 17:44:06 2023 -0400:
Git: b2f6e953831aba9ab7cc4b8673c237c3bb434100
Before this, on clone the serial file would remain the same for the cloned
domain. This doesn't make much sense as the output would be an intermix of two
unrelated output sequences.
Here we apply the the same filename changing algorithm, as with disk files.
Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
diff --git a/virtinst/cloner.py b/virtinst/cloner.py
index 9334513c..556bfdbb 100644
--- a/virtinst/cloner.py
+++ b/virtinst/cloner.py
@@ -9,6 +9,7 @@
import re
import os
+from itertools import chain
import libvirt
@@ -20,6 +21,7 @@ from .devices import DeviceInterface
from .devices import DeviceDisk
from .logger import log
from .devices import DeviceChannel
+from .devices import DeviceSerial
def _replace_vm(conn, name):
@@ -70,9 +72,9 @@ def _generate_clone_name(conn, basename):
sep="", start_num=start_num, force_num=force_num)
-def _generate_clone_disk_path(conn, origname, newname, origpath):
+def _generate_clone_path(origname, newname, origpath, cb_exists):
"""
- Generate desired cloned disk path name, derived from the
+ Generate desired cloned path for auxiliary files, derived from the
original path, original VM name, and proposed new VM name
"""
if origpath is None:
@@ -99,9 +101,7 @@ def _generate_clone_disk_path(conn, origname, newname, origpath):
clonebase = newname
clonebase = os.path.join(dirname, clonebase)
- def cb(p):
- return DeviceDisk.path_definitely_exists(conn, p)
- return generatename.generate_name(clonebase, cb, suffix=suffix)
+ return generatename.generate_name(clonebase, cb_exists, suffix=suffix)
def _lookup_vm(conn, name):
@@ -287,7 +287,9 @@ class Cloner(object):
@staticmethod
def generate_clone_disk_path(conn, origname, newname, origpath):
- return _generate_clone_disk_path(conn, origname, newname, origpath)
+ def cb_exists(p):
+ return DeviceDisk.path_definitely_exists(conn, p)
+ return _generate_clone_path(origname, newname, origpath, cb_exists)
@staticmethod
def build_clone_disk(orig_disk, clonepath, allow_create, sparse):
@@ -455,6 +457,21 @@ class Cloner(object):
# Functional methods #
######################
+ def _prepare_serial_files(self):
+ for serial in chain(self._new_guest.devices.console,
+ self._new_guest.devices.serial):
+ if serial.type != DeviceSerial.TYPE_FILE:
+ continue
+
+ def cb_exists(path):
+ # Ignore the check for now
+ return False
+
+ serial.source.path = _generate_clone_path(self.src_name,
+ self.new_guest.name,
+ serial.source.path,
+ cb_exists=cb_exists)
+
def _prepare_nvram(self):
if not self._nvram_diskinfo:
return
@@ -534,6 +551,7 @@ class Cloner(object):
xmldisk.set_source_path(new_disk.get_source_path())
self._prepare_nvram()
+ self._prepare_serial_files()
# Save altered clone xml
diff = xmlutil.diff(self._src_guest.get_xml(),

View File

@ -0,0 +1,114 @@
Subject: tests: cli: test serial file clone
From: Oleg Vasilev oleg.vasilev@virtuozzo.com Thu Dec 1 19:52:47 2022 +0600
Date: Wed Mar 22 17:44:06 2023 -0400:
Git: 77695484117b6a931041454865277e898c0fe5f6
Previous commit added serial file clone, now we test it.
Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
--- /dev/null
+++ b/tests/data/cli/compare/virt-clone-serial.xml
@@ -0,0 +1,31 @@
+<domain type="test">
+ <name>__virtinst_cli_test-clone1</name>
+ <uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <memory>8388608</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="i686">hvm</type>
+ <boot dev="hd"/>
+ </os>
+ <clock offset="utc"/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <serial type="file">
+ <source path="/tmp/__virtinst_cli_test-clone1.file">
+ <seclabel model="dac" relabel="no"/>
+ </source>
+ </serial>
+ <serial type="file">
+ <source path="/tmp/__virtinst_cli_other-serial-clone.file"/>
+ </serial>
+ <serial type="unix">
+ <source mode="connect" path="/tmp/__virtinst_cli_socket.sock"/>
+ </serial>
+ <console type="file">
+ <source path="/tmp/__virtinst_cli_serial-exists-clone.file"/>
+ </console>
+ </devices>
+</domain>
--- /dev/null
+++ b/tests/data/cli/virtclone/clone-serial.xml
@@ -0,0 +1,31 @@
+<domain type="test">
+ <name>__virtinst_cli_test-clone</name>
+ <uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <memory>8388608</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="i686">hvm</type>
+ <boot dev="hd"/>
+ </os>
+ <clock offset="utc"/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <serial type="file">
+ <source path="/tmp/__virtinst_cli_test-clone.file">
+ <seclabel model="dac" relabel="no"/>
+ </source>
+ </serial>
+ <serial type="file">
+ <source path="/tmp/__virtinst_cli_other-serial.file"/>
+ </serial>
+ <serial type="unix">
+ <source mode="connect" path="/tmp/__virtinst_cli_socket.sock"/>
+ </serial>
+ <console type="file">
+ <source path="/tmp/__virtinst_cli_serial-exists.file"/>
+ </console>
+ </devices>
+</domain>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -52,12 +52,18 @@ NEW_FILES = [
TMP_IMAGE_DIR + "new3.img",
TMP_IMAGE_DIR + "exist1-clone.img",
TMP_IMAGE_DIR + "exist2-clone.img",
+
+ TMP_IMAGE_DIR + "test-clone1.file",
+ TMP_IMAGE_DIR + "other-serial-clone.file",
+ TMP_IMAGE_DIR + "serial-exists-clone-1.file",
]
# Images that are expected to exist before a command is run
EXIST_FILES = [
TMP_IMAGE_DIR + "exist1.img",
TMP_IMAGE_DIR + "exist2.img",
+
+ TMP_IMAGE_DIR + "serial-exists-clone.file",
]
@@ -1491,6 +1497,7 @@ _CLONE_NVRAM_MISSING = "--original-xml %
_CLONE_EMPTY = "--original-xml %s/clone-empty.xml" % _CLONEXMLDIR
_CLONE_NET_RBD = "--original-xml %s/clone-net-rbd.xml" % _CLONEXMLDIR
_CLONE_NET_HTTP = "--original-xml %s/clone-net-http.xml" % _CLONEXMLDIR
+_CLONE_SERIAL = "--original-xml %s/clone-serial.xml" % _CLONEXMLDIR
vclon = App("virt-clone")
@@ -1514,6 +1521,7 @@ c.add_compare(_CLONE_EMPTY + " --auto-cl
c.add_compare("--connect %(URI-KVM-X86)s -o test-clone-simple --auto -f /foo.img --print-xml", "pool-test-cross-pool") # cross pool cloning which fails with test driver but let's confirm the XML
c.add_compare(_CLONE_MANAGED + " --auto-clone", "auto-managed") # Auto flag w/ managed storage
c.add_compare(_CLONE_UNMANAGED + " --auto-clone", "auto-unmanaged") # Auto flag w/ local storage
+c.add_compare(_CLONE_SERIAL + " --auto-clone", "serial") # Auto flag w/ serial console
c.add_valid("--connect %(URI-TEST-FULL)s -o test-clone --auto-clone --nonsparse") # Auto flag, actual VM, skip state check
c.add_valid("--connect %(URI-TEST-FULL)s -o test-clone-simple -n newvm --preserve-data --file %(EXISTIMG1)s") # Preserve data shouldn't complain about existing volume
c.add_valid("-n clonetest " + _CLONE_UNMANAGED + " --file %(EXISTIMG3)s --file %(EXISTIMG4)s --check path_exists=off") # Skip existing file check

View File

@ -0,0 +1,32 @@
Subject: man/virt-install: Add a note about different behavior of --boot on s390x
From: Thomas Huth thuth@redhat.com Tue Jan 31 12:35:49 2023 +0100
Date: Wed Mar 22 17:45:31 2023 -0400:
Git: 102fe52165535f9da9c9f370c6d1c399458ed4dc
It is common on x86 and other architectures to install a guest from
network by using "--boot hd,network" with virt-install - as long as
the hard disk is not bootable yet, the installation will be started
via network, and once it finished, the guest can boot from hd during
the next reboot.
However, this does not work on s390x since this architecture only
supports one single boot device to be passed to the guest. Thus add
a note to the documentation to avoid that people are running again
into this common pitfall.
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2032472
Signed-off-by: Thomas Huth <thuth@redhat.com>
diff --git a/man/virt-install.rst b/man/virt-install.rst
index a0df7328..8959df7c 100644
--- a/man/virt-install.rst
+++ b/man/virt-install.rst
@@ -929,6 +929,8 @@ Some examples:
``--boot cdrom,fd,hd,network``
Set the boot device priority as first cdrom, first floppy, first harddisk,
network PXE boot.
+ Note: s390x guests only support one boot device, so everything except
+ the first device type will be ignored.
``--boot kernel=KERNEL,initrd=INITRD,kernel_args="console=/dev/ttyS0"``
Have guest permanently boot off a local kernel/initrd pair, with the

View File

@ -0,0 +1,20 @@
Subject: tests: uitests: Fix window reposition on f38
From: Cole Robinson crobinso@redhat.com Fri May 5 14:54:31 2023 -0400
Date: Fri May 5 14:54:31 2023 -0400:
Git: 909c8aa880396fecb3e1fa174bdf89ce5e8b36c8
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/lib/app.py b/tests/uitests/lib/app.py
index 221808d0..83628a7f 100644
--- a/tests/uitests/lib/app.py
+++ b/tests/uitests/lib/app.py
@@ -222,7 +222,7 @@ class VMMDogtailApp(object):
# Give time for the child window to appear and possibly grab focus
self.sleep(1)
self.get_manager(check_active=False)
- dogtail.rawinput.drag(childwin.title_coordinates(), (1000, 1000))
+ dogtail.rawinput.dragWithTrajectory(childwin.title_coordinates(), (1000, 1000))
self.manager_conn_disconnect(conn_label)
utils.check(lambda: not childwin.showing)

View File

@ -0,0 +1,28 @@
Subject: tests: livetests: work around qemu media change regression
From: Cole Robinson crobinso@redhat.com Fri May 5 15:47:25 2023 -0400
Date: Fri May 5 15:47:25 2023 -0400:
Git: 7f83d23f4fd0772acd5eab2145667686770dfd9d
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_livetests.py b/tests/uitests/test_livetests.py
index 3ac0133b..72a96a10 100644
--- a/tests/uitests/test_livetests.py
+++ b/tests/uitests/test_livetests.py
@@ -471,9 +471,16 @@ def _testLiveHotplug(app, fname):
lib.utils.check(lambda: tab.showing)
entry.set_text(fname)
appl.click()
+ # F38 CDROM change is broken:
+ # https://gitlab.com/qemu-project/qemu/-/issues/933
+ # pylint: disable=unreachable
+ app.click_alert_button("changes will take effect", "OK")
+ return
+
lib.utils.check(lambda: not appl.sensitive)
lib.utils.check(lambda: entry.text == fname)
entry.click_secondary_icon()
+
appl.click()
lib.utils.check(lambda: not appl.sensitive)
lib.utils.check(lambda: not entry.text)

View File

@ -0,0 +1,33 @@
Subject: tests: uitests: Fix manager window repositioning test
From: Cole Robinson crobinso@redhat.com Fri May 5 15:36:26 2023 -0400
Date: Fri May 5 15:48:24 2023 -0400:
Git: 6030049cd7e24f59581b818c5da53665d0a76d6c
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_manager.py b/tests/uitests/test_manager.py
index 40329022..b01c3691 100644
--- a/tests/uitests/test_manager.py
+++ b/tests/uitests/test_manager.py
@@ -228,15 +228,17 @@ def testManagerWindowReposition(app):
fmenu.find("View Manager", "menu item").click()
lib.utils.check(lambda: manager.active)
- manager.window_maximize()
- newx = manager.position[0]
- newy = manager.position[1]
+ curxy = manager.title_coordinates()
+ newxy = curxy[0] + 200, curxy[1] + 200
+ import dogtail.rawinput
+ dogtail.rawinput.dragWithTrajectory(curxy, newxy)
+ checkxy = manager.position
manager.window_close()
host.click_title()
host.find("File", "menu").click()
host.find("View Manager", "menu item").click()
lib.utils.check(lambda: manager.showing)
- assert manager.position == (newx, newy)
+ assert manager.position == checkxy

View File

@ -0,0 +1,22 @@
Subject: tests: Default --uitests to --verbosity=2
From: Cole Robinson crobinso@redhat.com Sat May 6 16:50:20 2023 -0400
Date: Sat May 6 16:50:20 2023 -0400:
Git: a9cf4945b1dcd45fb205c4adc6f555f2fc47ecfa
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/conftest.py b/tests/conftest.py
index 3d1ca7d1..4a0fc1a0 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -40,6 +40,10 @@ def pytest_addoption(parser):
def pytest_ignore_collect(path, config):
uitests_requested = config.getoption("--uitests")
+ # Default --uitests to --verbosity=2
+ if uitests_requested:
+ config.option.verbose = max(2, config.option.verbose)
+
# Unless explicitly requested, ignore these tests
if "test_dist.py" in str(path):
return True

View File

@ -0,0 +1,31 @@
Subject: uitests: Make hotplug test pass on both f37 and f38
From: Cole Robinson crobinso@redhat.com Sat May 6 13:13:22 2023 -0400
Date: Sat May 6 19:43:24 2023 -0400:
Git: 75422ec75efe254beb8dc85f75715d71fa3ec859
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_livetests.py b/tests/uitests/test_livetests.py
index 72a96a10..55c9066b 100644
--- a/tests/uitests/test_livetests.py
+++ b/tests/uitests/test_livetests.py
@@ -471,11 +471,15 @@ def _testLiveHotplug(app, fname):
lib.utils.check(lambda: tab.showing)
entry.set_text(fname)
appl.click()
- # F38 CDROM change is broken:
- # https://gitlab.com/qemu-project/qemu/-/issues/933
# pylint: disable=unreachable
- app.click_alert_button("changes will take effect", "OK")
- return
+ import dogtail.tree
+ try:
+ # F38 CDROM change is broken:
+ # https://gitlab.com/qemu-project/qemu/-/issues/933
+ app.click_alert_button("changes will take effect", "OK")
+ return
+ except dogtail.tree.SearchError:
+ pass
lib.utils.check(lambda: not appl.sensitive)
lib.utils.check(lambda: entry.text == fname)

View File

@ -0,0 +1,38 @@
Subject: uitests: More attempts at making manager reposition test reliable
From: Cole Robinson crobinso@redhat.com Sat May 6 13:34:13 2023 -0400
Date: Sat May 6 19:43:24 2023 -0400:
Git: 509c95ddb9b3f30ea88a61b065cd920055faa5f4
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_manager.py b/tests/uitests/test_manager.py
index b01c3691..10709f09 100644
--- a/tests/uitests/test_manager.py
+++ b/tests/uitests/test_manager.py
@@ -228,17 +228,21 @@ def testManagerWindowReposition(app):
fmenu.find("View Manager", "menu item").click()
lib.utils.check(lambda: manager.active)
+ # Use alt+f7 combo to move window
curxy = manager.title_coordinates()
- newxy = curxy[0] + 200, curxy[1] + 200
- import dogtail.rawinput
- dogtail.rawinput.dragWithTrajectory(curxy, newxy)
- checkxy = manager.position
+ newxy = (curxy[0] + 400, curxy[1] + 400)
+ manager.keyCombo("<alt>F7")
+ app.rawinput.click(*newxy)
+ checkxy = manager.position[0], manager.position[1]
manager.window_close()
host.click_title()
host.find("File", "menu").click()
host.find("View Manager", "menu item").click()
lib.utils.check(lambda: manager.showing)
- assert manager.position == checkxy
+
+ # Results can be off by one or two, but it's not a virt-manager bug
+ assert abs(manager.position[0] - checkxy[0]) in range(3)
+ assert abs(manager.position[1] - checkxy[1]) in range(3)

View File

@ -0,0 +1,47 @@
Subject: tests: uitests: make menu operations more robust
From: Cole Robinson crobinso@redhat.com Sat May 6 17:01:44 2023 -0400
Date: Sat May 6 19:43:24 2023 -0400:
Git: 64bd6ba53e383c941df226bbb7f066b0a363d070
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/lib/_node.py b/tests/uitests/lib/_node.py
index 1c6cf107..ad95ff02 100644
--- a/tests/uitests/lib/_node.py
+++ b/tests/uitests/lib/_node.py
@@ -221,24 +221,29 @@ class _VMMDogtailNode(dogtail.tree.Node):
clickX, clickY = self.title_coordinates()
dogtail.rawinput.click(clickX, clickY, button)
+ def is_menuitem(self):
+ submenu = (self.roleName == "menu" and
+ (not self.accessible_parent or
+ self.accessible_parent.roleName == "menu"))
+ return submenu or self.roleName == "menu item"
+
def click(self, *args, **kwargs):
"""
- click wrapper, give up to a second for widget to appear on
- screen, helps reduce some test flakiness
+ click wrapper, check some states first to reduce flakiness
"""
# pylint: disable=arguments-differ,signature-differs
self.check_onscreen()
self.check_sensitive()
+ if self.is_menuitem():
+ self.point()
super().click(*args, **kwargs)
def point(self, *args, **kwargs):
# pylint: disable=signature-differs
super().point(*args, **kwargs)
- if (self.roleName == "menu" and
- self.accessible_parent.roleName == "menu"):
- # Widget is a submenu, make sure the item is in selected
- # state before we return
+ if self.is_menuitem():
+ # Make sure item is selected before we return to caller
utils.check(lambda: self.state_selected)
def set_text(self, text):

View File

@ -0,0 +1,20 @@
Subject: rpm: convert license to SPDX format
From: Daniel P. Berrangé berrange@redhat.com Wed Apr 26 17:49:37 2023 +0100
Date: Sun May 7 12:40:05 2023 -0400:
Git: 6258d536895b1a64a81f111445994c35c0928d4b
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
diff --git a/virt-manager.spec b/virt-manager.spec
index 55c24405..5b939b5d 100644
--- a/virt-manager.spec
+++ b/virt-manager.spec
@@ -12,7 +12,7 @@ Release: 1%{?dist}
%global verrel %{version}-%{release}
Summary: Desktop tool for managing virtual machines via libvirt
-License: GPLv2+
+License: GPL-2.0-or-later
BuildArch: noarch
URL: https://virt-manager.org/
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz

View File

@ -0,0 +1,27 @@
Subject: uitests: Drop hotplug work around, f38 libvirt is fixed now
From: Cole Robinson crobinso@redhat.com Wed May 24 12:01:46 2023 -0400
Date: Wed May 24 12:49:02 2023 -0400:
Git: 7cd6151a212c4c477a947fe5a7f2b3363dd0dcbd
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_livetests.py b/tests/uitests/test_livetests.py
index 55c9066b..64ff7ad9 100644
--- a/tests/uitests/test_livetests.py
+++ b/tests/uitests/test_livetests.py
@@ -471,15 +471,6 @@ def _testLiveHotplug(app, fname):
lib.utils.check(lambda: tab.showing)
entry.set_text(fname)
appl.click()
- # pylint: disable=unreachable
- import dogtail.tree
- try:
- # F38 CDROM change is broken:
- # https://gitlab.com/qemu-project/qemu/-/issues/933
- app.click_alert_button("changes will take effect", "OK")
- return
- except dogtail.tree.SearchError:
- pass
lib.utils.check(lambda: not appl.sensitive)
lib.utils.check(lambda: entry.text == fname)

View File

@ -0,0 +1,68 @@
Subject: virtinst: delay "lookup_capsinfo" until we really need it
From: Laszlo Ersek lersek@redhat.com Sat Aug 26 13:00:16 2023 +0200
Date: Tue Aug 29 13:24:52 2023 +0200:
Git: 4ead4acb440e132c84f2e73365a1e419279d9fb9
When I try to open the details window for a domain that does not use the
system default emulator, I get the following exception:
> Traceback (most recent call last):
> File "virtManager/vmwindow.py", line 40, in get_instance
> cls._instances[key] = vmmVMWindow(vm)
> File "virtManager/vmwindow.py", line 83, in __init__
> self._details = vmmDetails(self.vm, self.builder, self.topwin,
> File "virtManager/details/details.py", line 389, in __init__
> self._init_details()
> File "virtManager/details/details.py", line 807, in _init_details
> vmmAddHardware.build_video_combo(self.vm, video_dev)
> File "virtManager/addhardware.py", line 816, in build_video_combo
> default = DeviceVideo.default_model(vm.xmlobj)
> File "virtinst/devices/video.py", line 47, in default_model
> if (guest.lookup_domcaps().supports_video_virtio() and
> File "virtinst/guest.py", line 656, in lookup_domcaps
> if not self._domcaps or not _compare(self._domcaps):
> File "virtinst/guest.py", line 646, in _compare
> if self.os.machine and not _compare_machine(domcaps):
> File "virtinst/guest.py", line 633, in _compare_machine
> capsinfo = self.lookup_capsinfo()
> File "virtinst/guest.py", line 674, in lookup_capsinfo
> self._capsinfo = self.conn.caps.guest_lookup(
> File "virtinst/capabilities.py", line 319, in guest_lookup
> raise ValueError(msg)
> ValueError: Host does not support domain type kvm with machine
> 'pc-q35-8.1' for virtualization type 'hvm' with architecture 'x86_64'
This is a regression; according to git-bisect, it was introduced in commit
05fcc7410eee ("virtinst: fix caching of domain capabilities", 2022-07-27).
"lookup_capsinfo" (and "guest_lookup" called by it) are unsuitable for
machine type alias checking (or for anything else) if the domain uses an
emulator that differs from the system default emulator. The information
returned by virConnectGetCapabilities() pertains to the system default
emulator. Thus, when using a non-default emulator, we should either not
call "lookup_capsinfo" for machine type alias checking, *or* we should
suppress the exception, and pretend that the alias check was a mismatch.
It turns out that we can avoid the "lookup_capsinfo" call (and thereby the
exception) in practice if we just delay the call until after the direct
(non-alias) comparison.
Fixes: #539
Fixes: 05fcc7410eee ("virtinst: fix caching of domain capabilities", 2022-07-27)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 123abfb2..9232405b 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -630,9 +630,9 @@ class Guest(XMLBuilder):
def lookup_domcaps(self):
def _compare_machine(domcaps):
- capsinfo = self.lookup_capsinfo()
if self.os.machine == domcaps.machine:
return True
+ capsinfo = self.lookup_capsinfo()
if capsinfo.is_machine_alias(self.os.machine, domcaps.machine):
return True
return False

View File

@ -0,0 +1,52 @@
Subject: virtinst: suppress "lookup_capsinfo" exception in machine type alias check
From: Laszlo Ersek lersek@redhat.com Sat Aug 26 13:38:42 2023 +0200
Date: Tue Aug 29 13:24:52 2023 +0200:
Git: 7dbe973b3f3a4311094f772bca72bef58cfdf4d7
Just to be sure, this patch implements the second approach (described in
the previous patch) as well.
Note that there is precedent for suppressing "guest_lookup" exceptions:
refer to the "Error determining machine list" branch from commit
ae7ebc220b15 ("details: Properly limit machine type list by guests
arch/type", 2013-09-01).
(
In fact, that branch gets activated when opening the details window for a
domain that uses a non-default emulator; the "virt-manager --debug" log
contains:
> ERROR (details:613) Error determining machine list
> Traceback (most recent call last):
> File "virtManager/details/details.py", line 605, in _init_details
> capsinfo = caps.guest_lookup(
> File "virtinst/capabilities.py", line 319, in guest_lookup
> raise ValueError(msg)
> ValueError: Host does not support domain type kvm with machine
> 'pc-q35-8.1' for virtualization type 'hvm' with architecture 'x86_64'
)
Fixes: #539
Fixes: 05fcc7410eee ("virtinst: fix caching of domain capabilities", 2022-07-27)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 9232405b..c61c65e7 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -632,7 +632,12 @@ class Guest(XMLBuilder):
def _compare_machine(domcaps):
if self.os.machine == domcaps.machine:
return True
- capsinfo = self.lookup_capsinfo()
+ try:
+ capsinfo = self.lookup_capsinfo()
+ except Exception:
+ log.exception("Error fetching machine list for alias "
+ "resolution, assuming mismatch");
+ return False
if capsinfo.is_machine_alias(self.os.machine, domcaps.machine):
return True
return False

View File

@ -0,0 +1,63 @@
Subject: tests/data: refresh Fedora tree URLs in virt-install-osinfo* expected XMLs
From: Laszlo Ersek lersek@redhat.com Sun Aug 27 09:19:09 2023 +0200
Date: Tue Aug 29 13:24:52 2023 +0200:
Git: 6e5c1db6b4a0af96afeb09a09fb2fc2b73308f01
Libosinfo seems to generate Fedora tree URLs using the "https", not
"http", scheme now; which breaks CI. Update the expected outputs
accordingly.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
diff --git a/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml b/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml
index 1140bf0b..5f3c3474 100644
--- a/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-unattended-treeapis.xml
@@ -13,7 +13,7 @@
<type arch="x86_64" machine="pc-i440fx-6.1">hvm</type>
<kernel>/VIRTINST-TESTSUITE/vmlinuz</kernel>
<initrd>/VIRTINST-TESTSUITE/initrd.img</initrd>
- <cmdline>ks=file:/fedora.ks method=http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/17/Fedora/x86_64/os/</cmdline>
+ <cmdline>ks=file:/fedora.ks method=https://archive.fedoraproject.org/pub/archive/fedora/linux/releases/17/Fedora/x86_64/os/</cmdline>
</os>
<features>
<acpi/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml b/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml
index fe653b8b..2388120a 100644
--- a/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-url-unattended.xml
@@ -13,7 +13,7 @@
<type arch="x86_64" machine="q35">hvm</type>
<kernel>/VIRTINST-TESTSUITE/vmlinuz</kernel>
<initrd>/VIRTINST-TESTSUITE/initrd.img</initrd>
- <cmdline>ks=file:/fedora.ks inst.repo=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
+ <cmdline>ks=file:/fedora.ks inst.repo=https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
</os>
<features>
<acpi/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml b/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
index 99fb90fb..11fce0aa 100644
--- a/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
@@ -13,7 +13,7 @@
<type arch="x86_64" machine="q35">hvm</type>
<kernel>/VIRTINST-TESTSUITE/vmlinuz</kernel>
<initrd>/VIRTINST-TESTSUITE/initrd.img</initrd>
- <cmdline>method=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
+ <cmdline>method=https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
</os>
<features>
<acpi/>
diff --git a/tests/data/cli/compare/virt-install-osinfo-url.xml b/tests/data/cli/compare/virt-install-osinfo-url.xml
index 37fcc109..ea1937a3 100644
--- a/tests/data/cli/compare/virt-install-osinfo-url.xml
+++ b/tests/data/cli/compare/virt-install-osinfo-url.xml
@@ -13,7 +13,7 @@
<type arch="x86_64" machine="q35">hvm</type>
<kernel>/VIRTINST-TESTSUITE/vmlinuz</kernel>
<initrd>/VIRTINST-TESTSUITE/initrd.img</initrd>
- <cmdline>method=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
+ <cmdline>method=https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Server/x86_64/os/</cmdline>
</os>
<features>
<acpi/>

View File

@ -0,0 +1,74 @@
Subject: tests: Add unit test coverage for #539
From: Cole Robinson crobinso@redhat.com Tue Aug 29 12:27:40 2023 -0400
Date: Tue Aug 29 12:27:40 2023 -0400:
Git: 19b0f3f446ff8fc3b98c676726ee3a42b0b00b74
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/data/xmlparse/emulator-custom.xml b/tests/data/xmlparse/emulator-custom.xml
new file mode 100644
index 00000000..d39ce024
--- /dev/null
+++ b/tests/data/xmlparse/emulator-custom.xml
@@ -0,0 +1,22 @@
+<domain type='kvm'>
+ <name>manual-emulator-test</name>
+ <metadata>
+ <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
+ <libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory unit='KiB'>8388608</memory>
+ <currentMemory unit='KiB'>8388608</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='mips' machine='some-unknown-machine'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/my/manual/emulator</emulator>
+ </devices>
+</domain>
+
diff --git a/tests/test_xmlparse.py b/tests/test_xmlparse.py
index 1bf0ebe5..781680cf 100644
--- a/tests/test_xmlparse.py
+++ b/tests/test_xmlparse.py
@@ -1170,3 +1170,34 @@ def testDiskSourceAbspath():
# ...unless it's a URL
disk.set_source_path("http://example.com/foobar3")
assert disk.get_source_path() == "http://example.com/foobar3"
+
+
+def testUnknownEmulatorDomcapsLookup(monkeypatch):
+ """
+ Libvirt can handle defining a VM with a custom emulator, one not detected
+ by `virsh capabilities`. An appropriate `virsh domcapabilities` call will
+ inspect the emulator and return relevant info.
+
+ This test ensures that for parsing XML the `virsh capabilities` failure
+ isn't fatal, and we attempt to return valid `virsh domcapabilities` data
+ """
+
+ seen = False
+ def fake_build_from_params(conn, emulator, arch, machine, hvtype):
+ nonlocal seen
+ seen = True
+ assert arch == "mips"
+ assert machine == "some-unknown-machine"
+ assert emulator == "/my/manual/emulator"
+ return virtinst.DomainCapabilities(conn)
+
+ monkeypatch.setattr(
+ "virtinst.DomainCapabilities.build_from_params",
+ fake_build_from_params)
+
+ conn = utils.URIs.open_kvm()
+ xml = open(DATADIR + "emulator-custom.xml").read()
+ guest = virtinst.Guest(conn, xml)
+ assert guest.lookup_domcaps()
+ assert guest.lookup_domcaps()
+ assert seen

View File

@ -0,0 +1,80 @@
Subject: fix indentation of multiline log.exception() invocations
From: Laszlo Ersek lersek@redhat.com Wed Aug 30 10:03:15 2023 +0200
Date: Wed Aug 30 10:48:54 2023 +0200:
Git: 2ebbdb2797c62b9a962bdc4362882115f9445a62
Commit f107e3998908 ("Switch to more traditional logging structure",
2019-06-17) replaced "logging.exception" with "log.exception", effectively
shifting the argument lists 4 characters to the left. The second and
further lines of multiline invocations were not accordingly unindented,
however, which ended up setting a suboptimal precedent as well. Unindent
those lines now.
Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
diff --git a/virtManager/hoststorage.py b/virtManager/hoststorage.py
index 594c6587..0670572c 100644
--- a/virtManager/hoststorage.py
+++ b/virtManager/hoststorage.py
@@ -427,8 +427,7 @@ class vmmHostStorage(vmmGObjectUI):
if not namestr:
namestr = None
except Exception: # pragma: no cover
- log.exception("Failed to determine if storage volume in "
- "use.")
+ log.exception("Failed to determine if storage volume in use.")
sensitive = True
if self._vol_sensitive_cb:
diff --git a/virtManager/lib/inspection.py b/virtManager/lib/inspection.py
index 59f8b413..bc14dd2c 100644
--- a/virtManager/lib/inspection.py
+++ b/virtManager/lib/inspection.py
@@ -115,9 +115,8 @@ def _perform_inspection(conn, vm): # pragma: no cover
g.mount_ro(dev, mp)
filesystems_mounted = True
except Exception:
- log.exception("%s: exception mounting %s on %s "
- "(ignored)",
- prettyvm, dev, mp)
+ log.exception("%s: exception mounting %s on %s (ignored)",
+ prettyvm, dev, mp)
icon = None
apps = None
@@ -154,7 +153,7 @@ def _perform_inspection(conn, vm): # pragma: no cover
apps.append(app)
except Exception:
log.exception("%s: exception while listing apps (ignored)",
- prettyvm)
+ prettyvm)
# Force the libguestfs handle to close right now.
del g
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index 1570b952..e7dc5035 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -1429,7 +1429,7 @@ class vmmDomain(vmmLibvirtObject):
self._backend.undefineFlags(flags)
except libvirt.libvirtError:
log.exception("libvirt undefineFlags failed, "
- "falling back to old style")
+ "falling back to old style")
self._backend.undefine()
@vmmLibvirtObject.lifecycle_action
diff --git a/virtinst/guest.py b/virtinst/guest.py
index c61c65e7..0584484f 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -636,7 +636,7 @@ class Guest(XMLBuilder):
capsinfo = self.lookup_capsinfo()
except Exception:
log.exception("Error fetching machine list for alias "
- "resolution, assuming mismatch");
+ "resolution, assuming mismatch");
return False
if capsinfo.is_machine_alias(self.os.machine, domcaps.machine):
return True

View File

@ -0,0 +1,27 @@
Subject: virt-clone: Copy disk permissions as well
From: Martin Kletzander mkletzan@redhat.com Fri Sep 1 21:39:37 2023 +0200
Date: Sun Sep 10 11:19:31 2023 -0400:
Git: 9f8da1f666177694dcffaac6728988b18e27274c
When cloning using libvirt APIs the function virStorageVolCreateXMLFrom
is used. However name and permissions are taken from the new XML [1].
By copying the permissions (only the mode is used) we can avoid some
unexpected issues.
[1] https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolCreateXMLFrom
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2115153
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
diff --git a/virtinst/storage.py b/virtinst/storage.py
index f9a9f7a7..fd8a7481 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -528,6 +528,7 @@ class StorageVolume(_StorageObject):
self.format = parsevol.format
self.capacity = parsevol.capacity
self.allocation = parsevol.allocation
+ self.permissions.mode = parsevol.permissions.mode
if not self._pool:
self.pool = self._input_vol.storagePoolLookupByVolume()

View File

@ -0,0 +1,19 @@
Subject: data: appstream: add launchable tag
From: Pino Toscano ptoscano@redhat.com Sat Sep 9 07:26:20 2023 +0200
Date: Sun Sep 10 11:20:29 2023 -0400:
Git: ccd47575337cfa8e8b96197310b3ff4dabd2ab69
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
diff --git a/data/virt-manager.appdata.xml.in b/data/virt-manager.appdata.xml.in
index 0383852e..fd8f6e48 100644
--- a/data/virt-manager.appdata.xml.in
+++ b/data/virt-manager.appdata.xml.in
@@ -40,6 +40,7 @@
<keyword>kvm</keyword>
</keywords>
<content_rating type="oars-1.1"/>
+ <launchable type="desktop-id">virt-manager.desktop</launchable>
<releases>
<release version="4.1.0" date="2022-08-04"/>
<release version="4.0.0" date="2022-03-02"/>

71
052-Fix-some-pylint.patch Normal file
View File

@ -0,0 +1,71 @@
Subject: Fix some pylint
From: Cole Robinson crobinso@redhat.com Tue Sep 12 11:54:04 2023 -0400
Date: Tue Sep 12 11:54:04 2023 -0400:
Git: 0f706cf87436af598b8694aecf4b42657bfa5b11
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -449,7 +449,7 @@ class App(object):
self._add(cat, args, None, check_success=True, **kwargs)
def add_invalid(self, cat, args, **kwargs):
if "grep" not in kwargs:
- raise Exception("grep= must be passed for add_invalid")
+ raise RuntimeError("grep= must be passed for add_invalid")
self._add(cat, args, None, check_success=False, **kwargs)
def add_compare(self, cat, args, compbase, **kwargs):
self._add(cat, args, compbase,
--- a/tests/test_xmlparse.py
+++ b/tests/test_xmlparse.py
@@ -1183,7 +1183,7 @@ def testUnknownEmulatorDomcapsLookup(mon
"""
seen = False
- def fake_build_from_params(conn, emulator, arch, machine, hvtype):
+ def fake_build_from_params(conn, emulator, arch, machine, _hvtype):
nonlocal seen
seen = True
assert arch == "mips"
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1276,7 +1276,7 @@ class _InitClass(type):
but without giving us an explicit dep on python 3.6
"""
- def __new__(cls, *args, **kwargs):
+ def __new__(cls, *args, **kwargs): # pylint: disable=bad-mcs-classmethod-argument
if len(args) != 3:
return super().__new__(cls, *args) # pragma: no cover
dummy = kwargs
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -636,7 +636,7 @@ class Guest(XMLBuilder):
capsinfo = self.lookup_capsinfo()
except Exception:
log.exception("Error fetching machine list for alias "
- "resolution, assuming mismatch");
+ "resolution, assuming mismatch")
return False
if capsinfo.is_machine_alias(self.os.machine, domcaps.machine):
return True
@@ -743,7 +743,7 @@ class Guest(XMLBuilder):
if original_machine_type.startswith(prefix):
self.os.machine = machine_alias
return
- raise Exception("Don't know how to refresh machine type '%s'" %
+ raise RuntimeError("Don't know how to refresh machine type '%s'" %
original_machine_type)
def set_smbios_serial_cloudinit(self):
--- a/virtinst/xmlbuilder.py
+++ b/virtinst/xmlbuilder.py
@@ -54,7 +54,7 @@ class XMLManualAction(object):
val = self.xpath_value
else:
if "=" not in str(xpath):
- raise Exception(
+ raise ValueError(
"%s: Setting xpath must be in the form of XPATH=VALUE" %
xpath)
xpath, val = xpath.rsplit("=", 1)

View File

@ -0,0 +1,154 @@
Subject: connectauth: Drop sanity checking for libvirtd
From: Cole Robinson crobinso@redhat.com Tue Sep 12 13:18:42 2023 -0400
Date: Sun Sep 24 16:31:58 2023 -0400:
Git: 775edfd5dc668c26ffbdf07f6404ca80d91c3a3a
Nowadays with libvirt split daemons, libvirtd isn't required to
be installed for a first run local connection to succeed, so we
are needlessly blocking the app from 'just working' in many cases.
Especially considering that many distros often have libvirt running
out of the box due to gnome-boxes pulling it in.
Drop the daemon checking entirely.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_cli.py b/tests/uitests/test_cli.py
index 7e7ab6ea..b317bf28 100644
--- a/tests/uitests/test_cli.py
+++ b/tests/uitests/test_cli.py
@@ -139,15 +139,12 @@ def testCLIFirstRunURIBad(app):
app.click_alert_button("bad:///uri", "Close")
-def testCLIFirstRunNoLibvirtd(app):
+def testCLIFirstRunNoURI(app):
# Emulate first run with no libvirtd detected
- app.open(use_uri=False, firstrun_uri="bad:///uri",
- extra_opts=["--test-options=fake-no-libvirtd"])
+ app.open(use_uri=False, firstrun_uri="")
errlabel = app.topwin.find("error-label")
lib.utils.check(
lambda: "Checking for virtualization" in errlabel.text)
- lib.utils.check(
- lambda: "libvirtd service does not appear" in errlabel.text)
lib.utils.check(
lambda: "detect a default hypervisor" in errlabel.text)
diff --git a/virtManager/engine.py b/virtManager/engine.py
index 58fd8026..a90b5464 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -131,14 +131,14 @@ class vmmEngine(vmmGObject):
"""
from .lib import connectauth
- tryuri = vmmCreateConn.default_uri()
- log.debug("Probed default URI=%s", tryuri)
+ detected_uri = vmmCreateConn.default_uri()
+ log.debug("Probed default URI=%s", detected_uri)
if self.config.CLITestOptions.firstrun_uri is not None:
- tryuri = self.config.CLITestOptions.firstrun_uri or None
- log.debug("Using test-options firstrun_uri=%s", tryuri)
+ detected_uri = self.config.CLITestOptions.firstrun_uri or None
+ log.debug("Using test-options firstrun_uri=%s", detected_uri)
manager = self._get_manager()
- msg = connectauth.setup_first_uri(self.config, tryuri)
+ msg = connectauth.setup_first_uri(self.config, detected_uri)
if msg:
manager.set_startup_error(msg)
return
@@ -149,7 +149,7 @@ class vmmEngine(vmmGObject):
if ConnectError:
self._handle_conn_error(c, ConnectError)
- conn = vmmConnectionManager.get_instance().add_conn(tryuri)
+ conn = vmmConnectionManager.get_instance().add_conn(detected_uri)
conn.set_autoconnect(True)
conn.connect_once("open-completed", _open_completed)
conn.open()
diff --git a/virtManager/lib/connectauth.py b/virtManager/lib/connectauth.py
index 71e1b21f..9baec603 100644
--- a/virtManager/lib/connectauth.py
+++ b/virtManager/lib/connectauth.py
@@ -7,7 +7,6 @@
import collections
import os
import re
-import shutil
import time
from gi.repository import GLib
@@ -161,7 +160,7 @@ def connect_error(conn, errmsg, tb, warnconsole):
"or install an SSH askpass package locally.")
show_errmsg = False
else:
- hint += _("Verify that the 'libvirtd' daemon is running "
+ hint += _("Verify that an appropriate libvirt daemon is running "
"on the remote host.")
elif conn.is_xen(): # pragma: no cover
@@ -176,8 +175,8 @@ def connect_error(conn, errmsg, tb, warnconsole):
"may not be able to connect to libvirt as a "
"regular user. Try running as root.")
show_errmsg = False
- elif re.search(r"libvirt-sock", tb): # pragma: no cover
- hint += _("Verify that the 'libvirtd' daemon is running.")
+ elif re.search(r"virt[a-z]*-sock", tb): # pragma: no cover
+ hint += _("Verify that an appropriate libvirt daemon is running.")
show_errmsg = False
msg = _("Unable to connect to libvirt %s." % conn.get_uri())
@@ -203,27 +202,11 @@ def connect_error(conn, errmsg, tb, warnconsole):
# App first run connection setup #
##################################
-def setup_first_uri(config, tryuri):
- # Add /usr/sbin to the path in case non-root user launches virt-manager
- libvirtd_installed = bool(shutil.which("libvirtd", path=os.environ['PATH'] + os.pathsep + "/usr/sbin"))
- if config.CLITestOptions.fake_no_libvirtd:
- libvirtd_installed = False
-
- if tryuri and libvirtd_installed:
- return
-
- # Manager fail message
+def setup_first_uri(_config, detected_uri):
msg = ""
- if not libvirtd_installed: # pragma: no cover
- msg += _("The libvirtd service does not appear to be installed. "
- "Install and run the libvirtd service to manage "
- "virtualization on this host.")
-
- if not tryuri or "qemu" not in tryuri:
- if msg:
- msg += "\n\n" # pragma: no cover
+ if not detected_uri:
msg += _("Could not detect a default hypervisor. Make "
- "sure the appropriate QEMU/KVM virtualization "
+ "sure the appropriate QEMU/KVM virtualization and libvirt "
"packages are installed to manage virtualization "
"on this host.")
diff --git a/virtManager/lib/testmock.py b/virtManager/lib/testmock.py
index 1f3e91ac..d2ee6972 100644
--- a/virtManager/lib/testmock.py
+++ b/virtManager/lib/testmock.py
@@ -168,8 +168,6 @@ class CLITestOptionsClass:
* firstrun-uri: If set, use this as the initial connection URI
if we are doing firstrun testing
- * fake-no-libvirtd: If doing firstrun testing, fake that
- libvirtd is not installed
* fake-vnc-username: Fake VNC username auth request
* fake-console-resolution: Fake viewer console resolution response.
Spice doesn't return values here when we are just testing
@@ -223,7 +221,6 @@ class CLITestOptionsClass:
self.test_vm_run_fail = _get("test-vm-run-fail")
self.spice_agent = _get("spice-agent")
self.firstrun_uri = _get_value("firstrun-uri")
- self.fake_no_libvirtd = _get("fake-no-libvirtd")
self.fake_vnc_username = _get("fake-vnc-username")
self.fake_console_resolution = _get("fake-console-resolution")
self.fake_systray = _get("fake-systray")

View File

@ -0,0 +1,70 @@
Subject: delete: Fix ambiguity that confused pylint
From: Cole Robinson crobinso@redhat.com Sun Sep 24 16:13:00 2023 -0400
Date: Sun Sep 24 16:31:58 2023 -0400:
Git: ab0a318a46b1ab5c7827fc805b8c4e21635d66ab
virtManager/delete.py:219:11: E0601: Using variable 'error' before assignment (used-before-assignment)
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtManager/delete.py b/virtManager/delete.py
index f050534b..2195a5d9 100644
--- a/virtManager/delete.py
+++ b/virtManager/delete.py
@@ -179,8 +179,9 @@ class _vmmDeleteBase(vmmGObjectUI):
self._set_vm(None)
def _async_delete(self, asyncjob, vm, paths):
- details = ""
+ errdata = None
storage_errors = []
+
try:
self._destroy_vm(vm)
@@ -191,33 +192,32 @@ class _vmmDeleteBase(vmmGObjectUI):
self._delete_vm(vm)
vm.conn.schedule_priority_tick(pollvm=True)
except Exception as e: # pragma: no cover
- error = _("Error deleting virtual machine '%(vm)s': %(error)s") % {
- "vm": vm.get_name(),
- "error": str(e),
- }
- details = "".join(traceback.format_exc())
+ errdata = (
+ (_("Error deleting virtual machine '%(vm)s': %(error)s") %
+ {"vm": vm.get_name(), "error": str(e)}),
+ "".join(traceback.format_exc()))
+
+ if not storage_errors and not errdata:
+ return
storage_errstr = ""
for errinfo in storage_errors:
storage_errstr += "%s\n%s\n" % (errinfo[0], errinfo[1])
- if not storage_errstr and not details:
- return
-
# We had extra storage errors. If there was another error message,
# errors to it. Otherwise, build the main error around them.
- if details: # pragma: no cover
+ if errdata: # pragma: no cover
+ error, details = errdata
details += "\n\n"
details += _("Additionally, there were errors removing"
- " certain storage devices: \n")
+ " certain storage devices: \n")
details += storage_errstr
else:
error = _("Errors encountered while removing certain "
- "storage devices.")
+ "storage devices.")
details = storage_errstr
- if error:
- asyncjob.set_error(error, details)
+ asyncjob.set_error(error, details)
def _async_delete_paths(self, paths, conn, meter):
storage_errors = []

View File

@ -0,0 +1,65 @@
Subject: Fix filesystem socket.source
From: Jonathon Jongsma jjongsma@redhat.com Mon Oct 23 14:42:19 2023 -0500
Date: Tue Oct 24 10:30:37 2023 +0200:
Git: 40b73fec1b251da866485ac8534ba61aaca14fe7
When specifying the socket.source option for filesystem devices, like
this:
--filesystem type=mount,driver.type=virtiofs,source.socket=/xyz.sock,target.dir=tag1
virt-install is writing the xml as:
<filesystem type="mount">
<source>
<socket>/xyz.sock</socket>
</source>
<target dir="tag1"/>
<driver type="virtiofs"/>
</filesystem>
This produces an error such as:
ERROR missing source information for device mount_tag1
But the socket should be an attribute of source rather than a child
element. After this patch, the same command results in the following XML
and no error is produced:
<filesystem type="mount">
<source socket="/xyz.sock"/>
<target dir="tag1"/>
<driver type="virtiofs"/>
</filesystem>
Resolves: RHEL-1126
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index e4a7da8f..8eca4e5b 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -509,9 +509,7 @@
<readonly/>
<space_hard_limit>1234</space_hard_limit>
<space_soft_limit>500</space_soft_limit>
- <source pool="pool1" volume="vol">
- <socket>/tmp/foo.sock</socket>
- </source>
+ <source pool="pool1" volume="vol" socket="/tmp/foo.sock"/>
<target dir="/foo"/>
<binary path="/foo/virtiofsd" xattr="off">
<cache mode="always"/>
diff --git a/virtinst/devices/filesystem.py b/virtinst/devices/filesystem.py
index 975548f4..e38e35c3 100644
--- a/virtinst/devices/filesystem.py
+++ b/virtinst/devices/filesystem.py
@@ -53,7 +53,7 @@ class DeviceFilesystem(Device):
source_units = XMLProperty("./source/@units")
source_pool = XMLProperty("./source/@pool")
source_volume = XMLProperty("./source/@volume")
- source_socket = XMLProperty("./source/socket")
+ source_socket = XMLProperty("./source/@socket")
binary_path = XMLProperty("./binary/@path")
binary_xattr = XMLProperty("./binary/@xattr", is_onoff=True)

View File

@ -0,0 +1,65 @@
Subject: uri: Mock domcaps returning NO_SUPPORT
From: Cole Robinson crobinso@redhat.com Mon Jan 22 17:07:31 2024 -0500
Date: Mon Jan 22 17:07:31 2024 -0500:
Git: 2e3db754d1d596f8fed6b327017ace922838eb49
With libvirt 9.8.0, the test driver now has a stub getDomainCapabilities
implementation. But we still have some code that needs to handle
a driver with missing domcaps.
Make our magicuri mock return NO_SUPPORT for domcaps, when the URI
doesn't have any domcaps XML passed in. This is enough for our test
purposes.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtinst/uri.py b/virtinst/uri.py
index c83aaa78..c4be1960 100644
--- a/virtinst/uri.py
+++ b/virtinst/uri.py
@@ -173,23 +173,39 @@ class MagicURI(object):
capsxml = open(self.capsfile).read()
conn.getCapabilities = lambda: capsxml
+ def _raise_nosupport_error(msg):
+ import libvirt
+ err = [libvirt.VIR_ERR_NO_SUPPORT, None, msg, None, None, None]
+ exc = libvirt.libvirtError(msg)
+ exc.err = err
+ raise exc
+
# Fake domcapabilities. This is insufficient since output should
# vary per type/arch/emulator combo, but it can be expanded later
# if needed
+ domcapsxml = None
if self.domcapsfile:
domcapsxml = open(self.domcapsfile).read()
- def fake_domcaps(emulator, arch, machine, virttype, flags=0):
- ignore = emulator
- ignore = flags
- ignore = machine
- ignore = virttype
+ def fake_domcaps(emulator, arch, machine, virttype, flags=0):
+ ignore = emulator
+ ignore = flags
+ ignore = machine
+ ignore = virttype
+
+ if domcapsxml:
ret = domcapsxml
if arch:
ret = re.sub("arch>.+</arch", "arch>%s</arch" % arch, ret)
return ret
- conn.getDomainCapabilities = fake_domcaps
+ # In libvirt 9.8.0 the test suite added a stub domcaps
+ # impl. Fall back to raising NO_SUPPORT for our magic URIs, so
+ # we can keep getting code coverage of the old code paths
+ _raise_nosupport_error(
+ "virtinst test driver fake domcaps nosupport")
+
+ conn.getDomainCapabilities = fake_domcaps
if self.fakeuri:
origcreate = conn.createXML

View File

@ -0,0 +1,23 @@
Subject: tests: cli: Adjust hotplug test for latest libvirt
From: Cole Robinson crobinso@redhat.com Mon Jan 22 17:10:41 2024 -0500
Date: Mon Jan 22 17:10:41 2024 -0500:
Git: 83fcc5b2e8f2cede84564387756fe8971de72188
The libvirt test driver now has implementations for hotplug routines,
which broke string matching for one case.
Loosen it up to work for old and new libvirt versions.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1334,7 +1334,7 @@ c.add_invalid("test --edit --cpu host-pa
c.add_invalid("test --edit", grep="No change specified.")
c.add_invalid("test --edit 2 --cpu host-passthrough", grep="'--edit 2' requested but there's only 1 --cpu object in the XML")
c.add_invalid("test-for-virtxml --edit 5 --tpm /dev/tpm", grep="'--edit 5' requested but there's only 1 --tpm object in the XML")
-c.add_invalid("test-for-virtxml --add-device --host-device 0x04b3:0x4485 --update --confirm", input_text="yes", grep="not supported by the connection driver: virDomainAttachDevice")
+c.add_invalid("test-for-virtxml --add-device --host-device 0x04b3:0x4485 --update --confirm", input_text="yes", grep="not supported")
c.add_invalid("test-for-virtxml --remove-device --host-device 1 --update --confirm", input_text="foo\nyes\n", grep="not supported by the connection driver: virDomainDetachDevice")
c.add_invalid("test-for-virtxml --edit --graphics password=foo,keymap= --update --confirm", input_text="yes", grep="not supported by the connection driver: virDomainUpdateDeviceFlags")
c.add_invalid("--build-xml --memory 10,maxmemory=20", grep="--build-xml not supported for --memory")

35
060-Fix-some-pylint.patch Normal file
View File

@ -0,0 +1,35 @@
Subject: Fix some pylint
From: Cole Robinson crobinso@redhat.com Mon Jan 22 17:15:11 2024 -0500
Date: Mon Jan 22 17:15:11 2024 -0500:
Git: c399353e00b37ae00c614c7e52a1369e6e816820
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/virtManager/details/viewers.py b/virtManager/details/viewers.py
index 68c97bdb..2a8a7857 100644
--- a/virtManager/details/viewers.py
+++ b/virtManager/details/viewers.py
@@ -618,8 +618,8 @@ class SpiceViewer(Viewer):
self._main_channel, "notify::agent-connected",
self._agent_connected_cb)
- elif (type(channel) == SpiceClientGLib.DisplayChannel and
- not self._display):
+ elif (isinstance(channel, SpiceClientGLib.DisplayChannel) and
+ not self._display):
channel_id = channel.get_property("channel-id")
if channel_id != 0: # pragma: no cover
diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
index 5f80c437..abfaab26 100644
--- a/virtinst/diskbackend.py
+++ b/virtinst/diskbackend.py
@@ -753,7 +753,7 @@ class StorageBackend(_StorageBase):
self._exists = True
elif self._path is None:
self._exists = True
- elif (not self.get_dev_type() == "network" and
+ elif (self.get_dev_type() != "network" and
not self._conn.is_remote() and
os.path.exists(self._path)):
self._exists = True

View File

@ -0,0 +1,24 @@
Subject: tests: ui: make newvm test start less flakey
From: Cole Robinson crobinso@redhat.com Tue Jan 23 08:59:34 2024 -0500
Date: Tue Jan 23 09:07:29 2024 -0500:
Git: acf3cedbbf85de9dd50c483547e2ea258c529583
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/test_createvm.py b/tests/uitests/test_createvm.py
index f430c14c..6fe894b4 100644
--- a/tests/uitests/test_createvm.py
+++ b/tests/uitests/test_createvm.py
@@ -12,7 +12,11 @@ from . import lib
###################
def _open_newvm(app):
- app.root.find("New", "push button").click()
+ button = app.root.find("New", "push button")
+ # Launching the dialog can be very flakey without this explicit
+ # point() call, not sure why
+ button.point()
+ button.click()
return app.find_window("New VM")

View File

@ -0,0 +1,22 @@
Subject: tests: ui: make creatnet test start less flakey
From: Cole Robinson crobinso@redhat.com Tue Jan 23 11:18:49 2024 -0500
Date: Tue Jan 23 13:28:07 2024 -0500:
Git: 4e2bec5b1410649232165fa33091a6ed9b9b48d9
Signed-off-by: Cole Robinson <crobinso@redhat.com>
diff --git a/tests/uitests/lib/app.py b/tests/uitests/lib/app.py
index 83628a7f..672b5ced 100644
--- a/tests/uitests/lib/app.py
+++ b/tests/uitests/lib/app.py
@@ -215,7 +215,9 @@ class VMMDogtailApp(object):
self.root.find_fuzzy("Edit", "menu").click()
self.root.find_fuzzy("Connection Details", "menu item").click()
win = self.find_window("%s - Connection Details" % conn_label)
- win.find_fuzzy(tab, "page tab").click()
+ tab = win.find_fuzzy(tab, "page tab")
+ tab.point()
+ tab.click()
return win
def manager_test_conn_window_cleanup(self, conn_label, childwin):

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -0,0 +1,58 @@
References: bsc#1200691, an IBM request
This patch reverts commit 363fca413cae336a0ca86cbdcbb2f65fead948ee.
Only x86 will have a hard requirement for the --osinfo option.
From: Cole Robinson crobinso@redhat.com Sun Feb 20 11:40:35 2022 -0500
Subject: virt-install: Require --osinfo for non-x86 HVM case too
Date: Sun Feb 20 11:40:35 2022 -0500:
Git: 363fca413cae336a0ca86cbdcbb2f65fead948ee
It's generally not as valuable for non-x86 where we don't have the
history of supporting non-virtio OSes, but as time goes on it will
likely become more relevant for non-x86 arches, so let's make this
change now to get ahead of it.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
--- a/man/virt-install.rst
+++ b/man/virt-install.rst
@@ -1055,8 +1055,8 @@ all other settings off or unset.
By default, virt-install will always attempt ``--osinfo detect=on``
for appropriate install media. If no OS is detected, we will fail
-in most common cases. This fatal error was added in 2022. You can
-work around this by using the fallback example
+in certain common cases (x86 KVM for example). This fatal error was
+added in 2022. You can work around this by using the fallback example
above, or disabling the ``require`` option. If you just need to get back
to the old non-fatal behavior ASAP, set the environment variable
VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1.
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1181,7 +1181,6 @@ c.add_compare("--connect %(URI-KVM-ARMV7
#################
c.add_valid("--arch aarch64 --osinfo fedora19 --nodisks --pxe --connect " + utils.URIs.kvm_x86_nodomcaps, grep="Libvirt version does not support UEFI") # attempt to default to aarch64 UEFI, but it fails, but should only print warnings
-c.add_invalid("--arch aarch64 --nodisks --pxe --connect " + utils.URIs.kvm_x86, grep="OS name is required") # catch missing osinfo for non-x86
c.add_compare("--arch aarch64 --osinfo fedora19 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machvirt")
c.add_compare("--arch aarch64 --osinfo fedora19 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machdefault")
c.add_compare("--arch aarch64 --cdrom %(ISO-F26-NETINST)s --boot loader=CODE.fd,nvram.template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart", "aarch64-cdrom") # cdrom test, but also --cpu none override, --events override, and headless
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -355,13 +355,9 @@ def _show_memory_warnings(guest):
def _needs_accurate_osinfo(guest):
- # HVM is really the only case where OS impacts what we set for defaults,
- # so far.
- #
- # Historically we would only warn about missing osinfo on x86, but
- # with the change to make osinfo mandatory we relaxed the arch check,
- # so virt-install behavior is more consistent.
- return guest.os.is_hvm()
+ # Limit it to hvm x86 guests which presently our defaults
+ # only really matter for
+ return guest.os.is_x86() and guest.os.is_hvm()
def show_guest_warnings(options, guest):

24
virt-install.desktop Normal file
View File

@ -0,0 +1,24 @@
[Desktop Entry]
X-SuSE-translate=true
X-SuSE-DocTeamID=ycc_xen
Type=Application
Categories=GTK;GNOME;System;Monitor;X-SuSE-YaST;X-SuSE-YaST-Virtualization;
X-KDE-ModuleType=Library
X-KDE-RootOnly=true
X-KDE-HasReadOnlyMode=false
X-SuSE-YaST-Call=virt-install
X-SuSE-YaST-Group=Virtualization
X-SuSE-YaST-Argument=
X-SuSE-YaST-RootOnly=true
X-SuSE-YaST-Geometry=
X-SuSE-YaST-SortKey=
Icon=virt-manager
Exec=/sbin/yast2 virt-install
Name=Create Virtual Machines for Xen and KVM
GenericName=Create Virtual Machines
X-KDE-SubstituteUID=true

84
virt-install.rb Normal file
View File

@ -0,0 +1,84 @@
# ------------------------------------------------------------------------------
# Copyright (c) 2013 Novell, Inc. All Rights Reserved.
#
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail, you may find
# current contact information at www.novell.com.
# ------------------------------------------------------------------------------
#
#
# File: clients/virt-install.ycp
# Package: Installation of a virtual machine
# Summary: Main VM installation YaST frontend for python based virt-install
# Authors: Charles E. Arnold <carnold@suse.com>
#
# $Id$
module Yast
class VirtinstallClient < Client
def main
textdomain "virt-install"
Yast.import "UI"
Yast.import "Popup"
Yast.import "String"
Yast.import "Arch"
#===================================================================
# Start virt-install (GUI) or vm-install if Text mode (commandline)
#-------------------------------------------------------------------
status = 0
@details = {}
Builtins.y2milestone("START HERE.")
if WFM.Args == ["help"]
# Ignore yast help request
return :next
end
if UI.TextMode()
if File.file?("/usr/bin/vm-install")
Builtins.y2milestone("Running virt-install in text mode is not supported. Running vm-install instead in command line mode.")
status = UI.RunInTerminal("/usr/bin/vm-install")
else
Popup.Error(_("Please use the command line to execute virt-install with the appropriate options for creating a VM."))
end
else
Builtins.y2milestone("Launching virt-manager to run virt-install in GUI mode.")
if Arch.is_xen0 == false
details = Convert.to_map(SCR.Execute(path(".target.bash_output"), "/usr/bin/virt-manager --connect=qemu:///system --show-domain-creator"))
else
details = Convert.to_map(SCR.Execute(path(".target.bash_output"), "/usr/bin/virt-manager --connect=xen:/// --show-domain-creator"))
end
status = Ops.get_integer(details, "exit", 0)
end
Builtins.y2milestone("virt-install finished with exit code: <%1>", status)
if status == 0
return :next
else
if Builtins.size(Ops.get_string(details, "stderr", "")) > 0
Popup.ErrorDetails(_("Failed to start virt-install"), Convert.to_string(details, "stderr", ""))
else
Popup.Error(_("Failed to start virt-install"))
end
end
nil
end
end
end
Yast::VirtinstallClient.new.main

BIN
virt-manager-4.1.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
#!/bin/bash
#############################################################
# Name: Supportconfig Plugin for virt-manager
# Description: Gathers important troubleshooting information
# about virt-manager
#############################################################
RCFILE="/usr/lib/supportconfig/resources/supportconfig.rc"
OF="output-virt-manager.txt"
VIRTMAN_LOG_DIR="/root/.cache/virt-manager"
VIRTMAN_LOG_FILES=""
if [ -s $RCFILE ]; then
if ! source $RCFILE; then
log_write $OF "ERROR: Initializing resource file: $RCFILE"
exit 1
fi
fi
rpm_verify $OF virt-manager || exit 111
test -d $VIRTMAN_LOG_DIR && VIRTMAN_LOG_FILES="$(find -L $VIRTMAN_LOG_DIR/ -type f)"
log_files $OF 0 "$VIRTMAN_LOG_FILES"

4187
virt-manager.changes Normal file

File diff suppressed because it is too large Load Diff

365
virt-manager.spec Normal file
View File

@ -0,0 +1,365 @@
#
# spec file
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global __python %{__python3}
%global with_guestfs 0
%global default_hvs "qemu,xen,lxc"
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%bcond_without test
%define psuffix -%{flavor}
%else
%bcond_with test
%define psuffix %{nil}
%endif
Name: virt-manager%{psuffix}
Version: 4.1.0
Release: 0
Summary: Virtual Machine Manager
License: GPL-2.0-or-later
Group: System/Monitoring
URL: http://virt-manager.org/
Source0: https://releases.pagure.org/virt-manager/virt-manager-%{version}.tar.gz
Source1: virt-install.rb
Source2: virt-install.desktop
Source3: virt-manager-supportconfig
# Upstream Patches
Patch1: 001-cli-disk-Add-driver.metadata_cache-options.patch
Patch2: 002-tests-cli-Fix-test-output-after-previous-commit.patch
Patch3: 003-fsdetails-Fix-an-error-with-source.socket-of-virtiofs.patch
Patch4: 004-cli-Drop-unnecessary-disk-prop-aliases.patch
Patch5: 005-tests-testdriver-Add-filesystem-socket-example.patch
Patch6: 006-virtinstall-split-no_install-conditional-apart-to-track-code-coverage.patch
Patch7: 007-virtinstall-fix-regression-with-boot-and-no-install-method.patch
Patch8: 008-tests-Add-a-compat-check-for-linux2020-in-amd-sev-test-case.patch
Patch9: 009-cli-cpu-Add-maxphysaddr.mode-bits-options.patch
Patch10: 010-virt-install-help-required-options-are-wrong.patch
Patch11: 011-cloner-Sync-uuid-and-sysinfo-system-uuid.patch
Patch12: 012-virt-install-unattended-and-cloud-init-conflict.patch
Patch13: 013-virt-install-Reuse-cli.fail_conflicting.patch
Patch14: 014-cli-support-boot-loader.stateless-.patch
Patch15: 015-diskbackend-Drop-support-for-sheepdog.patch
Patch16: 016-Fix-pylint-pycodestyle-warnings-with-latest-versions.patch
Patch17: 017-tests-cpio-set-owner-to-00.patch
Patch18: 018-addhardware-Fix-backtrace-when-controller.index-is-None.patch
Patch19: 019-Clean-up-FileChooser-usage-a-bit.patch
Patch20: 020-guest-Query-availability-of-usb-redirdevs-in-domcaps.patch
Patch21: 021-guest-Query-availability-of-spicevmc-channels-in-domcaps.patch
Patch22: 022-tests-Add-domcaps-coverage-for-usb-redir-spicevmc-channel-checks.patch
Patch23: 023-tests-Update-to-latest-kvm-domcaps.patch
Patch24: 024-progress-Fix-showing-correct-final-total.patch
Patch25: 025-virtinstall-Fix-the-allocating-disk-size-printed-by-the-progress-bar.patch
Patch26: 026-virtinstall-Hide-total_size-in-the-progress-bar-if-it-doesnt-need.patch
Patch27: 027-asyncjob-Fix-backtrace-when-no-cursor-theme-installed.patch
Patch29: 029-asyncjob-Remove-unused-import.patch
Patch30: 030-Packit-initial-enablement.patch
Patch31: 031-virt-install-Recommend-boot-uefi.patch
Patch32: 032-virt-install-Document-Secure-Boot-setups.patch
Patch33: 033-cloner-clone-serial-files.patch
Patch34: 034-tests-cli-test-serial-file-clone.patch
Patch35: 035-man-virt-install-Add-a-note-about-different-behavior-of-boot-on-s390x.patch
Patch36: 036-tests-uitests-Fix-window-reposition-on-f38.patch
Patch37: 037-tests-livetests-work-around-qemu-media-change-regression.patch
Patch38: 038-tests-uitests-Fix-manager-window-repositioning-test.patch
Patch39: 039-tests-Default-uitests-to-verbosity-2.patch
Patch40: 040-uitests-Make-hotplug-test-pass-on-both-f37-and-f38.patch
Patch41: 041-uitests-More-attempts-at-making-manager-reposition-test-reliable.patch
Patch42: 042-tests-uitests-make-menu-operations-more-robust.patch
Patch43: 043-rpm-convert-license-to-SPDX-format.patch
Patch44: 044-uitests-Drop-hotplug-work-around-f38-libvirt-is-fixed-now.patch
Patch45: 045-virtinst-delay-lookup_capsinfo-until-we-really-need-it.patch
Patch46: 046-virtinst-suppress-lookup_capsinfo-exception-in-machine-type-alias-check.patch
Patch47: 047-tests-data-refresh-Fedora-tree-URLs-in-virt-install-osinfo-expected-XMLs.patch
Patch48: 048-tests-Add-unit-test-coverage-for-539.patch
Patch49: 049-fix-indentation-of-multiline-log.exception-invocations.patch
Patch50: 050-virt-clone-Copy-disk-permissions-as-well.patch
Patch51: 051-data-appstream-add-launchable-tag.patch
Patch52: 052-Fix-some-pylint.patch
Patch55: 055-connectauth-Drop-sanity-checking-for-libvirtd.patch
Patch56: 056-delete-Fix-ambiguity-that-confused-pylint.patch
Patch57: 057-Fix-filesystem-socket.source.patch
Patch58: 058-uri-Mock-domcaps-returning-NO_SUPPORT.patch
Patch59: 059-tests-cli-Adjust-hotplug-test-for-latest-libvirt.patch
Patch60: 060-Fix-some-pylint.patch
Patch61: 061-tests-ui-make-newvm-test-start-less-flakey.patch
Patch62: 062-tests-ui-make-creatnet-test-start-less-flakey.patch
Patch69: revert-363fca41-virt-install-Require-osinfo-for-non-x86-HVM-case-too.patch
# SUSE Only
Patch70: virtman-desktop.patch
Patch71: virtman-kvm.patch
Patch72: virtman-show-suse-install-repos.patch
Patch73: virtman-dont-allow-grub.xen-to-be-deleted.patch
Patch74: virtinst-pvgrub2-bootloader.patch
Patch75: virtinst-change-location-for-grub_xen.patch
Patch76: virtinst-set-qemu-emulator.patch
# Features or Enhancements
Patch103: virtman-load-stored-uris.patch
Patch104: virtman-add-tooltip-to-firmware.patch
Patch105: virtman-modify-gui-defaults.patch
Patch106: virtman-add-sev-memory-support.patch
Patch120: virtinst-default-xen-to-qcow2-format.patch
Patch121: virtinst-detect-oes-distros.patch
Patch122: virtinst-vol-default-nocow.patch
Patch123: virtinst-set-cache-mode-unsafe-for-install.patch
Patch124: virtinst-s390x-disable-graphics.patch
Patch125: virtinst-add-caasp-support.patch
Patch126: virtinst-add-sle15-detection-support.patch
Patch127: virtinst-add-pvh-support.patch
Patch128: virtinst-media-detection.patch
Patch129: virtinst-enable-video-virtio-for-arm.patch
# Bug Fixes
Patch151: virtman-increase-setKeepAlive-count.patch
Patch152: virtman-allow-destroy-from-shutdown-menu-of-crashed-vm.patch
Patch153: virtman-allow-creating-i686-vm.patch
Patch154: virtman-dont-specify-vte-version.patch
Patch155: virtman-dont-specify-gtksource-version.patch
Patch156: virtman-fix-restore-vm-menu-selection.patch
Patch157: virtman-disallow-adding-floppy-disk.patch
Patch158: virtman-register-delete-event-for-details-dialog.patch
Patch159: virtman-revert-use-of-AyatanaAppIndicator3.patch
Patch170: virtinst-xen-drive-type.patch
Patch171: virtinst-xenbus-disk-index-fix.patch
Patch172: virtinst-refresh_before_fetch_pool.patch
Patch173: virtinst-use-xenpae-kernel-for-32bit.patch
Patch174: virtinst-use-qemu-for-cdrom-device.patch
Patch175: virtinst-keep-install-iso-attached.patch
Patch176: virtinst-dont-use-special-copy-cpu-features.patch
Patch177: virtinst-set-default-nic.patch
Patch178: virtinst-sap-detection.patch
Patch179: virtinst-smbios-unsupported-for-xenpv.patch
Patch180: virtinst-keep-iso-for-xenpv.patch
Patch181: virtinst-add-slem-detection-support.patch
Patch182: virtinst-add-sle-hpc-support.patch
Patch183: virtinst-add-oracle-linux-support.patch
Patch184: virtinst-windows-server-detection.patch
Patch185: virtman-fix-shared-disk-request-alignment-error.patch
Patch186: virtman-language-fixes.patch
Patch187: virtman-fix-inspection-apps-window.patch
BuildArch: noarch
%define verrel %{version}-%{release}
Requires: dbus-1-x11
Requires: dconf
Requires: gstreamer-plugins-good
Requires: gtk3
Requires: python3-gobject
# For console widget
Requires: python3-cairo
Requires: python3-gobject-Gdk
Requires: python3-gobject-cairo
Recommends: python3-SpiceClientGtk
Requires: virt-install
Requires: virt-manager-common = %{verrel}
Requires: typelib(GtkSource)
%if %{with_guestfs}
Requires: python3-libguestfs
%endif
BuildRequires: gettext
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: python3-setuptools
%if %{with test}
BuildRequires: python3-argcomplete
BuildRequires: python3-pytest
BuildRequires: virt-install = %{version}
BuildRequires: virt-manager = %{version}
%endif
%description
Virtual Machine Manager provides a graphical tool for administering virtual
machines for KVM, Xen, and QEmu. Start, stop, add or remove virtual devices,
connect to a graphical or serial console, and see resource usage statistics
for existing VMs on local or remote machines. Uses libvirt as the backend
management API.
%package common
Summary: Common files used by the different Virtual Machine Manager interfaces
Group: System/Monitoring
# This version not strictly required: virt-manager should work with older,
# however varying amounts of functionality will not be enabled.
Requires: libosinfo >= 0.2.10
Requires: mkisofs
Requires: python3-gobject
Requires: python3-ipaddr
Requires: python3-libvirt-python >= 0.7.0
Requires: python3-libxml2-python
Requires: python3-pycurl
Requires: xorriso
Requires: typelib(AppIndicator3)
Requires: typelib(LibvirtGLib)
Suggests: python3-virt-bootstrap
BuildRequires: gobject-introspection
%description common
Common files used by the different virt-manager interfaces, as well as
virt-install related tools.
%package -n virt-install
Summary: Utilities for installing virtual machines
Group: System/Monitoring
Requires: virt-manager-common = %{verrel}
Requires: python3-requests
Provides: python3-virtinst
Provides: virt-clone
Supplements: virt-manager
%description -n virt-install
Package includes several command line utilities, including virt-install
(build and install new VMs) and virt-clone (clone an existing virtual
machine).
%prep
%autosetup -p1 -n virt-manager-%{version}
%if !%{with test}
%build
%if %{default_hvs}
%global _default_hvs --default-hvs %{default_hvs}
%endif
python3 setup.py configure \
--prefix=%{_prefix} \
--default-graphics="spice" \
%{?_default_hvs}
%install
python3 setup.py \
--no-update-icon-cache \
--no-compile-schemas install \
--prefix=%{_prefix} \
-O1 --root=%{buildroot}
mkdir -p %{buildroot}/%{_datadir}/YaST2/clients/
install -m644 %SOURCE1 %{buildroot}/%{_datadir}/YaST2/clients/virt-install.rb
mkdir -p %{buildroot}/%{_datadir}/applications/YaST2/
install -m644 %SOURCE2 %{buildroot}/%{_datadir}/applications/YaST2/virt-install.desktop
# Oddly, supportconfig doesn't execute plugins with '-' in the name, so use 'virt_manager'
mkdir -p %{buildroot}/usr/lib/supportconfig/plugins
install -m 755 %SOURCE3 %{buildroot}/usr/lib/supportconfig/plugins/virt_manager
chmod -x %{buildroot}%{_datadir}/virt-manager/virtManager/virtmanager.py
%find_lang %{name}
%endif
%if %{with test}
%check
# TODO: check if these are genuine failures or due to the non-upstream patches
# different device names
donttest="test_disk_numtotarget"
donttest="$donttest or testCLI0001virt_install_many_devices"
# depends on osc/obs host cpu?
donttest="$donttest or testCLI0003virt_install_singleton_config_2"
donttest="$donttest or testCLI0113virt_install_reinstall_cdrom"
donttest="$donttest or testCLI0165virt_install"
donttest="$donttest or testCLI0172virt_install_s390x_cdrom"
# Fedora specific
donttest="$donttest or testCLI0178virt_install_arm_defaultmach_f20"
donttest="$donttest or testCLI0179virt_install_arm_kvm_import"
donttest="$donttest or testCLI0193virt_install_xen_default"
donttest="$donttest or testCLI0194virt_install_xen_pv"
donttest="$donttest or testCLI0195virt_install_xen_hvm"
donttest="$donttest or testCLI0196virt_install_xen_hvm"
donttest="$donttest or testCLI0203virt_install_bhyve_default_f27"
donttest="$donttest or testCLI0280virt_xml_build_disk_domain"
donttest="$donttest or testCLI0287virt_xml_edit_cpu_host_copy"
donttest="$donttest or testCLI0288virt_xml_build_pool_logical_disk"
donttest="$donttest or testCLI0375virt_xml_add_disk_create_storage_start"
# Due to the above skips:
# "there are XML properties that are untested in the test suite"
donttest="$donttest or testCheckXMLBuilderProps"
# "These command line arguments or aliases are not checked in the test suite"
donttest="$donttest or testCheckCLISuboptions"
#
pytest -v -rfEs -k "not ($donttest)"
%endif
%post
/bin/touch --no-create %{_datadir}/icons/hicolor >/dev/null 2>&1 || :
/usr/bin/update-desktop-database > /dev/null 2>&1 || :
%postun
if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor >/dev/null 2>&1
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null 2>&1 || :
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas > /dev/null 2>&1 || :
fi
/usr/bin/update-desktop-database > /dev/null 2>&1 || :
%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null 2>&1 || :
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas > /dev/null 2>&1 || :
%if !%{with test}
%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/ui
%{_datadir}/%{name}/ui/*.ui
%{_datadir}/%{name}/virtManager
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/*/
%dir %{_datadir}/icons/hicolor/*/apps
%{_datadir}/%{name}/icons
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/YaST2/virt-install.desktop
%{_datadir}/glib-2.0/schemas/org.virt-manager.virt-manager.gschema.xml
%dir /usr/lib/supportconfig
%dir /usr/lib/supportconfig/plugins
/usr/lib/supportconfig/plugins/virt_manager
%files common -f %{name}.lang
%defattr(-,root,root,-)
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/virtinst
%files -n virt-install
%defattr(-,root,root,-)
%{_mandir}/man1/virt-install.1*
%{_mandir}/man1/virt-clone.1*
%{_mandir}/man1/virt-xml.1*
%{_bindir}/virt-install
%{_datadir}/bash-completion/completions/virt-install
%{_bindir}/virt-clone
%{_datadir}/bash-completion/completions/virt-clone
%{_bindir}/virt-xml
%{_datadir}/bash-completion/completions/virt-xml
%dir %{_datadir}/YaST2
%dir %{_datadir}/YaST2/clients
%dir %{_datadir}/applications/YaST2
%{_datadir}/YaST2/clients/virt-install.rb
%endif
%changelog

View File

@ -0,0 +1,52 @@
References: bsc#1010060
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -278,6 +278,12 @@ class _SUSEContent(object):
self.product_name.strip().rsplit(' ')[5][2])
distro_version = sle_version
+ # SUSE Container as a Service Platform
+ if "Container" in self.product_name:
+ distro_version = self.product_name.strip().rsplit(' ')[6]
+ elif "CaaS" in self.product_name:
+ distro_version = self.product_name.strip().rsplit(' ')[3]
+
return distro_version
@@ -564,6 +570,9 @@ class _SuseDistro(_RHELDistro):
version = distro_version.split('.', 1)[0].strip()
+ if self._variant_prefix.startswith(("caasp")):
+ return self._variant_prefix + distro_version
+
if str(self._variant_prefix).startswith(("sles", "sled", "oes")):
sp_version = ""
if len(distro_version.split('.', 1)) == 2:
@@ -633,6 +642,14 @@ class _OpensuseDistro(_SuseDistro):
famregex = ".*openSUSE.*"
+class _CAASPDistro(_SuseDistro):
+ PRETTY_NAME = "SLES"
+ matching_distros = ["caasp"]
+ _variant_prefix = "caasp"
+ _suse_regex = [".*SUSE Container as a Service Platform*", ".*SUSE CaaS Platform*"]
+ famregex = ".*(SUSE Container as a Service Platform|SUSE CaaS Platform).*"
+
+
class _OESDistro(_SuseDistro):
PRETTY_NAME = "OES"
matching_distros = ["oes"]
@@ -870,6 +887,7 @@ def _build_distro_list(osobj):
_SLESDistro,
_SLEDDistro,
_OpensuseDistro,
+ _CAASPDistro,
_OESDistro,
_DebianDistro,
_UbuntuDistro,

View File

@ -0,0 +1,41 @@
References: bsc#1192238, jsc#SLE-17764
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -724,6 +724,26 @@ class _OESDistro(_SuseDistro):
famregex = ".*Open Enterprise Server.*"
+class _OLDistro(_DistroTree):
+ PRETTY_NAME = "Oracle Linux"
+ matching_distros = ["ol"]
+ _variant_prefix = "ol"
+
+ @classmethod
+ def is_valid(cls, cache):
+ famregex = ".*Oracle Linux.*"
+ if cache.treeinfo_family_regex(famregex):
+ return True
+
+ def _detect_version(self):
+ if self.cache.treeinfo_version: # pragma: no cover
+ version, update = self.cache.split_version()
+ # Beginning with oracle 8 they add an extra '.0' which we ignore
+ olname = self._variant_prefix + str(version) + "." + str(update)
+ if OSDB.lookup_os(olname):
+ return olname
+
+
class _DebianDistro(_DistroTree):
# ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/
# daily builds: https://d-i.debian.org/daily-images/amd64/
@@ -950,6 +970,7 @@ def _build_distro_list(osobj):
_FedoraDistro,
_RHELDistro,
_CentOSDistro,
+ _OLDistro,
_SLEDistro,
_SLESDistro,
_SLEHPCDistro,

View File

@ -0,0 +1,69 @@
References: fate#326698 - Add pvh support to virt-manager
At this time support is disabled in this patch.
Index: virt-manager-4.1.0/virtManager/createvm.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/createvm.py
+++ virt-manager-4.1.0/virtManager/createvm.py
@@ -844,6 +844,9 @@ class vmmCreateVM(vmmGObjectUI):
break
if label is None:
continue
+ # xenpvh is currently unsupported
+ if guest.os_type == "xenpvh":
+ continue
# Determine if this is the default given by guest_lookup
if (gtype == self._capsinfo.os_type and
Index: virt-manager-4.1.0/virtinst/domain/os.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/domain/os.py
+++ virt-manager-4.1.0/virtinst/domain/os.py
@@ -46,6 +46,8 @@ class DomainOs(XMLBuilder):
return self.os_type == "hvm"
def is_xenpv(self):
return self.os_type in ["xen", "linux"]
+ def is_xenpvh(self):
+ return self.os_type in ["xenpvh", "linux"]
def is_container(self):
return self.os_type == "exe"
Index: virt-manager-4.1.0/virtinst/guest.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/guest.py
+++ virt-manager-4.1.0/virtinst/guest.py
@@ -910,7 +910,7 @@ class Guest(XMLBuilder):
usb_tablet = False
usb_keyboard = False
- if self.os.is_x86() and not self.os.is_xenpv():
+ if self.os.is_x86() and not self.os.is_xenpv() and not self.os.is_xenpvh():
usb_tablet = True
if (self.os.is_arm_machvirt() or
self.os.is_riscv_virt() or
Index: virt-manager-4.1.0/virtManager/object/domain.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/object/domain.py
+++ virt-manager-4.1.0/virtManager/object/domain.py
@@ -1310,6 +1310,8 @@ class vmmDomain(vmmLibvirtObject):
return self.get_xmlobj().os.is_xenpv()
def is_hvm(self):
return self.get_xmlobj().os.is_hvm()
+ def is_xenpvh(self):
+ return self.get_xmlobj().os.is_xenpvh()
def get_uuid(self):
if self._uuid is None:
Index: virt-manager-4.1.0/virtManager/connection.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/connection.py
+++ virt-manager-4.1.0/virtManager/connection.py
@@ -211,6 +211,8 @@ class vmmConnection(vmmGObject):
label = "xen (paravirt)"
elif gtype == "hvm":
label = "xen (fullvirt)"
+ elif gtype == "xenpvh":
+ label = "xen (pvh - Technical Preview)"
elif domtype == "test":
if gtype == "xen":
label = "test (xen)"

View File

@ -0,0 +1,47 @@
References: bsc#1190215
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -274,12 +274,17 @@ class _SUSEContent(object):
if "Enterprise" in self.product_name or "SLES" in self.product_name:
if " SAP " in self.product_name:
sle_version = self.product_name.strip().rsplit(' ')[7]
+ if " High Performance " in self.product_name:
+ sle_version = self.product_name.strip().rsplit(' ')[6]
else:
sle_version = self.product_name.strip().rsplit(' ')[4]
if len(self.product_name.strip().rsplit(' ')) > 5 and not " Micro " in self.product_name:
if " SAP " in self.product_name:
sle_version = (sle_version + '.' +
self.product_name.strip().rsplit(' ')[8][2])
+ if " High Performance " in self.product_name:
+ sle_version = (sle_version + '.' +
+ self.product_name.strip().rsplit(' ')[7][2])
else:
sle_version = (sle_version + '.' +
self.product_name.strip().rsplit(' ')[5][2])
@@ -671,6 +676,14 @@ class _SLESDistro(_SuseDistro):
famregex = ".*SUSE Linux Enterprise.*"
+class _SLEHPCDistro(_SuseDistro):
+ PRETTY_NAME = "SLE-HPC"
+ matching_distros = ["sle-hpc"]
+ _variant_prefix = "sles"
+ _suse_regex = [".*SUSE Linux Enterprise High Performance Computing*", ".*SUSE SLE-HPC*", ".*SUSE SLE_HPC*"]
+ famregex = ".*SUSE Linux Enterprise.*"
+
+
class _SLEDDistro(_SuseDistro):
PRETTY_NAME = "SLED"
matching_distros = ["sled"]
@@ -939,6 +952,7 @@ def _build_distro_list(osobj):
_CentOSDistro,
_SLEDistro,
_SLESDistro,
+ _SLEHPCDistro,
_SLEDDistro,
_OpensuseDistro,
_MICRODistro,

View File

@ -0,0 +1,52 @@
References: bsc#1054986
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -597,6 +597,10 @@ class _SuseDistro(_RHELDistro):
if re.search("openSUSE Tumbleweed", self.cache.treeinfo_name):
return "opensusetumbleweed"
+ sp_version = False
+ if ' SP' in self.cache.treeinfo_version:
+ sp_version = True
+ self.cache.treeinfo_version = self.cache.treeinfo_version.replace(' SP', '.')
version, update = self.cache.split_version()
base = self._variant_prefix + str(version)
while update >= 0:
@@ -604,7 +608,10 @@ class _SuseDistro(_RHELDistro):
# SLE doesn't use '.0' for initial releases in
# osinfo-db (sles11, sles12, etc)
if update > 0 or not base.startswith('sle'):
- tryvar += ".%s" % update
+ if sp_version:
+ tryvar += "sp%s" % update
+ else:
+ tryvar += ".%s" % update
if OSDB.lookup_os(tryvar):
return tryvar
update -= 1
@@ -618,6 +625,14 @@ class _SuseDistro(_RHELDistro):
return var
+class _SLEDistro(_SuseDistro):
+ PRETTY_NAME = "SLE"
+ matching_distros = ["sle"]
+ _variant_prefix = "sle"
+ _suse_regex = ["SUSE Linux Enterprise$"]
+ famregex = "SUSE Linux Enterprise$"
+
+
class _SLESDistro(_SuseDistro):
PRETTY_NAME = "SLES"
matching_distros = ["sles"]
@@ -884,6 +899,7 @@ def _build_distro_list(osobj):
_FedoraDistro,
_RHELDistro,
_CentOSDistro,
+ _SLEDistro,
_SLESDistro,
_SLEDDistro,
_OpensuseDistro,

View File

@ -0,0 +1,49 @@
Add support for detecting SUSE Linux Enterprise Micro.
See also the osinfo-db package for the description file.
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -276,7 +276,7 @@ class _SUSEContent(object):
sle_version = self.product_name.strip().rsplit(' ')[7]
else:
sle_version = self.product_name.strip().rsplit(' ')[4]
- if len(self.product_name.strip().rsplit(' ')) > 5:
+ if len(self.product_name.strip().rsplit(' ')) > 5 and not " Micro " in self.product_name:
if " SAP " in self.product_name:
sle_version = (sle_version + '.' +
self.product_name.strip().rsplit(' ')[8][2])
@@ -597,6 +597,9 @@ class _SuseDistro(_RHELDistro):
version = distro_version.split('.', 1)[0].strip()
+ if self._variant_prefix.startswith(("slem")):
+ return self._variant_prefix + distro_version
+
if self._variant_prefix.startswith(("caasp")):
return self._variant_prefix + distro_version
@@ -684,6 +687,14 @@ class _OpensuseDistro(_SuseDistro):
famregex = ".*openSUSE.*"
+class _MICRODistro(_SuseDistro):
+ PRETTY_NAME = "SLES"
+ matching_distros = ["slem"]
+ _variant_prefix = "slem"
+ _suse_regex = [".*SUSE Linux Enterprise Micro*", ".*SUSE Micro*"]
+ famregex = ".*SUSE Linux Enterprise Micro.*"
+
+
class _CAASPDistro(_SuseDistro):
PRETTY_NAME = "SLES"
matching_distros = ["caasp"]
@@ -930,6 +941,7 @@ def _build_distro_list(osobj):
_SLESDistro,
_SLEDDistro,
_OpensuseDistro,
+ _MICRODistro,
_CAASPDistro,
_OESDistro,
_DebianDistro,

View File

@ -0,0 +1,31 @@
References: fate#326960, bsc#1123942
Index: virt-manager-4.1.0/virtinst/install/installer.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/install/installer.py
+++ virt-manager-4.1.0/virtinst/install/installer.py
@@ -592,7 +592,10 @@ class Installer(object):
guest.bootloader = "pygrub"
else:
guest.bootloader = None
- self._treemedia_bootconfig = ("/usr/lib/grub2/x86_64-xen/grub.xen", "", "")
+ if os.path.exists("/usr/share/grub2/x86_64-xen/grub.xen"):
+ self._treemedia_bootconfig = ("/usr/share/grub2/x86_64-xen/grub.xen", "", "")
+ else:
+ self._treemedia_bootconfig = ("/usr/lib/grub2/x86_64-xen/grub.xen", "", "")
log.debug("Using grub.xen to boot guest")
on_reboot_value = guest.on_reboot
self._alter_bootconfig(guest)
Index: virt-manager-4.1.0/virtManager/delete.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/delete.py
+++ virt-manager-4.1.0/virtManager/delete.py
@@ -459,7 +459,7 @@ def _populate_storage_list(storage_list,
model.clear()
for diskdata in diskdatas:
- if not diskdata.path or diskdata.path == "/usr/lib/grub2/x86_64-xen/grub.xen":
+ if not diskdata.path or "grub.xen" in diskdata.path:
continue
# There are a few pieces here

View File

@ -0,0 +1,15 @@
Reference: bnc#885380
Allow Xen based VMs to default to using qcow2
Index: virt-manager-3.0.0/virtinst/support.py
===================================================================
--- virt-manager-3.0.0.orig/virtinst/support.py
+++ virt-manager-3.0.0/virtinst/support.py
@@ -242,7 +242,7 @@ class SupportCache:
# This is an arbitrary check to say whether it's a good idea to
# default to qcow2. It might be fine for xen or qemu older than the versions
# here, but until someone tests things I'm going to be a bit conservative.
- conn_default_qcow2 = _make(hv_version={"qemu": "1.2.0", "test": 0})
+ conn_default_qcow2 = _make(hv_version={"qemu": "1.2.0", "all": 0})
conn_autosocket = _make(hv_libvirt_version={"qemu": "1.0.6"})
conn_pm_disable = _make(hv_version={"qemu": "1.2.0", "test": 0})
conn_qcow2_lazy_refcounts = _make(

View File

@ -0,0 +1,38 @@
Enhancement to correctly detect Open Enterprise Server media is
selected as the installation source.
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -564,7 +564,7 @@ class _SuseDistro(_RHELDistro):
version = distro_version.split('.', 1)[0].strip()
- if str(self._variant_prefix).startswith(("sles", "sled")):
+ if str(self._variant_prefix).startswith(("sles", "sled", "oes")):
sp_version = ""
if len(distro_version.split('.', 1)) == 2:
sp_version = 'sp' + distro_version.split('.', 1)[1].strip()
@@ -633,6 +633,14 @@ class _OpensuseDistro(_SuseDistro):
famregex = ".*openSUSE.*"
+class _OESDistro(_SuseDistro):
+ PRETTY_NAME = "OES"
+ matching_distros = ["oes"]
+ _variant_prefix = "oes"
+ _suse_regex = [".*Open Enterprise Server*"]
+ famregex = ".*Open Enterprise Server.*"
+
+
class _DebianDistro(_DistroTree):
# ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/
# daily builds: https://d-i.debian.org/daily-images/amd64/
@@ -862,6 +870,7 @@ def _build_distro_list(osobj):
_SLESDistro,
_SLEDDistro,
_OpensuseDistro,
+ _OESDistro,
_DebianDistro,
_UbuntuDistro,
_MageiaDistro,

View File

@ -0,0 +1,38 @@
References: bsc#1067018 - L3: KVM Guest creation failed - Property .cmt not found
Some hardware has the .cmt cpu feature but qemu doesn't support it. libvirt
includes it in the cpu capabilities read in by virt-manager. Using 'host-model'
was known to have issues in the past and so a copy method was set up to
manually copy cpu features one at a time (including the unsupported cmt flag).
This patch simply avoids the special copy feature when "Copy host CPU definition"
is set in the Preferences -> New VM -> CPU Default pop-up menu and falls
back to using 'host-model'.
It should be noted that selecting "Customize configuration before install"
and "CPUs" -> "Copy host CPU definition" also inserts 'host-model' so
this change mirrors what is already done there.
Index: virt-manager-4.1.0/virtinst/domain/cpu.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/domain/cpu.py
+++ virt-manager-4.1.0/virtinst/domain/cpu.py
@@ -295,7 +295,8 @@ class DomainCpu(XMLBuilder):
log.debug("Using default cpu mode=%s", val)
if (val == self.SPECIAL_MODE_HOST_MODEL or
- val == self.SPECIAL_MODE_HOST_PASSTHROUGH):
+ val == self.SPECIAL_MODE_HOST_PASSTHROUGH or
+ val == self.SPECIAL_MODE_HOST_COPY):
self.model = None
self.vendor = None
self.model_fallback = None
@@ -303,6 +304,9 @@ class DomainCpu(XMLBuilder):
self.check = None
for f in self.features:
self.remove_child(f)
+ if val == self.SPECIAL_MODE_HOST_COPY:
+ val = self.SPECIAL_MODE_HOST_MODEL
+ self.match = "exact"
self.mode = val
elif (val == self.SPECIAL_MODE_HV_DEFAULT or
val == self.SPECIAL_MODE_CLEAR):

View File

@ -0,0 +1,181 @@
References: bsc#1201748
Enable video virtio on arm if domain caps reports it is supported.
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-cdrom.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-aarch64-cdrom.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-cdrom.xml
@@ -63,6 +63,18 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich9"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
@@ -131,6 +143,18 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich9"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-firmware-no-override.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-aarch64-firmware-no-override.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-firmware-no-override.xml
@@ -43,6 +43,12 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="vnc" port="-1"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
@@ -95,6 +101,12 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="vnc" port="-1"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-kvm-gic.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-aarch64-kvm-gic.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-kvm-gic.xml
@@ -56,6 +56,12 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="vnc" port="-1"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-machdefault.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-aarch64-machdefault.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-machdefault.xml
@@ -55,6 +55,18 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich9"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-machvirt.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-aarch64-machvirt.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-machvirt.xml
@@ -55,6 +55,18 @@
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich9"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
Index: virt-manager-4.1.0/virtinst/guest.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/guest.py
+++ virt-manager-4.1.0/virtinst/guest.py
@@ -1029,7 +1029,10 @@ class Guest(XMLBuilder):
return
if (not self.os.is_x86() and
not self.os.is_pseries()):
- return
+ if (not self.os.is_arm_machvirt() or
+ not self.lookup_domcaps().supports_video_virtio()):
+ log.debug("Domain caps reports video virtio is not supported.")
+ return
self.add_device(DeviceGraphics(self.conn))
def _add_default_rng(self):
Index: virt-manager-4.1.0/virtinst/devices/video.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/devices/video.py
+++ virt-manager-4.1.0/virtinst/devices/video.py
@@ -6,6 +6,7 @@
from .device import Device
from ..xmlbuilder import XMLProperty
+from ..logger import log
class DeviceVideo(Device):
@@ -32,8 +33,11 @@ class DeviceVideo(Device):
if guest.os.is_pseries():
return "vga"
if guest.os.is_arm_machvirt():
- # For all cases here the hv and guest are new enough for virtio
- return "virtio"
+ if guest.lookup_domcaps().supports_video_virtio():
+ # For all cases here the hv and guest are new enough for virtio
+ return "virtio"
+ log.debug("Domain caps reports video virtio is not supported.")
+ return "none"
if guest.os.is_riscv_virt():
# For all cases here the hv and guest are new enough for virtio
return "virtio"

View File

@ -0,0 +1,18 @@
Older SLE guests have a two stage installation that need the ISO.
Newer SLE PV guests hang when a cdrom device is attached without
an ISO file.
Index: virt-manager-3.3.0/virtinst/install/installer.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/installer.py
+++ virt-manager-3.3.0/virtinst/install/installer.py
@@ -168,7 +168,8 @@ class Installer(object):
def _remove_install_cdrom_media(self, guest):
if not self._install_cdrom_device_added:
return
- if guest.osinfo.is_windows():
+ if (guest.osinfo.is_windows() or
+ guest.osinfo.name.startswith(("sles", "sled", "opensuse"))):
# Keep media attached for windows which has a multi stage install
return
for disk in guest.devices.disk:

View File

@ -0,0 +1,20 @@
References: bsc#1180897
Removing the cdrom iso file from the device prevents booting
with a qemu error.
Index: virt-manager-3.3.0/virtinst/install/installer.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/installer.py
+++ virt-manager-3.3.0/virtinst/install/installer.py
@@ -175,8 +175,9 @@ class Installer(object):
for disk in guest.devices.disk:
if (disk.is_cdrom() and
disk.get_source_path() == self._cdrom_path()):
- disk.set_source_path(None)
- disk.sync_path_props()
+ if not guest.os.is_xenpv():
+ disk.set_source_path(None)
+ disk.sync_path_props()
break
def _add_unattended_install_cdrom_device(self, guest, location):

View File

@ -0,0 +1,34 @@
When both the content file and .treeinfo file are missing from the media
look in the media.1/products and media.1/media files for information.
Caasp 4.0 has not content or .treeinfo file on the media
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -505,8 +505,23 @@ class _SuseDistro(_RHELDistro):
cache.checked_for_suse_content = True
content_str = cache.acquire_file_content("content")
if content_str is None:
- return False
-
+ products_str = cache.acquire_file_content("media.1/products")
+ if products_str:
+ products_str = products_str.replace('/', ' ,', 1)
+ products_str = "DISTRO " + products_str.replace('-', ' ')
+ media_str = cache.acquire_file_content("media.1/media")
+ if media_str:
+ media_arch = "x86_64"
+ if 'aarch64' in media_str:
+ media_arch = "aarch64"
+ elif 'ppc64le' in media_str:
+ media_arch = "ppc64le"
+ elif 's390x' in media_str:
+ media_arch = "s390x"
+ media_str = 'BASEARCHS ' + media_arch
+ if products_str is None and media_str is None:
+ return False
+ content_str = products_str + "\n" + media_str
try:
cache.suse_content = _SUSEContent(content_str)
except Exception as e: # pragma: no cover

View File

@ -0,0 +1,40 @@
Reference: bnc#863821
grub.xen is required to boot PV VMs that use the BTRFS filesystem.
This patch forces the use of grub.xen (instead of using pygrub) for
suse distros SLE12GA, openSUSE 13.2, and newer.
Index: virt-manager-4.0.0/virtinst/install/installer.py
===================================================================
--- virt-manager-4.0.0.orig/virtinst/install/installer.py
+++ virt-manager-4.0.0/virtinst/install/installer.py
@@ -222,7 +222,8 @@ class Installer(object):
def _alter_treemedia_bootconfig(self, guest):
if not self._treemedia:
- return
+ if not self._treemedia_bootconfig or "grub.xen" not in self._treemedia_bootconfig[0]:
+ return
kernel, initrd, kernel_args = self._treemedia_bootconfig
if kernel:
@@ -582,6 +583,21 @@ class Installer(object):
final_xml = guest.get_xml()
if self._requires_postboot_xml_changes():
initial_xml, final_xml = self._build_postboot_xml(final_xml, meter)
+ if (guest.os.is_xenpv() and
+ not guest.os.kernel):
+ os_ver = guest.osinfo.name
+ if guest.os.arch != 'x86_64' or os_ver.startswith("sles9") or \
+ os_ver.startswith("sles10") or os_ver.startswith("sled10") or \
+ os_ver.startswith("opensuse10") or os_ver.startswith("opensuse11"):
+ guest.bootloader = "pygrub"
+ else:
+ guest.bootloader = None
+ self._treemedia_bootconfig = ("/usr/lib/grub2/x86_64-xen/grub.xen", "", "")
+ log.debug("Using grub.xen to boot guest")
+ on_reboot_value = guest.on_reboot
+ self._alter_bootconfig(guest)
+ guest.on_reboot = on_reboot_value
+ final_xml = guest.get_xml()
final_xml = self._pre_reinstall_xml or final_xml
log.debug("Generated initial_xml: %s",

View File

@ -0,0 +1,39 @@
Reference: bnc#887868
Refresh pools status before fetch_pools.
Currently, when connecting to hypervisor, if there are pools active
but in fact target path already deleted (or for other reasons the
pool is not working), libvirtd not refresh status yet, fetch_pools
will fail, that will cause "connecting to hypervisor" process
reporting error and exit. The whole connection work failed.
With the patch, always refresh pool status before fetch pools. Let
the libvirtd pool status reflect the reality, avoid the non-synced
status affects the hypervisor connection.
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Index: virt-manager-3.0.0/virtinst/pollhelpers.py
===================================================================
--- virt-manager-3.0.0.orig/virtinst/pollhelpers.py
+++ virt-manager-3.0.0/virtinst/pollhelpers.py
@@ -48,6 +48,19 @@ def fetch_pools(backend, origmap, build_
typename = "pool"
list_cb = backend.listAllStoragePools
support_cb = backend.support.conn_storage
+
+ # Refresh pools before poll_helper. For those
+ # 'active' but target path not exist (or other reasons
+ # causing the pool not working), but libvirtd not
+ # refresh the status, this will make it refreshed
+ # and mark that pool as 'inactive'.
+ objs = backend.listAllStoragePools()
+ for obj in objs:
+ try:
+ obj.refresh(0)
+ except Exception as e: # pragma: no cover
+ pass
+
return _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb)

View File

@ -0,0 +1,36 @@
Reference: bnc#869024
Disable graphics on s390x
Index: virt-manager-4.1.0/virtinst/guest.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/guest.py
+++ virt-manager-4.1.0/virtinst/guest.py
@@ -208,7 +208,10 @@ class Guest(XMLBuilder):
self.skip_default_channel = False
self.skip_default_sound = False
self.skip_default_usbredir = False
- self.skip_default_graphics = False
+ if self.os.is_s390x():
+ self.skip_default_graphics = True
+ else:
+ self.skip_default_graphics = False
self.skip_default_rng = False
self.skip_default_tpm = False
self.x86_cpu_default = self.cpu.SPECIAL_MODE_APP_DEFAULT
@@ -358,7 +361,7 @@ class Guest(XMLBuilder):
if not os_support:
return False
- if self.os.is_x86():
+ if self.os.is_x86() or self.os.is_s390x():
return True
return False # pragma: no cover
@@ -957,7 +960,7 @@ class Guest(XMLBuilder):
self.add_device(dev)
def _add_default_video_device(self):
- if self.os.is_container():
+ if self.os.is_container() or self.os.is_s390x():
return
if self.devices.video:
return

View File

@ -0,0 +1,23 @@
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -272,9 +272,16 @@ class _SUSEContent(object):
distro_version = distro_version.strip()
if "Enterprise" in self.product_name or "SLES" in self.product_name:
- sle_version = self.product_name.strip().rsplit(' ')[4]
+ if " SAP " in self.product_name:
+ sle_version = self.product_name.strip().rsplit(' ')[7]
+ else:
+ sle_version = self.product_name.strip().rsplit(' ')[4]
if len(self.product_name.strip().rsplit(' ')) > 5:
- sle_version = (sle_version + '.' +
+ if " SAP " in self.product_name:
+ sle_version = (sle_version + '.' +
+ self.product_name.strip().rsplit(' ')[8][2])
+ else:
+ sle_version = (sle_version + '.' +
self.product_name.strip().rsplit(' ')[5][2])
distro_version = sle_version

View File

@ -0,0 +1,506 @@
Set cache mode for target installation disk to unsafe for better
performance.
Index: virt-manager-4.1.0/virtinst/install/installer.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/install/installer.py
+++ virt-manager-4.1.0/virtinst/install/installer.py
@@ -567,16 +567,29 @@ class Installer(object):
def _build_postboot_xml(self, final_xml, meter):
initial_guest = Guest(self.conn, parsexml=final_xml)
+ # At install time set the target disk to 'unsafe' for
+ # better performance if the target is not a block device
+ saved_cache = "None"
+ if initial_guest.devices.disk:
+ target_disk = initial_guest.devices.disk[0]
+ saved_cache = target_disk.driver_cache
+ if target_disk.type != DeviceDisk.TYPE_BLOCK and target_disk.driver_io != "native":
+ target_disk.driver_cache = DeviceDisk.CACHE_MODE_UNSAFE
+
self._alter_bootconfig(initial_guest)
self._alter_install_resources(initial_guest, meter)
if self.has_cloudinit():
initial_guest.set_smbios_serial_cloudinit()
+ install_xml = initial_guest.get_xml()
+ if saved_cache != "None":
+ target_disk.driver_cache = saved_cache
+
final_guest = Guest(self.conn, parsexml=final_xml)
self._remove_install_cdrom_media(final_guest)
self._remove_unattended_install_cdrom_device(final_guest)
- return initial_guest.get_xml(), final_guest.get_xml()
+ return install_xml, final_guest.get_xml()
def _build_xml(self, guest, meter):
initial_xml = None
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cdrom-url.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cdrom-url.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cdrom-url.xml
@@ -24,6 +24,7 @@
</source>
<target dev="hda" bus="ide"/>
<readonly/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-memory-hotplug.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-memory-hotplug.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-memory-hotplug.xml
@@ -35,7 +35,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2" discard="unmap"/>
+ <driver name="qemu" type="qcow2" discard="unmap" cache="unsafe"/>
<source file="/var/lib/libvirt/images/fedora.qcow2"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cdrom-double.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cdrom-double.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cdrom-double.xml
@@ -22,6 +22,7 @@
<disk type="file" device="disk">
<source file="/var/lib/libvirt/images/vm1.qcow2"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<disk type="file" device="cdrom">
<source file="/pool-dir/testvol1.img"/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-default.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cloud-init-default.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-default.xml
@@ -26,6 +26,7 @@
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options1.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cloud-init-options1.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options1.xml
@@ -37,6 +37,7 @@ chpasswd:
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options2.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cloud-init-options2.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options2.xml
@@ -37,6 +37,7 @@ users:
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options3.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cloud-init-options3.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options3.xml
@@ -32,6 +32,7 @@ users:
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options4.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cloud-init-options4.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options4.xml
@@ -26,6 +26,7 @@
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options5.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cloud-init-options5.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cloud-init-options5.xml
@@ -26,6 +26,7 @@
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-multiple-short-id.xml
@@ -31,7 +31,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-url-with-disk.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-win7-unattended.xml
@@ -36,7 +36,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="cdrom">
- <driver name="qemu"/>
+ <driver name="qemu" cache="unsafe"/>
<source file="TESTSUITE_SCRUBBED/tests/data/fakemedia/fake-win7.iso"/>
<target dev="sda" bus="sata"/>
<readonly/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-osvariant-defaults-pxe.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-osvariant-defaults-pxe.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-osvariant-defaults-pxe.xml
@@ -28,6 +28,7 @@
<disk type="file" device="disk">
<source file="/var/lib/libvirt/images/fedora26.qcow2"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-reinstall-location.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-reinstall-location.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-reinstall-location.xml
@@ -22,7 +22,7 @@
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="disk">
- <driver type="qcow2"/>
+ <driver type="qcow2" cache="unsafe"/>
<source file="/pool-dir/test-clone-simple.img"/>
<target dev="hda" bus="ide"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-reinstall-pxe.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-reinstall-pxe.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-reinstall-pxe.xml
@@ -21,7 +21,7 @@
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="disk">
- <driver type="qcow2"/>
+ <driver type="qcow2" cache="unsafe"/>
<source file="/pool-dir/test-clone-simple.img"/>
<target dev="hda" bus="ide"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-w2k3-cdrom.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-w2k3-cdrom.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-w2k3-cdrom.xml
@@ -35,6 +35,7 @@
<disk type="file" device="disk">
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<disk type="file" device="cdrom">
<source file="/pool-dir/testvol2.img"/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-cdrom.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-aarch64-cdrom.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-aarch64-cdrom.xml
@@ -26,7 +26,7 @@
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-cdrom-centos-label.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-cdrom-centos-label.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-cdrom-centos-label.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-centos7.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-centos7.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-centos7.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-cpu-default-fallback.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-cpu-default-fallback.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-cpu-default-fallback.xml
@@ -34,7 +34,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-cpu-hostmodel-fallback.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-cpu-hostmodel-fallback.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-cpu-hostmodel-fallback.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-fedoralatest-url.xml
@@ -33,7 +33,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-rhel5.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-rhel5.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-rhel5.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-rhel6.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-rhel6.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-rhel6.xml
@@ -33,7 +33,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-rhel7.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-rhel7.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-rhel7.xml
@@ -33,7 +33,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-session-defaults.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-session-defaults.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-session-defaults.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2" discard="unmap"/>
+ <driver name="qemu" type="qcow2" discard="unmap" cache="unsafe"/>
<source file="/tmp/.local/share/libvirt/images/fedora21.qcow2"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-win10.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-win10.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-win10.xml
@@ -38,7 +38,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="sda" bus="sata"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-kvm-win2k3-cdrom.xml
@@ -38,7 +38,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-linux2020.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-linux2020.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-linux2020.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2" discard="unmap"/>
+ <driver name="qemu" type="qcow2" discard="unmap" cache="unsafe"/>
<source file="/var/lib/libvirt/images/linux2020.qcow2"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-location-iso.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-location-iso.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-location-iso.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-location-manual-kernel.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-location-manual-kernel.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-location-manual-kernel.xml
@@ -27,7 +27,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="cdrom">
- <driver name="qemu"/>
+ <driver name="qemu" cache="unsafe"/>
<source file="TESTSUITE_SCRUBBED/tests/data/fakemedia/fake-no-osinfo.iso"/>
<target dev="hda" bus="ide"/>
<readonly/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-osinfo-netinst-unattended.xml
@@ -32,7 +32,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="cdrom">
- <driver name="qemu"/>
+ <driver name="qemu" cache="unsafe"/>
<source file="TESTSUITE_SCRUBBED/tests/data/fakemedia/fake-f26-netinst.iso"/>
<target dev="sda" bus="sata"/>
<readonly/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-q35-defaults.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-q35-defaults.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-q35-defaults.xml
@@ -27,7 +27,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="sda" bus="sata"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-remote-storage.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-remote-storage.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-remote-storage.xml
@@ -22,6 +22,7 @@
<disk type="file" device="disk">
<source file="/foo/bar/baz"/>
<target dev="hda" bus="ide"/>
+ <driver cache="unsafe"/>
</disk>
<disk type="block" device="disk">
<source dev="/dev/zde"/>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-unattended-remote-cdrom.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-unattended-remote-cdrom.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-unattended-remote-cdrom.xml
@@ -32,6 +32,7 @@
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
<readonly/>
+ <driver cache="unsafe"/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-win7-uefi.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-win7-uefi.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-win7-uefi.xml
@@ -40,7 +40,7 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="sda" bus="sata"/>
</disk>
Index: virt-manager-4.1.0/tests/data/cli/compare/virt-install-xen-pv.xml
===================================================================
--- virt-manager-4.1.0.orig/tests/data/cli/compare/virt-install-xen-pv.xml
+++ virt-manager-4.1.0/tests/data/cli/compare/virt-install-xen-pv.xml
@@ -16,7 +16,7 @@
</os>
<devices>
<disk type="file" device="disk">
- <driver name="qemu" type="qcow2"/>
+ <driver name="qemu" type="qcow2" cache="unsafe"/>
<source file="/pool-dir/testvol1.img"/>
<target dev="xvda" bus="xen"/>
</disk>

View File

@ -0,0 +1,17 @@
References: bsc#1172356, bsc#1177620
Libvirt doesn't accept "Hypervisor default" as a model name
Index: virt-manager-4.0.0/virtinst/devices/interface.py
===================================================================
--- virt-manager-4.0.0.orig/virtinst/devices/interface.py
+++ virt-manager-4.0.0/virtinst/devices/interface.py
@@ -305,6 +305,9 @@ class DeviceInterface(Device):
return "e1000e"
if not guest.os.is_x86():
return None
+ if guest.conn.is_xen() and guest.os.is_hvm():
+ # Let libvirt decide the default
+ return None
prefs = ["e1000", "rtl8139", "ne2k_pci", "pcnet"]
supported_models = guest.osinfo.supported_netmodels()

View File

@ -0,0 +1,18 @@
Use the correct qemu emulator based on the architecture.
We want to get away from using the old qemu-dm emulator
for Xen HVM guests so default to qemu-system-i386.
Index: virt-manager-4.1.0/virtinst/guest.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/guest.py
+++ virt-manager-4.1.0/virtinst/guest.py
@@ -802,6 +802,10 @@ class Guest(XMLBuilder):
self._add_default_tpm()
self.clock.set_defaults(self)
+ if self.os.is_hvm() and self.type == "xen":
+ # Force not using Xen's old qemu-dm
+ if not self.emulator or "qemu-dm" in self.emulator:
+ self.emulator = "/usr/lib/xen/bin/qemu-system-i386"
self.cpu.set_defaults(self)
self.features.set_defaults(self)
for seclabel in self.seclabels:

View File

@ -0,0 +1,15 @@
References: bsc#1180069
Index: virt-manager-4.1.0/virtinst/guest.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/guest.py
+++ virt-manager-4.1.0/virtinst/guest.py
@@ -711,6 +711,8 @@ class Guest(XMLBuilder):
self.type != "kvm"):
log.warning( # pragma: no cover
"KVM acceleration not available, using '%s'", self.type)
+ if self.os.is_xenpv() and self.os.smbios_mode is not None:
+ raise RuntimeError(_("The --sysinfo flag (smbios) is not supported for Xen PV guests."))
def refresh_machine_type(self):
"""

View File

@ -0,0 +1,18 @@
References: bsc#989639
When the device added is a cdrom device (/dev/sr0), don't use
"phy" as the driver name but instead use "qemu".
Index: virt-manager-4.1.0/virtinst/devices/disk.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/devices/disk.py
+++ virt-manager-4.1.0/virtinst/devices/disk.py
@@ -533,7 +533,8 @@ class DeviceDisk(Device):
# Recommended xen defaults from here:
# https://bugzilla.redhat.com/show_bug.cgi?id=1171550#c9
# If type block, use name=phy. Otherwise do the same as qemu
- if self.conn.is_xen() and self.type == self.TYPE_BLOCK:
+ if self.conn.is_xen() and self.type == self.TYPE_BLOCK and not \
+ self.is_cdrom():
return self.DRIVER_NAME_PHY
if self.conn.support.conn_disk_driver_name_qemu():
return self.DRIVER_NAME_QEMU

View File

@ -0,0 +1,28 @@
References: bsc#978173
The 32bit versions of the media contain a xenpae version along with
a non pae version. The sles10 sp4 32bit kernel will only boot para-
virtualized if the pae kernel is selected.
Note that sles12 and newer has no 32bit release.
Index: virt-manager-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -550,9 +550,14 @@ class _SuseDistro(_RHELDistro):
if self.type == "xen":
# Matches Opensuse > 10.2 and sles 10
- self._kernel_paths.append(
- ("boot/%s/vmlinuz-xen" % tree_arch,
- "boot/%s/initrd-xen" % tree_arch))
+ if tree_arch == "i386":
+ self._kernel_paths.append(
+ ("boot/%s/vmlinuz-xenpae" % tree_arch,
+ "boot/%s/initrd-xenpae" % tree_arch))
+ else:
+ self._kernel_paths.append(
+ ("boot/%s/vmlinuz-xen" % tree_arch,
+ "boot/%s/initrd-xen" % tree_arch))
if str(self._os_variant).startswith(("sles11", "sled11")):
if tree_arch == "s390x":

View File

@ -0,0 +1,34 @@
Reference: fate#315125:
Set NOCOW flag to newly created volume by default, to solve performance
issue on btrfs.
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Index: virt-manager-4.1.0/virtinst/storage.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/storage.py
+++ virt-manager-4.1.0/virtinst/storage.py
@@ -567,6 +567,11 @@ class StorageVolume(_StorageObject):
return self._pool_xml.get_disk_type()
file_type = property(_get_vol_type)
+ def _nocow_default_cb(self):
+ return self.conn.check_support(
+ self.conn.conn_nocow)
+ nocow = XMLProperty("./target/nocow", is_bool=True)
+
##################
# XML properties #
Index: virt-manager-4.1.0/virtinst/support.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/support.py
+++ virt-manager-4.1.0/virtinst/support.py
@@ -269,6 +269,7 @@ class SupportCache:
conn_vnc_none_auth = _make(hv_version={"qemu": "2.9.0"})
conn_device_boot_order = _make(hv_version={"qemu": 0, "test": 0})
conn_riscv_virt_pci_default = _make(version="5.3.0", hv_version={"qemu": "4.0.0"})
+ conn_nocow = _make(version="1.2.18", hv_version={"qemu": "2.2.0", "test": 0})
# We choose qemu 2.11.0 as the first version to target for q35 default.
# That's not really based on anything except reasonably modern at the

View File

@ -0,0 +1,23 @@
References: bsc#1194323
Windows server 2k16, 2k19, and 2k22 have the volumen ID
so libosinfo can't really tell them apart.
This hack after detecting a windows ISO just looks at the
ISO filename for an extra clue.
--- virt-manager-3.2.0/virtinst/install/installer.py.orig 2022-01-20 15:40:27.849623677 -0700
+++ virt-manager-3.2.0/virtinst/install/installer.py 2022-01-20 15:42:22.229628567 -0700
@@ -541,6 +541,14 @@ class Installer(object):
osguess = OSDB.guess_os_by_iso(self.cdrom)
if osguess:
ret = osguess[0]
+ # Hack because windows ISOs contain same volume ID
+ if ret and ret.startswith("win"):
+ if "windows_server_2022" in self.cdrom:
+ ret = "win2k22"
+ elif "windows_server_2019" in self.cdrom:
+ ret = "win2k19"
+ elif "windows_server_2016" in self.cdrom:
+ ret = "win2k16"
else:
log.debug("No media for distro detection.")

View File

@ -0,0 +1,19 @@
Reference: bnc#813082
Virt-manager on Xen doesn't fill in any type thereby defaulting to
'raw'. This patch will generate the correct XML on Xen.
Index: virt-manager-4.1.0/virtinst/devices/disk.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/devices/disk.py
+++ virt-manager-4.1.0/virtinst/devices/disk.py
@@ -550,6 +550,10 @@ class DeviceDisk(Device):
https://lists.gnu.org/archive/html/qemu-devel/2008-04/msg00675.html
"""
if self.driver_name != self.DRIVER_NAME_QEMU:
+ if self.driver_name and \
+ self.driver_name != self.DRIVER_NAME_PHY and \
+ self.type != 'file':
+ return self.type
return None
drvtype = self._storage_backend.get_driver_type()

View File

@ -0,0 +1,50 @@
Reference: bnc#872789
This is an indexing problem created by virt-manager. It knows not
to add two IDE disks of the same name (eg, 'hda' twice) or two Xen
disks of the same name (eg, 'xvda' twice) but with the different bus
types (ide vs xen) it added xvda with hda. These disks were then
passed to qemu where it error'ed out with the disks having the same
index (in this case both are 0).
Index: virt-manager-4.1.0/virtinst/devices/disk.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/devices/disk.py
+++ virt-manager-4.1.0/virtinst/devices/disk.py
@@ -903,6 +903,17 @@ class DeviceDisk(Device):
:returns: generated target
"""
prefix, maxnode = self.get_target_prefix()
+ postfix_targets = []
+ if self.conn.is_xen():
+ prefixes = [ "hd", "xvd", "vd", "sd", "fd" ]
+ for x in skip_targets:
+ if x is None:
+ continue
+ for p in prefixes:
+ found = x.split(p,1)
+ if found and len(found) == 2:
+ postfix_targets.append(found[1])
+ break
skip_targets = [t for t in skip_targets if t and t.startswith(prefix)]
skip_targets.sort()
@@ -910,11 +921,18 @@ class DeviceDisk(Device):
first_found = None
for i in range(maxnode):
- gen_t = prefix + self.num_to_target(i + 1)
+ postfix = self.num_to_target(i + 1)
+ gen_t = prefix + postfix
+ if self.conn.is_xen() and postfix in postfix_targets:
+ if gen_t in skip_targets:
+ skip_targets.remove(gen_t)
+ continue
if gen_t in skip_targets:
skip_targets.remove(gen_t)
continue
if not skip_targets:
+ if first_found:
+ return first_found
return gen_t
elif not first_found:
first_found = gen_t

View File

@ -0,0 +1,216 @@
References: bsc#1196806, jsc#SLE-18834
Index: virt-manager-4.1.0/ui/details.ui
===================================================================
--- virt-manager-4.1.0.orig/ui/details.ui
+++ virt-manager-4.1.0/ui/details.ui
@@ -1925,7 +1925,20 @@
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkCheckButton" id="launch-security">
+ <property name="label" translatable="yes">Enable launch security</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ <signal name="toggled" handler="on_mem_launch_security_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
+ </packing>
</child>
</object>
<packing>
Index: virt-manager-4.1.0/virtManager/details/details.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/details/details.py
+++ virt-manager-4.1.0/virtManager/details/details.py
@@ -49,6 +49,7 @@ from ..delete import vmmDeleteStorage
EDIT_MEM,
EDIT_MEM_SHARED,
+ EDIT_MEM_SEV,
EDIT_AUTOSTART,
EDIT_BOOTORDER,
@@ -86,7 +87,7 @@ from ..delete import vmmDeleteStorage
EDIT_FS,
- EDIT_HOSTDEV_ROMBAR) = range(1, 38)
+ EDIT_HOSTDEV_ROMBAR) = range(1, 39)
# Columns in hw list model
@@ -422,6 +423,7 @@ class vmmDetails(vmmGObjectUI):
"on_mem_maxmem_changed": _e(EDIT_MEM),
"on_mem_memory_changed": self._curmem_changed_cb,
"on_mem_shared_access_toggled": _e(EDIT_MEM_SHARED),
+ "on_mem_launch_security_toggled": _e(EDIT_MEM_SEV),
"on_boot_list_changed": self._boot_list_changed_cb,
"on_boot_moveup_clicked": self._boot_moveup_clicked_cb,
@@ -1498,6 +1500,9 @@ class vmmDetails(vmmGObjectUI):
if self._edited(EDIT_MEM_SHARED):
kwargs["mem_shared"] = self.widget("shared-memory").get_active()
+ if self._edited(EDIT_MEM_SEV):
+ kwargs["sevmem"] = self.widget("launch-security").get_active()
+
return self._change_config(
self.vm.define_memory, kwargs,
hotplug_args=hotplug_args)
@@ -2004,6 +2009,14 @@ class vmmDetails(vmmGObjectUI):
curmem.set_value(int(round(vm_cur_mem)))
maxmem.set_value(int(round(vm_max_mem)))
+ domcaps = self.vm.get_domain_capabilities()
+ show_sev = domcaps.supports_sev_launch_security()
+ self.widget("launch-security").set_sensitive(show_sev and self.is_customize_dialog)
+ if self.vm.get_launch_security_type():
+ self.widget("launch-security").set_active(True)
+ else:
+ self.widget("launch-security").set_active(False)
+
shared_mem, shared_mem_err = self.vm.has_shared_mem()
self.widget("shared-memory").set_active(shared_mem)
self.widget("shared-memory").set_sensitive(not bool(shared_mem_err))
Index: virt-manager-4.1.0/virtManager/object/domain.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/object/domain.py
+++ virt-manager-4.1.0/virtManager/object/domain.py
@@ -706,15 +706,33 @@ class vmmDomain(vmmLibvirtObject):
guest.memoryBacking.access_mode = access_mode
def define_memory(self, memory=_SENTINEL, maxmem=_SENTINEL,
- mem_shared=_SENTINEL):
+ mem_shared=_SENTINEL, sevmem=_SENTINEL):
guest = self._make_xmlobj_to_define()
+ def _set_rombar(guest, value):
+ # Ideally turning rombar off would be done automatically
+ # by either libvirt or qemu when SEV is detected.
+ for nic in guest.devices.interface:
+ nic.set_rom_bar(value)
+
if memory != _SENTINEL:
guest.currentMemory = int(memory)
if maxmem != _SENTINEL:
guest.memory = int(maxmem)
if mem_shared != _SENTINEL:
self._edit_shared_mem(guest, mem_shared)
+ if sevmem != _SENTINEL:
+ if sevmem is True:
+ domcaps = self.get_domain_capabilities()
+ guest.launchSecurity.type = "sev"
+ guest.launchSecurity.set_defaults(guest)
+ guest.memoryBacking.set_locked(True)
+ _set_rombar(guest, "off")
+ else:
+ guest.launchSecurity.type = None
+ guest.launchSecurity.policy = None
+ guest.memoryBacking.set_locked(False)
+ _set_rombar(guest, None)
self._redefine_xmlobj(guest)
@@ -1328,6 +1346,9 @@ class vmmDomain(vmmLibvirtObject):
def get_description(self):
return self.get_xmlobj().description
+ def get_launch_security_type(self):
+ return self.get_xmlobj().launchSecurity.type
+
def get_boot_order(self):
legacy = not self.can_use_device_boot_order()
return self.xmlobj.get_boot_order(legacy=legacy)
Index: virt-manager-4.1.0/virtinst/domain/memorybacking.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/domain/memorybacking.py
+++ virt-manager-4.1.0/virtinst/domain/memorybacking.py
@@ -27,6 +27,9 @@ class DomainMemoryBacking(XMLBuilder):
XML_NAME = "memoryBacking"
_XML_PROP_ORDER = ["hugepages", "nosharepages", "locked", "pages"]
+ def set_locked(self, value):
+ self.locked = value
+
hugepages = XMLProperty("./hugepages", is_bool=True)
nosharepages = XMLProperty("./nosharepages", is_bool=True)
locked = XMLProperty("./locked", is_bool=True)
Index: virt-manager-4.1.0/virtinst/domcapabilities.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/domcapabilities.py
+++ virt-manager-4.1.0/virtinst/domcapabilities.py
@@ -93,6 +93,9 @@ def _make_capsblock(xml_root_name):
class _SEV(XMLBuilder):
XML_NAME = "sev"
supported = XMLProperty("./@supported", is_yesno=True)
+ cbitpos = XMLProperty("./cbitpos")
+ reducedPhysBits = XMLProperty("./reducedPhysBits")
+ maxGuests = XMLProperty("./maxGuests")
maxESGuests = XMLProperty("./maxESGuests")
@@ -406,6 +409,9 @@ class DomainCapabilities(XMLBuilder):
self.features.sev.maxESGuests)
return bool(self.features.sev.supported)
+ def supports_sev_es_launch_security(self):
+ return bool(self.features.sev.supported and self.features.sev.maxESGuests)
+
def supports_video_bochs(self):
"""
Returns False if either libvirt or qemu do not have support to bochs
Index: virt-manager-4.1.0/virtinst/domain/launch_security.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/domain/launch_security.py
+++ virt-manager-4.1.0/virtinst/domain/launch_security.py
@@ -19,8 +19,12 @@ class DomainLaunchSecurity(XMLBuilder):
kernelHashes = XMLProperty("./@kernelHashes", is_yesno=True)
def _set_defaults_sev(self, guest):
- if not guest.os.is_q35() or not guest.is_uefi():
- raise RuntimeError(_("SEV launch security requires a Q35 UEFI machine"))
+ if not guest.os.is_q35():
+ raise RuntimeError(_("SEV launch security requires a Q35 machine"))
+ # Libvirt will select the appropriate firmware file if not specified
+ # as long as we enable efi.
+ if not guest.is_uefi():
+ guest.os.firmware = 'efi'
# The 'policy' is a mandatory 4-byte argument for the SEV firmware.
# If missing, we use 0x03 for the original SEV implementation and
Index: virt-manager-4.1.0/virtinst/devices/interface.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/devices/interface.py
+++ virt-manager-4.1.0/virtinst/devices/interface.py
@@ -287,6 +287,9 @@ class DeviceInterface(Device):
self.type = nettype
self.source = source
+ def set_rom_bar(self, value):
+ self.rom_bar = value
+
##################
# Default config #
Index: virt-manager-4.1.0/virtManager/addhardware.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/addhardware.py
+++ virt-manager-4.1.0/virtManager/addhardware.py
@@ -1444,6 +1444,9 @@ class vmmAddHardware(vmmGObjectUI):
mac = self.widget("create-mac-address").get_text()
dev = self._netlist.build_device(mac, model)
+ if self.vm.get_launch_security_type() == "sev":
+ dev.set_rom_bar("off")
+
return dev
def _build_input(self):

View File

@ -0,0 +1,81 @@
References:
When a particular firmware is selected, read the json file for a description.
Add a tooltip of the json description when the mouse move overs the selected firmware.
Index: virt-manager-4.1.0/virtManager/details/details.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/details/details.py
+++ virt-manager-4.1.0/virtManager/details/details.py
@@ -4,6 +4,10 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
+import os
+import json
+import textwrap
+
from gi.repository import Gtk
import libvirt
@@ -402,7 +406,7 @@ class vmmDetails(vmmGObjectUI):
"on_overview_name_changed": _e(EDIT_NAME),
"on_overview_title_changed": _e(EDIT_TITLE),
"on_machine_type_changed": _e(EDIT_MACHTYPE),
- "on_overview_firmware_changed": _e(EDIT_FIRMWARE),
+ "on_overview_firmware_changed": self._uefi_combobox_changed_cb,
"on_overview_chipset_changed": _e(EDIT_MACHTYPE),
"on_details_inspection_refresh_clicked": self._inspection_refresh_clicked_cb,
@@ -1098,6 +1102,52 @@ class vmmDetails(vmmGObjectUI):
self.storage_browser.set_browse_reason(reason)
self.storage_browser.show(self.topwin)
+ def _uefi_combobox_changed_cb(self, src):
+ def get_firmware_description(firmware_file):
+ json_description = ""
+ firmware_json_path = "/usr/share/qemu/firmware"
+ if os.path.isdir(firmware_json_path):
+ json_files = [f for f in os.listdir(firmware_json_path) if os.path.isfile(os.path.join(firmware_json_path, f))]
+ for jf in json_files:
+ full_path = firmware_json_path + '/' + jf
+ if not full_path.endswith(".json"):
+ continue
+ try:
+ if os.stat(full_path).st_size > 65536:
+ continue
+ except OSError:
+ continue
+ with open(full_path, 'r') as json_file:
+ data = json_file.read()
+ try:
+ json_obj = json.loads(data)
+ except Exception as e:
+ continue
+ if 'mapping' in json_obj and 'executable' in json_obj['mapping']:
+ json_exec = str(json_obj['mapping']['executable']['filename'])
+ if json_exec == firmware_file:
+ json_description = str(json_obj['description'])
+ json_features = str(json_obj['features'])
+ if len(json_features) > 0:
+ json_description = json_description + ". Firmware features: " + json_features
+ wrapper = textwrap.TextWrapper(width=60)
+ json_list = wrapper.wrap(text=json_description)
+ json_description = "\n".join(json_list)
+ break
+ return json_description
+
+ combo = self.widget("overview-firmware")
+ tree_iter = combo.get_active_iter()
+ if tree_iter is not None:
+ model = combo.get_model()
+ tooltip_text = ""
+ firmware = model[tree_iter][0]
+ if firmware != 'BIOS':
+ firmware_file = firmware.split()[-1]
+ tooltip_text = get_firmware_description(firmware_file)
+ combo.set_tooltip_text(tooltip_text)
+ self._enable_apply(EDIT_FIRMWARE)
+
def _inspection_refresh_clicked_cb(self, src):
from ..lib.inspection import vmmInspection
inspection = vmmInspection.get_instance()

View File

@ -0,0 +1,19 @@
References: bsc#919692
Because openSUSE repos combine 32 and 64 bit sources we need to
continue showing the 'Architecture' pop-up.
Index: virt-manager-3.3.0/virtManager/createvm.py
===================================================================
--- virt-manager-3.3.0.orig/virtManager/createvm.py
+++ virt-manager-3.3.0/virtManager/createvm.py
@@ -869,11 +869,6 @@ class vmmCreateVM(vmmGObjectUI):
for guest in self.conn.caps.guests:
if guest.os_type == self._capsinfo.os_type:
archs.append(guest.arch)
-
- # Combine x86/i686 to avoid confusion
- if (self.conn.caps.host.cpu.arch == "x86_64" and
- "x86_64" in archs and "i686" in archs):
- archs.remove("i686")
archs.sort()
prios = ["x86_64", "i686", "aarch64", "armv7l", "ppc64", "ppc64le",

View File

@ -0,0 +1,69 @@
Reference: bnc#875111
Steps to get a KVM VM in the crashed state:
1) Install a sles12 KVM VM
2) Manually edit the XML and add/modify <on_crash>preserve</on_crash>
3) In virt-manager add the panic device (Details->Add Hardware)
4) Edit the VM's /etc/default/grub file and remove the crashkernel information
and then run grub2-mkconfig /boot/grub2/grub.cfg.
5) Start the VM and within the VM's terminal type "echo 'c' > /proc/sysrq-trigger"
Index: virt-manager-3.3.0/virtManager/manager.py
===================================================================
--- virt-manager-3.3.0.orig/virtManager/manager.py
+++ virt-manager-3.3.0/virtManager/manager.py
@@ -776,7 +776,7 @@ class vmmManager(vmmGObjectUI):
show_pause = bool(vm and vm.is_unpauseable())
else:
show_pause = bool(vm and vm.is_pauseable())
- show_shutdown = bool(vm and vm.is_stoppable())
+ show_shutdown = bool(vm and vm.is_destroyable())
if vm and vm.managedsave_supported:
self.change_run_text(vm.has_managed_save())
Index: virt-manager-3.3.0/virtManager/vmmenu.py
===================================================================
--- virt-manager-3.3.0.orig/virtManager/vmmenu.py
+++ virt-manager-3.3.0/virtManager/vmmenu.py
@@ -21,6 +21,7 @@ class _VMMenu(Gtk.Menu):
self._parent = src
self._current_vm_cb = current_vm_cb
self._show_open = show_open
+ self._shutdown = None
self._init_state()
@@ -72,6 +73,7 @@ class VMShutdownMenu(_VMMenu):
name = getattr(child, "vmm_widget_name", None)
if name in statemap:
child.set_sensitive(statemap[name])
+ child.set_visible(statemap[name])
class VMActionMenu(_VMMenu):
@@ -83,7 +85,8 @@ class VMActionMenu(_VMMenu):
self._add_action(_("_Pause"), "suspend", VMActionUI.suspend)
self._add_action(_("R_esume"), "resume", VMActionUI.resume)
s = self._add_action(_("_Shut Down"), "shutdown", None)
- s.set_submenu(VMShutdownMenu(self._parent, self._current_vm_cb))
+ self._shutdown = VMShutdownMenu(self._parent, self._current_vm_cb)
+ s.set_submenu(self._shutdown)
self.add(Gtk.SeparatorMenuItem())
self._add_action(_("Clone..."), "clone", VMActionUI.clone)
@@ -100,7 +103,7 @@ class VMActionMenu(_VMMenu):
def update_widget_states(self, vm):
statemap = {
"run": bool(vm and vm.is_runable()),
- "shutdown": bool(vm and vm.is_stoppable()),
+ "shutdown": bool(vm and vm.is_destroyable()),
"suspend": bool(vm and vm.is_stoppable()),
"resume": bool(vm and vm.is_paused()),
"migrate": bool(vm and vm.is_stoppable()),
@@ -117,6 +120,8 @@ class VMActionMenu(_VMMenu):
child.get_submenu().update_widget_states(vm)
if name in statemap:
child.set_sensitive(statemap[name])
+ if name == "shutdown" and self._shutdown:
+ self._shutdown.update_widget_states(vm)
if name in vismap:
child.set_visible(vismap[name])

Some files were not shown because too many files have changed in this diff Show More