import virt-manager-2.0.0-5.el8

This commit is contained in:
CentOS Sources 2019-05-07 09:21:15 -04:00 committed by Andrew Lukoshko
commit b005b2e064
12 changed files with 1913 additions and 0 deletions

1
.gitignore vendored Normal file
View File

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

1
.virt-manager.metadata Normal file
View File

@ -0,0 +1 @@
a99ff5c18281357cbf136830d7babbd22a91678a SOURCES/virt-manager-2.0.0.tar.gz

View File

@ -0,0 +1,63 @@
From 533879fd8da90eba207c63e2d70472efda9dc612 Mon Sep 17 00:00:00 2001
Message-Id: <533879fd8da90eba207c63e2d70472efda9dc612@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 13 Dec 2018 16:39:43 -0500
Subject: [PATCH] cli: s390x+graphics specified, use video=virtio (bz #1654994)
From: Cole Robinson <crobinso@redhat.com>
s390x doesn't support any of the PCI graphics cards
https://bugzilla.redhat.com/show_bug.cgi?id=1654994
(cherry picked from commit b91393e6c35b0e2903dbb50bb57a64464a7a3802)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
.../cli-test-xml/compare/virt-install-s390x-cdrom-KVMIBM.xml | 4 ++++
tests/clitest.py | 2 +-
virtinst/devices/video.py | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/cli-test-xml/compare/virt-install-s390x-cdrom-KVMIBM.xml b/tests/cli-test-xml/compare/virt-install-s390x-cdrom-KVMIBM.xml
index a8038855..82fe6350 100644
--- a/tests/cli-test-xml/compare/virt-install-s390x-cdrom-KVMIBM.xml
+++ b/tests/cli-test-xml/compare/virt-install-s390x-cdrom-KVMIBM.xml
@@ -36,6 +36,10 @@
<console type="pty">
<target type="sclp"/>
</console>
+ <graphics type="vnc" port="-1"/>
+ <video>
+ <model type="virtio"/>
+ </video>
<watchdog model="diag288" action="reset"/>
<panic model="s390"/>
</devices>
diff --git a/tests/clitest.py b/tests/clitest.py
index 039938db..824293e4 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -720,7 +720,7 @@ c.add_compare("--connect %(URI-KVM-PPC64LE)s --import --disk %(EXISTIMG1)s --os-
# s390x tests
c.add_compare("--arch s390x --machine s390-ccw-virtio --connect %(URI-KVM-S390X)s --boot kernel=/kernel.img,initrd=/initrd.img --disk %(EXISTIMG1)s --disk %(EXISTIMG3)s,device=cdrom --os-variant fedora21", "s390x-cdrom", skip_check=OLD_OSINFO)
-c.add_compare("--arch s390x --machine s390-ccw-virtio --connect " + utils.URIs.kvm_s390x_KVMIBM + " --boot kernel=/kernel.img,initrd=/initrd.img --disk %(EXISTIMG1)s --disk %(EXISTIMG3)s,device=cdrom --os-variant fedora21 --watchdog diag288,action=reset --panic default", "s390x-cdrom-KVMIBM")
+c.add_compare("--arch s390x --machine s390-ccw-virtio --connect " + utils.URIs.kvm_s390x_KVMIBM + " --boot kernel=/kernel.img,initrd=/initrd.img --disk %(EXISTIMG1)s --disk %(EXISTIMG3)s,device=cdrom --os-variant fedora21 --watchdog diag288,action=reset --panic default --graphics vnc", "s390x-cdrom-KVMIBM")
# qemu:///session tests
c.add_compare("--connect " + utils.URIs.kvm_session + " --disk size=8 --os-variant fedora21 --cdrom %(EXISTIMG1)s", "kvm-session-defaults", skip_check=OLD_OSINFO)
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
index 5978a421..276f8187 100644
--- a/virtinst/devices/video.py
+++ b/virtinst/devices/video.py
@@ -46,6 +46,8 @@ class DeviceVideo(Device):
return "vga"
if guest.os.is_arm_machvirt():
return "virtio"
+ if guest.conn.is_qemu() and guest.os.is_s390x():
+ return "virtio"
if guest.has_spice() and guest.os.is_x86():
if guest.has_gl():
return "virtio"
--
2.19.2

View File

@ -0,0 +1,32 @@
From 5ace424b75538b3a5f8b06536c6de38a91d749ff Mon Sep 17 00:00:00 2001
Message-Id: <5ace424b75538b3a5f8b06536c6de38a91d749ff@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 10 Jan 2019 12:58:43 -0500
Subject: [PATCH] diskbackend: Fix backtrace cloning with block storage (bz
#1661986)
From: Cole Robinson <crobinso@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1661986
(cherry picked from commit 722886748006b880ff6a99781b2aca0751aafc55)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/diskbackend.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
index b9340585..3366e88d 100644
--- a/virtinst/diskbackend.py
+++ b/virtinst/diskbackend.py
@@ -530,7 +530,7 @@ class CloneStorageCreator(_StorageCreator):
else:
vfs = os.statvfs(os.path.dirname(self._path))
avail = vfs.f_frsize * vfs.f_bavail
- need = int(self._size) * 1024 * 1024 * 1024
+ need = int(self._size) * 1024 * 1024 * 1024
if need > avail:
if self._sparse:
msg = _("The filesystem will not have enough free space"
--
2.20.1

View File

@ -0,0 +1,51 @@
From caea48c879b0a5d292c74a4a3721d56350cf5537 Mon Sep 17 00:00:00 2001
Message-Id: <caea48c879b0a5d292c74a4a3721d56350cf5537@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 30 Jan 2019 18:28:14 +0100
Subject: [PATCH] inspection: fix check of null icon
From: Pino Toscano <ptoscano@redhat.com>
Recently the Python binding of libguestfs was adapted to properly use
bytes in APIs that return data, instead of (ab)using strings [1].
This change was done only when built for Python 3, which has this
distinct bytes and strings.
Because of that, now the 'icon == ""' (empty string) checks fail, using
whatever inspect_get_icon() returns, including empty arrays of bytes.
Hence, change the checks to use the length of the data as condition, as
also the libguestfs Python API documentation says. Leave also the
checks for None, in the remote case the API will return None in the
future for no data.
[1] https://github.com/libguestfs/libguestfs/commit/0ee02e0117527b86a31b2a88a14994ce7f15571f
(cherry picked from commit bce4cc4ef837754de81e1420905159cc2fc3d773)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1671278
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtManager/inspection.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/virtManager/inspection.py b/virtManager/inspection.py
index ea6123b8..fde48474 100644
--- a/virtManager/inspection.py
+++ b/virtManager/inspection.py
@@ -268,10 +268,10 @@ class vmmInspection(vmmGObject):
if filesystems_mounted:
# string containing PNG data
icon = g.inspect_get_icon(root, favicon=0, highquality=1)
- if icon == "" or icon is None:
+ if icon is None or len(icon) == 0:
# no high quality icon, try a low quality one
icon = g.inspect_get_icon(root, favicon=0, highquality=0)
- if icon == "":
+ if icon is None or len(icon) == 0:
icon = None
# Inspection applications.
--
2.20.1

View File

@ -0,0 +1,181 @@
From 7af39b00d8ab930fa519a62c0d674f8f77c718b5 Mon Sep 17 00:00:00 2001
Message-Id: <7af39b00d8ab930fa519a62c0d674f8f77c718b5@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 13 Nov 2018 16:18:07 +0100
Subject: [PATCH] tests: Add some tests for virt-xml with KVM
From: Andrea Bolognani <abologna@redhat.com>
We're mostly interested in how the default bus/model for
devices are influenced by knowledge about the guest OS, but
since the whole thing requires to be connected to the QEMU
driver we might as well create a new category and leave room
for more QEMU-specific tests being added down the line.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit b882dbde9cb192afbc9ee8d8f4972922a4b4e616)
https://bugzilla.redhat.com/show_bug.cgi?id=1649406
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../compare/virt-xml-kvm-add-disk-default.xml | 13 +++++++++++++
.../virt-xml-kvm-add-disk-os-from-cmdline.xml | 14 ++++++++++++++
.../compare/virt-xml-kvm-add-disk-os-from-xml.xml | 14 ++++++++++++++
.../compare/virt-xml-kvm-add-network-default.xml | 13 +++++++++++++
.../virt-xml-kvm-add-network-os-from-cmdline.xml | 14 ++++++++++++++
.../virt-xml-kvm-add-network-os-from-xml.xml | 14 ++++++++++++++
tests/clitest.py | 7 +++++++
7 files changed, 89 insertions(+)
create mode 100644 tests/cli-test-xml/compare/virt-xml-kvm-add-disk-default.xml
create mode 100644 tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml
create mode 100644 tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-xml.xml
create mode 100644 tests/cli-test-xml/compare/virt-xml-kvm-add-network-default.xml
create mode 100644 tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml
create mode 100644 tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-xml.xml
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-default.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-default.xml
new file mode 100644
index 00000000..4ee0f1cb
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-default.xml
@@ -0,0 +1,13 @@
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
++ <disk type="file" device="disk">
++ <driver name="qemu" type="qcow2"/>
++ <source file="/dev/default-pool/testvol1.img"/>
++ <target dev="hda" bus="ide"/>
++ </disk>
+ </devices>
+ </domain>
+
+Domain 'test' defined successfully.
+Changes will take effect after the domain is fully powered off.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml
new file mode 100644
index 00000000..e5e4bd62
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml
@@ -0,0 +1,14 @@
+ <panic model="s390"/>
+ <panic model="pseries"/>
+ <panic model="hyperv"/>
++ <disk type="file" device="disk">
++ <driver name="qemu" type="qcow2"/>
++ <source file="/dev/default-pool/testvol1.img"/>
++ <target dev="vdaf" bus="virtio"/>
++ </disk>
+ </devices>
+ <seclabel type="dynamic" model="selinux" relabel="yes"/>
+ <seclabel type="static" model="dac" relabel="yes">
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the domain is fully powered off.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-xml.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-xml.xml
new file mode 100644
index 00000000..e5e4bd62
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-xml.xml
@@ -0,0 +1,14 @@
+ <panic model="s390"/>
+ <panic model="pseries"/>
+ <panic model="hyperv"/>
++ <disk type="file" device="disk">
++ <driver name="qemu" type="qcow2"/>
++ <source file="/dev/default-pool/testvol1.img"/>
++ <target dev="vdaf" bus="virtio"/>
++ </disk>
+ </devices>
+ <seclabel type="dynamic" model="selinux" relabel="yes"/>
+ <seclabel type="static" model="dac" relabel="yes">
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the domain is fully powered off.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-network-default.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-default.xml
new file mode 100644
index 00000000..92bf1816
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-default.xml
@@ -0,0 +1,13 @@
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
++ <interface type="bridge">
++ <source bridge="eth0"/>
++ <mac address="00:11:22:33:44:55"/>
++ <model type="e1000"/>
++ </interface>
+ </devices>
+ </domain>
+
+Domain 'test' defined successfully.
+Changes will take effect after the domain is fully powered off.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml
new file mode 100644
index 00000000..c834c936
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml
@@ -0,0 +1,14 @@
+ <panic model="s390"/>
+ <panic model="pseries"/>
+ <panic model="hyperv"/>
++ <interface type="bridge">
++ <source bridge="eth0"/>
++ <mac address="00:11:22:33:44:55"/>
++ <model type="virtio"/>
++ </interface>
+ </devices>
+ <seclabel type="dynamic" model="selinux" relabel="yes"/>
+ <seclabel type="static" model="dac" relabel="yes">
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the domain is fully powered off.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-xml.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-xml.xml
new file mode 100644
index 00000000..c834c936
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-xml.xml
@@ -0,0 +1,14 @@
+ <panic model="s390"/>
+ <panic model="pseries"/>
+ <panic model="hyperv"/>
++ <interface type="bridge">
++ <source bridge="eth0"/>
++ <mac address="00:11:22:33:44:55"/>
++ <model type="virtio"/>
++ </interface>
+ </devices>
+ <seclabel type="dynamic" model="selinux" relabel="yes"/>
+ <seclabel type="static" model="dac" relabel="yes">
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the domain is fully powered off.
\ No newline at end of file
diff --git a/tests/clitest.py b/tests/clitest.py
index 144eac7a..039938db 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -954,6 +954,13 @@ c.add_compare("--remove-device --disk /dev/null", "remove-disk-path")
c.add_compare("--remove-device --video all", "remove-video-all", check_version="1.3.3") # check_version=video primary= attribute
c.add_compare("--remove-device --host-device 0x04b3:0x4485", "remove-hostdev-name", check_version="1.2.11") # check_version=video ram output change
+c = vixml.add_category("add/rm devices (KVM)", "--connect %(URI-KVM)s --print-diff --define")
+c.add_compare("test --add-device --disk %(EXISTIMG1)s", "kvm-add-disk-default") # Guest OS is not known
+c.add_compare("test-many-devices --add-device --disk %(EXISTIMG1)s", "kvm-add-disk-os-from-xml") # Guest OS information taken from the guest XML
+c.add_compare("test-many-devices --add-device --disk %(EXISTIMG1)s --os-variant winme", "kvm-add-disk-os-from-cmdline") # Guest OS information provided on the command line
+c.add_compare("test --add-device --network default", "kvm-add-network-default") # Guest OS is not known
+c.add_compare("test-many-devices --add-device --network default", "kvm-add-network-os-from-xml") # Guest OS information taken from the guest XML
+c.add_compare("test-many-devices --add-device --network default --os-variant winme", "kvm-add-network-os-from-cmdline") # Guest OS information provided on the command line
--
2.19.2

View File

@ -0,0 +1,48 @@
From 6cb52e94e35d78001060b455d02de819fd923ba7 Mon Sep 17 00:00:00 2001
Message-Id: <6cb52e94e35d78001060b455d02de819fd923ba7@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 18 Mar 2019 14:22:25 -0400
Subject: [PATCH] urldetect: Check also for 'treeinfo' (bz 1689252)
From: Cole Robinson <crobinso@redhat.com>
Trees published to akamai CDN via Red Hat Satellite can't have .dotfiles
in them. More details here:
https://bugzilla.redhat.com/show_bug.cgi?id=635065
So we also need to check for .treeinfo. Anaconda does this too so it's
a long known issue.
https://bugzilla.redhat.com/show_bug.cgi?id=1689252
(cherry picked from commit 74bbc3db15d5e9a1b4d21c276f7d3f435b83d2fd)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
virtinst/urldetect.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/virtinst/urldetect.py b/virtinst/urldetect.py
index 5da15d0b..27747f91 100644
--- a/virtinst/urldetect.py
+++ b/virtinst/urldetect.py
@@ -46,7 +46,16 @@ class _DistroCache(object):
if self._treeinfo:
return self._treeinfo
- treeinfostr = self.acquire_file_content(".treeinfo")
+ # Vast majority of trees here use .treeinfo. However, trees via
+ # Red Hat satellite on akamai CDN will use treeinfo, because akamai
+ # doesn't do dotfiles apparently:
+ #
+ # https://bugzilla.redhat.com/show_bug.cgi?id=635065
+ #
+ # Anaconda is the canonical treeinfo consumer and they check for both
+ # locations, so we need to do the same
+ treeinfostr = (self.acquire_file_content(".treeinfo") or
+ self.acquire_file_content("treeinfo"))
if treeinfostr is None:
return None
--
2.20.1

View File

@ -0,0 +1,107 @@
From 876da431c26216844488b8fe11be871576b7751d Mon Sep 17 00:00:00 2001
Message-Id: <876da431c26216844488b8fe11be871576b7751d@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 13 Nov 2018 16:18:05 +0100
Subject: [PATCH] virt-install: Add "Guest OS" options group
From: Andrea Bolognani <abologna@redhat.com>
The --os-variant option doesn't quite fit perfectly into
its current "Installation method" group, plus we want to
add the same option to virt-xml which can't have that
group for obvious reasons.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 751fb88c58b0e1d922b11397bcfe3cd91af694f0)
https://bugzilla.redhat.com/show_bug.cgi?id=1649406
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
man/virt-install.pod | 38 +++++++++++++++++++++++---------------
virt-install | 10 +++++-----
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/man/virt-install.pod b/man/virt-install.pod
index b75b7998..5b7a784c 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -472,21 +472,6 @@ file:
--initrd-inject=/path/to/my.ks --extra-args "ks=file:/my.ks"
-=item B<--os-variant> OS_VARIANT
-
-Optimize the guest configuration for a specific operating system (ex.
-'fedora29', 'rhel7', 'win10'). While not required, specifying this
-options is HIGHLY RECOMMENDED, as it can greatly increase performance
-by specifying virtio among other guest tweaks.
-
-By default, virt-install will attempt to auto detect this value from
-the install media (currently only supported for URL installs). Autodetection
-can be disabled with the special value 'none'. Autodetection can be
-forced with the special value 'auto'.
-
-Use the command "osinfo-query os" to get the list of the accepted OS
-variants.
-
=item B<--boot> BOOTOPTS
Optionally specify the post-install VM boot configuration. This option allows
@@ -573,6 +558,29 @@ Use --idmap=? to see a list of all available sub options. Complete details at L<
+=head1 GUEST OS OPTIONS
+
+=over 4
+
+=item B<--os-variant> OS_VARIANT
+
+Optimize the guest configuration for a specific operating system (ex.
+'fedora29', 'rhel7', 'win10'). While not required, specifying this
+options is HIGHLY RECOMMENDED, as it can greatly increase performance
+by specifying virtio among other guest tweaks.
+
+By default, virt-install will attempt to auto detect this value from
+the install media (currently only supported for URL installs). Autodetection
+can be disabled with the special value 'none'. Autodetection can be
+forced with the special value 'auto'.
+
+Use the command "osinfo-query os" to get the list of the accepted OS
+variants.
+
+=back
+
+
+
=head1 STORAGE OPTIONS
diff --git a/virt-install b/virt-install
index 2c379ed3..4e16d4c8 100755
--- a/virt-install
+++ b/virt-install
@@ -784,14 +784,14 @@ def parse_args():
insg.add_argument("--test-stub-command", action="store_true",
help=argparse.SUPPRESS)
- insg.add_argument("--os-type", dest="distro_type", help=argparse.SUPPRESS)
- insg.add_argument("--os-variant", dest="distro_variant",
- help=_("The OS variant being installed in the guest, "
- "e.g. 'fedora29', 'rhel7', 'win10 etc."))
-
cli.add_boot_options(insg)
insg.add_argument("--init", help=argparse.SUPPRESS)
+ osg = parser.add_argument_group(_("Guest OS Options"))
+ osg.add_argument("--os-type", dest="distro_type", help=argparse.SUPPRESS)
+ osg.add_argument("--os-variant", dest="distro_variant",
+ help=_("The OS variant being installed in the guest, "
+ "e.g. 'fedora29', 'rhel7', 'win10 etc."))
devg = parser.add_argument_group(_("Device Options"))
cli.add_disk_option(devg)
--
2.19.2

View File

@ -0,0 +1,53 @@
From cbb550bc8064d8219798a2de80ed71b5bd4c4735 Mon Sep 17 00:00:00 2001
Message-Id: <cbb550bc8064d8219798a2de80ed71b5bd4c4735@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 13 Nov 2018 16:18:04 +0100
Subject: [PATCH] virt-install: Fix description for --os-variant
From: Andrea Bolognani <abologna@redhat.com>
Since we're messing with it either way, might as well use
modern OS names as examples.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit a550a957278917f6edf94ada94017feeca77b7bf)
https://bugzilla.redhat.com/show_bug.cgi?id=1649406
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
man/virt-install.pod | 2 +-
virt-install | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/virt-install.pod b/man/virt-install.pod
index 8cd56fe0..b75b7998 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -475,7 +475,7 @@ file:
=item B<--os-variant> OS_VARIANT
Optimize the guest configuration for a specific operating system (ex.
-'fedora18', 'rhel7', 'winxp'). While not required, specifying this
+'fedora29', 'rhel7', 'win10'). While not required, specifying this
options is HIGHLY RECOMMENDED, as it can greatly increase performance
by specifying virtio among other guest tweaks.
diff --git a/virt-install b/virt-install
index a7f247f1..2c379ed3 100755
--- a/virt-install
+++ b/virt-install
@@ -786,8 +786,8 @@ def parse_args():
insg.add_argument("--os-type", dest="distro_type", help=argparse.SUPPRESS)
insg.add_argument("--os-variant", dest="distro_variant",
- help=_("The OS variant being installed guests, "
- "e.g. 'fedora18', 'rhel6', 'winxp', etc."))
+ help=_("The OS variant being installed in the guest, "
+ "e.g. 'fedora29', 'rhel7', 'win10 etc."))
cli.add_boot_options(insg)
insg.add_argument("--init", help=argparse.SUPPRESS)
--
2.19.2

