!53 [sync] PR-51: virt-manager upgrade to version 4.1.0-8

From: @openeuler-sync-bot 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
This commit is contained in:
openeuler-ci-bot 2024-08-21 02:57:09 +00:00 committed by Gitee
commit acf4b5af37
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 755 additions and 1 deletions

View File

@ -0,0 +1,127 @@
From fbdf05162606e4d70506b65d0dd647a59f229253 Mon Sep 17 00:00:00 2001
From: Lin Ma <lma@suse.com>
Date: Fri, 19 Aug 2022 18:18:50 +0800
Subject: [PATCH] cli: --cpu: Add maxphysaddr.{mode,bits} options
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>
---
.../cli/compare/virt-install-many-devices.xml | 1 +
.../compare/virt-install-testdriver-edgecases.xml | 4 +++-
tests/test_cli.py | 5 +++--
virtinst/cli.py | 3 +++
virtinst/domain/cpu.py | 15 ++++++++++++++-
5 files changed, 24 insertions(+), 4 deletions(-)
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 #
--
2.37.2.windows.2

View File

@ -0,0 +1,83 @@
From 15ddeae6cb405bad10bc62164b14117646e9127e Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 17 Oct 2022 11:54:37 -0400
Subject: [PATCH] cli: support --boot loader.stateless=
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
tests/data/cli/compare/virt-install-singleton-config-2.xml | 4 ++--
tests/test_cli.py | 2 +-
virtinst/cli.py | 1 +
virtinst/domain/os.py | 2 ++
4 files changed, 6 insertions(+), 3 deletions(-)
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):
--
2.37.2.windows.2

View File