View File

@ -0,0 +1,90 @@
From 56d11ce780d8f3b01a557b12d88058daec95bff7 Mon Sep 17 00:00:00 2001
Message-Id: <56d11ce780d8f3b01a557b12d88058daec95bff7@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 13 Nov 2018 16:18:06 +0100
Subject: [PATCH] virt-xml: Accept --os-variant option
From: Andrea Bolognani <abologna@redhat.com>
We're not doing anything with it yet, but having the
parser accept it means we can write tests and see how
their output changes once we wire it up in earnest.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit ade53764fc4e86db1d37012c3723e92b81c6b4c9)
https://bugzilla.redhat.com/show_bug.cgi?id=1649406
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
man/virt-xml.pod | 30 ++++++++++++++++++++++++++++++
virt-xml | 5 +++++
2 files changed, 35 insertions(+)
diff --git a/man/virt-xml.pod b/man/virt-xml.pod
index bae492ac..a24a04fa 100644
--- a/man/virt-xml.pod
+++ b/man/virt-xml.pod
@@ -160,6 +160,30 @@ Before defining or updating the domain, show the generated XML diff and interact
+=head1 GUEST OS OPTIONS
+
+=over 4
+
+=item B<--os-variant> OS_VARIANT
+
+Optimize the guest configuration for a specific operating system (ex.
+'fedora29', 'rhel7', 'win10'). While not required, specifying this
+options is HIGHLY RECOMMENDED, as it can greatly increase performance
+by specifying virtio among other guest tweaks.
+
+If the guest has been installed using virt-manager version 2.0.0 or newer,
+providing this information should not be necessary, as the OS variant will
+have been stored in the guest configuration during installation and virt-xml
+will retrieve it from there automatically.
+
+Use the command "osinfo-query os" to get the list of the accepted OS
+variants.
+
+=back
+
+
+
+
=head1 XML OPTIONS
=over 4
@@ -331,6 +355,12 @@ Create a 10G qcow2 disk image and attach it to 'fedora18' for the next VM startu
# virt-xml fedora18 --add-device \
--disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10
+Same as above, but ensure the disk is attached to the most appropriate bus
+for the guest OS by providing information about it on the command line:
+
+ # virt-xml fedora18 --os-variant fedora18 --add-device \
+ --disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10
+
Hotunplug the disk vdb from the running domain 'rhel7':
# virt-xml rhel7 --update --remove-device --disk target=vdb
diff --git a/virt-xml b/virt-xml
index 9bdde95d..65d9b55f 100755
--- a/virt-xml
+++ b/virt-xml
@@ -360,6 +360,11 @@ def parse_args():
outg.add_argument("--confirm", action="store_true",
help=_("Require confirmation before saving any results."))
+ osg = parser.add_argument_group(_("OS options"))
+ osg.add_argument("--os-variant", dest="distro_variant",
+ help=_("The OS variant installed in the guest, "
+ "e.g. 'fedora29', 'rhel7', 'win10 etc."))
+
g = parser.add_argument_group(_("XML options"))
cli.add_disk_option(g, editexample=True)
cli.add_net_option(g)
--
2.19.2

View File

@ -0,0 +1,136 @@
From ffa0e4e8e438319cb3c8856d1d7f48a8864afe2e Mon Sep 17 00:00:00 2001
Message-Id: <ffa0e4e8e438319cb3c8856d1d7f48a8864afe2e@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 13 Nov 2018 16:18:08 +0100
Subject: [PATCH] virt-xml: Start using --os-variant
From: Andrea Bolognani <abologna@redhat.com>
The option only works with --add-device for the time being,
so we prevent its use in all other cases.
It would be nice to have it work with --build-xml too, but
in that case the user would have to provide some extra
information that in the case of --add-device we can figure
out from the existing guest, and it's not entirely clear
whether that would even be that useful, so for now we're
not considering that case at all.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit d2d103a334e3beeb8e108137f50adee2e5c0e5fc)
https://bugzilla.redhat.com/show_bug.cgi?id=1649406
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../virt-xml-kvm-add-disk-os-from-cmdline.xml | 11 ++++++++++-
.../virt-xml-kvm-add-network-os-from-cmdline.xml | 11 ++++++++++-
virt-xml | 14 ++++++++++++++
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml
index e5e4bd62..cf872c1c 100644
--- a/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-disk-os-from-cmdline.xml
@@ -1,10 +1,19 @@
+ </description>
+ <metadata>
+ <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
+- <libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
++ <libosinfo:os id="http://microsoft.com/win/me"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory unit="KiB">409600</memory>
+@@
<panic model="s390"/>
<panic model="pseries"/>
<panic model="hyperv"/>
+ <disk type="file" device="disk">
+ <driver name="qemu" type="qcow2"/>
+ <source file="/dev/default-pool/testvol1.img"/>
-+ <target dev="vdaf" bus="virtio"/>
++ <target dev="hdd" bus="ide"/>
+ </disk>
</devices>
<seclabel type="dynamic" model="selinux" relabel="yes"/>
diff --git a/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml
index c834c936..8d278e7a 100644
--- a/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml
+++ b/tests/cli-test-xml/compare/virt-xml-kvm-add-network-os-from-cmdline.xml
@@ -1,10 +1,19 @@
+ </description>
+ <metadata>
+ <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
+- <libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
++ <libosinfo:os id="http://microsoft.com/win/me"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory unit="KiB">409600</memory>
+@@
<panic model="s390"/>
<panic model="pseries"/>
<panic model="hyperv"/>
+ <interface type="bridge">
+ <source bridge="eth0"/>
+ <mac address="00:11:22:33:44:55"/>
-+ <model type="virtio"/>
++ <model type="e1000"/>
+ </interface>
</devices>
<seclabel type="dynamic" model="selinux" relabel="yes"/>
diff --git a/virt-xml b/virt-xml
index 65d9b55f..39abd297 100755
--- a/virt-xml
+++ b/virt-xml
@@ -56,6 +56,13 @@ def get_diff(origxml, newxml):
return ret
+def set_distro_variant(options, guest):
+ if options.distro_variant is None:
+ return
+
+ guest.set_os_name(options.distro_variant)
+
+
def get_domain_and_guest(conn, domstr):
try:
int(domstr)
@@ -175,6 +182,8 @@ def action_edit(guest, options, parserclass):
fail(_("'--edit %s' doesn't make sense with --%s, "
"just use empty '--edit'") %
(options.edit, parserclass.cli_arg_name))
+ if options.distro_variant is not None:
+ fail(_("--os-variant is not supported with --edit"))
return cli.parse_option_strings(options, guest, inst, update=True)
@@ -182,6 +191,7 @@ def action_edit(guest, options, parserclass):
def action_add_device(guest, options, parserclass):
if not parserclass.prop_is_list(guest):
fail(_("Cannot use --add-device with --%s") % parserclass.cli_arg_name)
+ set_distro_variant(options, guest)
devs = cli.parse_option_strings(options, guest, None)
devs = util.listify(devs)
for dev in devs:
@@ -193,6 +203,8 @@ def action_remove_device(guest, options, parserclass):
if not parserclass.prop_is_list(guest):
fail(_("Cannot use --remove-device with --%s") %
parserclass.cli_arg_name)
+ if options.distro_variant is not None:
+ fail(_("--os-variant is not supported with --remove-device"))
devs = _find_objects_to_edit(guest, "remove-device",
getattr(options, parserclass.cli_arg_name)[-1], parserclass)
@@ -207,6 +219,8 @@ def action_build_xml(conn, options, parserclass):
if not parserclass.propname:
fail(_("--build-xml not supported for --%s") %
parserclass.cli_arg_name)
+ if options.distro_variant is not None:
+ fail(_("--os-variant is not supported with --build-xml"))
guest = virtinst.Guest(conn)
inst = parserclass.lookup_prop(guest)
--
2.19.2

1150
SPECS/virt-manager.spec Normal file

File diff suppressed because it is too large Load Diff