@ -0,0 +1,94 @@
From b0d0516736320315a70f74aff3759fb35dd35d9d Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 21 Aug 2022 16:21:10 -0400
Subject: [PATCH] cloner: Sync <uuid> and <sysinfo> system uuid
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>
---
tests/data/cli/compare/virt-clone-auto-unmanaged.xml | 5 +++++
tests/data/cli/compare/virt-clone-unmanaged-preserve.xml | 5 +++++
tests/data/cli/virtclone/clone-disk.xml | 5 +++++
virtinst/cloner.py | 6 ++++--
4 files changed, 19 insertions(+), 2 deletions(-)
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):
"""
--
2.37.2.windows.2

View File

@ -0,0 +1,171 @@
From 4a2df064839f71ed94320771507b1271d041e397 Mon Sep 17 00:00:00 2001
From: Lin Ma <lma@suse.com>
Date: Wed, 2 Nov 2022 20:45:43 +0800
Subject: [PATCH] diskbackend: Drop support for sheepdog
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>
---
.../compare/virt-xml-build-disk-domain.xml | 2 +-
.../virt-xml-build-pool-logical-disk.xml | 2 +-
tests/data/testdriver/testdriver.xml | 40 +------------------
virtManager/object/storagepool.py | 2 -
virtinst/storage.py | 8 ++--
5 files changed, 7 insertions(+), 47 deletions(-)
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
--
2.37.2.windows.2

View File

@ -0,0 +1,28 @@
From c22a876e9a63cb7114e2b008f2e24682c8bbef3e Mon Sep 17 00:00:00 2001
From: Lin Ma <lma@suse.com>
Date: Fri, 19 Aug 2022 18:18:09 +0800
Subject: [PATCH] tests: Add a compat check for linux2020 in amd-sev test case
It avoids amd-sev test failure if using older osinfo-db.
Signed-off-by: Lin Ma <lma@suse.com>
---
tests/test_cli.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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'")
--
2.37.2.windows.2

View File

@ -0,0 +1,42 @@
From 1d64a678d31829051444e1bf29d86f800e13de39 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 22 Aug 2022 10:15:46 -0400
Subject: [PATCH] virt-install: Reuse cli.fail_conflicting
For the --unattended + --cloud-init conflict
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
tests/test_cli.py | 2 +-
virtinst/virtinstall.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index cbeebd46..9d4e5ae3 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1116,7 +1116,7 @@ c.add_invalid("--disk none --boot network --machine foobar", grep="domain type N
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")
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 8260628d..8fcc8ce1 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -412,7 +412,7 @@ def build_installer(options, guest, installdata):
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)
--
2.37.2.windows.2

View File

@ -0,0 +1,32 @@
From a254ece0f0497d062a0e4c94dc45619649ea4922 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 21 Aug 2022 16:08:37 -0400
Subject: [PATCH] virt-install: --help required options are wrong
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>
---
virtinst/virtinstall.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index baebe5b5..37eef1fc 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -1019,7 +1019,7 @@ def xml_to_print(guest, installer, xmlonly, dry):
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)
--
2.37.2.windows.2

View File

@ -0,0 +1,45 @@
From 999ccb85e3e4189386786256cdf70cf5238cf785 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 21 Aug 2022 16:47:26 -0400
Subject: [PATCH] virt-install: --unattended and --cloud-init conflict
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>
---
tests/test_cli.py | 1 +
virtinst/virtinstall.py | 3 +++
2 files changed, 4 insertions(+)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index ef27276a..cbeebd46 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1116,6 +1116,7 @@ c.add_invalid("--disk none --boot network --machine foobar", grep="domain type N
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")
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 37eef1fc..8260628d 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -411,6 +411,9 @@ def build_installer(options, guest, installdata):
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)
--
2.37.2.windows.2

View File

@ -0,0 +1,53 @@
From e94786c066696781a821f5a4bcef3c377e4bc5e5 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sat, 20 Aug 2022 09:54:01 -0400
Subject: [PATCH] virtinstall: fix regression with --boot and no install method
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>
---
tests/test_cli.py | 1 +
virtinst/virtinstall.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 72b78df3..cc1d3da2 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -967,6 +967,7 @@ c.add_valid("--os-variant generic --pxe --ram 16", grep="Requested memory 16 MiB
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
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 32434119..baebe5b5 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -433,7 +433,7 @@ def build_installer(options, guest, installdata):
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)
--
2.37.2.windows.2

View File

@ -0,0 +1,57 @@
From 1cb0be4002445e5755ead2423b5a4e9e06f0a3cb Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sat, 20 Aug 2022 09:42:47 -0400
Subject: [PATCH] virtinstall: split no_install conditional apart to track code
coverage
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>
---
tests/test_cli.py | 2 ++
virtinst/virtinstall.py | 14 +++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 259ac78c..72b78df3 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1017,7 +1017,9 @@ c = vinst.add_category("misc-install", "--nographics --noautoconsole")
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
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 6d7f56b8..32434119 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -429,11 +429,15 @@ def build_installer(options, guest, installdata):
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,
--
2.37.2.windows.2

View File

@ -2,7 +2,7 @@
Name: virt-manager
Version: 4.1.0
Release: 7
Release: 8
Summary: The manage virtual machines tool which via libvirt.
License: GPLv2+
BuildArch: noarch
@ -19,6 +19,16 @@ Patch7: backport-tests-cli-Fix-test-output-after-previous-commit.pa
Patch8: backport-fsdetails-Fix-an-error-with-source.socket-of-virtiof.patch
Patch9: backport-cli-Drop-unnecessary-disk-prop-aliases.patch
Patch10: backport-tests-testdriver-Add-filesystem-socket-example.patch
Patch11: backport-virtinstall-split-no_install-conditional-apart-to-tr.patch
Patch12: backport-virtinstall-fix-regression-with-boot-and-no-install-.patch
Patch13: backport-tests-Add-a-compat-check-for-linux2020-in-amd-sev-te.patch
Patch14: backport-cli-cpu-Add-maxphysaddr.-mode-bits-options.patch
Patch15: backport-virt-install-help-required-options-are-wrong.patch
Patch16: backport-cloner-Sync-uuid-and-sysinfo-system-uuid.patch
Patch17: backport-virt-install-unattended-and-cloud-init-conflict.patch
Patch18: backport-virt-install-Reuse-cli.fail_conflicting.patch
Patch19: backport-cli-support-boot-loader.stateless.patch
Patch20: backport-diskbackend-Drop-support-for-sheepdog.patch
Requires: virt-manager-common = %{version}-%{release} python3-gobject gtk3 libvirt-glib >= 0.0.9
Requires: gtk-vnc2 dconf vte291 gtksourceview4
@ -96,6 +106,18 @@ done
%{_mandir}/man1/{virt-install.1*,virt-clone.1*,virt-xml.1*}
%changelog
* Wed Aug 21 2024 yanjianqing <yanjianqing@kylinos.cn> - 4.1.0-8
- diskbackend: Drop support for sheepdog
- cli: support --boot loader.stateless=
- virt-install: Reuse cli.fail_conflicting
- virt-install: --unattended and --cloud-init conflict
- cloner: Sync and system uuid
- virt-install: --help required options are wrong
- cli: --cpu: Add maxphysaddr.{mode,bits} options
- tests: Add a compat check for linux2020 in amd-sev test case
- virtinstall: fix regression with --boot and no install method
- virtinstall: split no_install conditional apart to track code coverage
* Fri Jul 26 2024 yanjianqing <yanjianqing@kylinos.cn> - 4.1.0-7
- tests: testdriver: Add filesystem socket example
- cli: Drop unnecessary --disk prop aliases