Accepting request 873208 from Virtualization
OBS-URL: https://build.opensuse.org/request/show/873208 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=325
This commit is contained in:
commit
83029c9aa8
@ -0,0 +1,122 @@
|
||||
commit 19d4e467707e187f6736f24a35f5a51275d869ce
|
||||
Author: Michal Prívozník <mprivozn@redhat.com>
|
||||
Date: Thu Jan 28 14:13:32 2021 +0100
|
||||
|
||||
conf: Improve virDomainVirtioOptionsCheckABIStability()
|
||||
|
||||
The virDomainVirtioOptionsCheckABIStability() function is called
|
||||
from various ABI stability check functions. Every caller checks
|
||||
if both old and new definitions have virtio options set and only
|
||||
after that they call the function. This is suboptimal because:
|
||||
|
||||
a) this check can be done in the function itself (making all
|
||||
callers shorter),
|
||||
b) is inherently wrong, because it doesn't catch case where one
|
||||
definition has virtio options set and the other doesn't.
|
||||
|
||||
Do proper checks at the beginning of the function and simplify
|
||||
its calls.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
Index: libvirt-7.0.0/src/conf/domain_conf.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_conf.c
|
||||
+++ libvirt-7.0.0/src/conf/domain_conf.c
|
||||
@@ -21491,6 +21491,15 @@ static bool
|
||||
virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptionsPtr src,
|
||||
virDomainVirtioOptionsPtr dst)
|
||||
{
|
||||
+ if (!src && !dst)
|
||||
+ return true;
|
||||
+
|
||||
+ if (!src || !dst) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("Target device virtio options don't match the source"));
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if (src->iommu != dst->iommu) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target device iommu option '%s' does not "
|
||||
@@ -21575,8 +21584,7 @@ virDomainDiskDefCheckABIStability(virDom
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -21635,8 +21643,7 @@ virDomainControllerDefCheckABIStability(
|
||||
}
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -21669,8 +21676,7 @@ virDomainFsDefCheckABIStability(virDomai
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -21718,8 +21724,7 @@ virDomainNetDefCheckABIStability(virDoma
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -21757,8 +21762,7 @@ virDomainInputDefCheckABIStability(virDo
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -21857,8 +21861,7 @@ virDomainVideoDefCheckABIStability(virDo
|
||||
}
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -22071,8 +22074,7 @@ virDomainMemballoonDefCheckABIStability(
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
@@ -22094,8 +22096,7 @@ virDomainRNGDefCheckABIStability(virDoma
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (src->virtio && dst->virtio &&
|
||||
- !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
return false;
|
||||
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
@ -30,11 +30,11 @@ Date: Tue Feb 9 14:57:22 2021 -0700
|
||||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index d27d5eb55b..5fe4e618fe 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -9230,6 +9230,9 @@ qemuBuildTPMDevStr(const virDomainDef *def,
|
||||
Index: libvirt-7.0.0/src/qemu/qemu_command.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/qemu/qemu_command.c
|
||||
+++ libvirt-7.0.0/src/qemu/qemu_command.c
|
||||
@@ -9163,6 +9163,9 @@ qemuBuildTPMDevStr(const virDomainDef *d
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
const char *model = virDomainTPMModelTypeToString(tpm->model);
|
||||
|
||||
@ -44,11 +44,10 @@ index d27d5eb55b..5fe4e618fe 100644
|
||||
virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s",
|
||||
model, tpm->info.alias, tpm->info.alias);
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/aarch64-tpm.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-tpm.aarch64-latest.args
|
||||
new file mode 100644
|
||||
index 0000000000..94a083d816
|
||||
Index: libvirt-7.0.0/tests/qemuxml2argvdata/aarch64-tpm.aarch64-latest.args
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/aarch64-tpm.aarch64-latest.args
|
||||
+++ libvirt-7.0.0/tests/qemuxml2argvdata/aarch64-tpm.aarch64-latest.args
|
||||
@@ -0,0 +1,37 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
@ -87,11 +86,10 @@ index 0000000000..94a083d816
|
||||
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
+resourcecontrol=deny \
|
||||
+-msg timestamp=on
|
||||
diff --git a/tests/qemuxml2argvdata/aarch64-tpm.xml b/tests/qemuxml2argvdata/aarch64-tpm.xml
|
||||
new file mode 100644
|
||||
index 0000000000..d338a20f17
|
||||
Index: libvirt-7.0.0/tests/qemuxml2argvdata/aarch64-tpm.xml
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/aarch64-tpm.xml
|
||||
+++ libvirt-7.0.0/tests/qemuxml2argvdata/aarch64-tpm.xml
|
||||
@@ -0,0 +1,15 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>aarch64test</name>
|
||||
@ -108,11 +106,11 @@ index 0000000000..d338a20f17
|
||||
+ </tpm>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index d324921271..82cf503dd0 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -2478,6 +2478,7 @@ mymain(void)
|
||||
Index: libvirt-7.0.0/tests/qemuxml2argvtest.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/tests/qemuxml2argvtest.c
|
||||
+++ libvirt-7.0.0/tests/qemuxml2argvtest.c
|
||||
@@ -2476,6 +2476,7 @@ mymain(void)
|
||||
DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-enc");
|
||||
DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-pstate");
|
||||
DO_TEST_CAPS_LATEST_PPC64("tpm-emulator-spapr");
|
||||
|
163
8a4b8996-conf-move-virDomainCheckVirtioOptions.patch
Normal file
163
8a4b8996-conf-move-virDomainCheckVirtioOptions.patch
Normal file
@ -0,0 +1,163 @@
|
||||
commit 8a4b8996f78f86bf10fea3e91d54e82db168547b
|
||||
Author: Michal Prívozník <mprivozn@redhat.com>
|
||||
Date: Thu Jan 28 14:06:55 2021 +0100
|
||||
|
||||
conf: Move virDomainCheckVirtioOptions() into domain_validate.c
|
||||
|
||||
The aim of virDomainCheckVirtioOptions() function is to check
|
||||
whether no virtio options are set, i.e. no @iommu no @ats and no
|
||||
@packed attributes were present in given device's XML (yeah, the
|
||||
function has very misleading name). Nevertheless, this kind of
|
||||
check belongs to validation phase, but now is done in post parse
|
||||
phase. Move the function and its calls to domain_validate.c so
|
||||
that future code is not tempted to repeat this mistake.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
Index: libvirt-7.0.0/src/conf/domain_conf.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_conf.c
|
||||
+++ libvirt-7.0.0/src/conf/domain_conf.c
|
||||
@@ -5130,34 +5130,6 @@ virDomainHostdevDefPostParse(virDomainHo
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-virDomainCheckVirtioOptions(virDomainVirtioOptionsPtr virtio)
|
||||
-{
|
||||
- if (!virtio)
|
||||
- return 0;
|
||||
-
|
||||
- if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("iommu driver option is only supported "
|
||||
- "for virtio devices"));
|
||||
- return -1;
|
||||
- }
|
||||
- if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("ats driver option is only supported "
|
||||
- "for virtio devices"));
|
||||
- return -1;
|
||||
- }
|
||||
- if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("packed driver option is only supported "
|
||||
- "for virtio devices"));
|
||||
- return -1;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static void
|
||||
virDomainChrDefPostParse(virDomainChrDefPtr chr,
|
||||
const virDomainDef *def)
|
||||
@@ -5254,11 +5226,6 @@ virDomainDiskDefPostParse(virDomainDiskD
|
||||
virDomainPostParseCheckISCSIPath(&disk->src->path);
|
||||
}
|
||||
|
||||
- if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO &&
|
||||
- virDomainCheckVirtioOptions(disk->virtio) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
|
||||
if (disk->src->nvme->managed == VIR_TRISTATE_BOOL_ABSENT)
|
||||
disk->src->nvme->managed = VIR_TRISTATE_BOOL_YES;
|
||||
@@ -5308,13 +5275,8 @@ virDomainControllerDefPostParse(virDomai
|
||||
|
||||
|
||||
static int
|
||||
-virDomainNetDefPostParse(virDomainNetDefPtr net)
|
||||
+virDomainNetDefPostParse(virDomainNetDefPtr net G_GNUC_UNUSED)
|
||||
{
|
||||
- if (!virDomainNetIsVirtioModel(net) &&
|
||||
- virDomainCheckVirtioOptions(net->virtio) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index: libvirt-7.0.0/src/conf/domain_validate.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_validate.c
|
||||
+++ libvirt-7.0.0/src/conf/domain_validate.c
|
||||
@@ -226,6 +226,34 @@ virSecurityDeviceLabelDefValidate(virSec
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+virDomainCheckVirtioOptions(virDomainVirtioOptionsPtr virtio)
|
||||
+{
|
||||
+ if (!virtio)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("iommu driver option is only supported "
|
||||
+ "for virtio devices"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("ats driver option is only supported "
|
||||
+ "for virtio devices"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("packed driver option is only supported "
|
||||
+ "for virtio devices"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
#define VENDOR_LEN 8
|
||||
#define PRODUCT_LEN 16
|
||||
|
||||
@@ -277,15 +305,19 @@ virDomainDiskDefValidate(const virDomain
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO &&
|
||||
- (disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO ||
|
||||
- disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL ||
|
||||
- disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL)) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("disk model '%s' not supported for bus '%s'"),
|
||||
- virDomainDiskModelTypeToString(disk->model),
|
||||
- virDomainDiskBusTypeToString(disk->bus));
|
||||
- return -1;
|
||||
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||
+ if (disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO ||
|
||||
+ disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL ||
|
||||
+ disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("disk model '%s' not supported for bus '%s'"),
|
||||
+ virDomainDiskModelTypeToString(disk->model),
|
||||
+ virDomainDiskBusTypeToString(disk->bus));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (virDomainCheckVirtioOptions(disk->virtio) < 0)
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
|
||||
@@ -1330,6 +1362,11 @@ virDomainNetDefValidate(const virDomainN
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!virDomainNetIsVirtioModel(net) &&
|
||||
+ virDomainCheckVirtioOptions(net->virtio) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ Date: Tue Feb 9 15:47:30 2021 -0700
|
||||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||
index a70737327e..bf4901bf89 100644
|
||||
--- a/src/qemu/qemu_validate.c
|
||||
+++ b/src/qemu/qemu_validate.c
|
||||
@@ -4299,6 +4299,12 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm,
|
||||
Index: libvirt-7.0.0/src/qemu/qemu_validate.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/qemu/qemu_validate.c
|
||||
+++ libvirt-7.0.0/src/qemu/qemu_validate.c
|
||||
@@ -4251,6 +4251,12 @@ qemuValidateDomainDeviceDefTPM(virDomain
|
||||
|
||||
switch (tpm->model) {
|
||||
case VIR_DOMAIN_TPM_MODEL_TIS:
|
||||
|
326
bd112c9e-qemu-virtio-options-vsock.patch
Normal file
326
bd112c9e-qemu-virtio-options-vsock.patch
Normal file
@ -0,0 +1,326 @@
|
||||
commit bd112c9e0f7523b90bf1362cf60deea7db05a32b
|
||||
Author: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Wed Jan 27 19:46:59 2021 +0100
|
||||
|
||||
qemu: Add virtio related options to vsock
|
||||
|
||||
Add virtio related options iommu, ats and packed as driver element attributes
|
||||
to vsock devices. Ex:
|
||||
|
||||
<vsock model='virtio'>
|
||||
<cid auto='no' address='3'/>
|
||||
<driver iommu='on'/>
|
||||
</vsock>
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
|
||||
Index: libvirt-7.0.0/docs/formatdomain.rst
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/docs/formatdomain.rst
|
||||
+++ libvirt-7.0.0/docs/formatdomain.rst
|
||||
@@ -7414,6 +7414,8 @@ devices <#elementsVirtioTransitional>`__
|
||||
attribute ``address`` of the ``cid`` element specifies the CID assigned to the
|
||||
guest. If the attribute ``auto`` is set to ``yes``, libvirt will assign a free
|
||||
CID automatically on domain startup. :since:`Since 4.4.0`
|
||||
+The optional ``driver`` element allows to specify virtio options, see
|
||||
+`Virtio-specific options <#elementsVirtio>`__ for more details. :since:`Since 7.1.0`
|
||||
|
||||
::
|
||||
|
||||
Index: libvirt-7.0.0/docs/schemas/domaincommon.rng
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/docs/schemas/domaincommon.rng
|
||||
+++ libvirt-7.0.0/docs/schemas/domaincommon.rng
|
||||
@@ -4883,6 +4883,11 @@
|
||||
<optional>
|
||||
<ref name="alias"/>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="driver">
|
||||
+ <ref name="virtioOptions"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
Index: libvirt-7.0.0/src/conf/domain_conf.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_conf.c
|
||||
+++ libvirt-7.0.0/src/conf/domain_conf.c
|
||||
@@ -2456,6 +2456,7 @@ virDomainVsockDefFree(virDomainVsockDefP
|
||||
|
||||
virObjectUnref(vsock->privateData);
|
||||
virDomainDeviceInfoClear(&vsock->info);
|
||||
+ VIR_FREE(vsock->virtio);
|
||||
VIR_FREE(vsock);
|
||||
}
|
||||
|
||||
@@ -15624,6 +15625,11 @@ virDomainVsockDefParseXML(virDomainXMLOp
|
||||
if (virDomainDeviceInfoParseXML(xmlopt, node, &vsock->info, flags) < 0)
|
||||
return NULL;
|
||||
|
||||
+ if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt),
|
||||
+ &vsock->virtio) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+
|
||||
return g_steal_pointer(&vsock);
|
||||
}
|
||||
|
||||
@@ -22806,6 +22812,9 @@ virDomainVsockDefCheckABIStability(virDo
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||
+ return false;
|
||||
+
|
||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||
return false;
|
||||
|
||||
@@ -27994,6 +28003,7 @@ virDomainVsockDefFormat(virBufferPtr buf
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) cidAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||
+ g_auto(virBuffer) drvAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (vsock->model) {
|
||||
virBufferAsprintf(&attrBuf, " model='%s'",
|
||||
@@ -28010,6 +28020,9 @@ virDomainVsockDefFormat(virBufferPtr buf
|
||||
|
||||
virDomainDeviceInfoFormat(&childBuf, &vsock->info, 0);
|
||||
|
||||
+ virDomainVirtioOptionsFormat(&drvAttrBuf, vsock->virtio);
|
||||
+
|
||||
+ virXMLFormatElement(&childBuf, "driver", &drvAttrBuf, NULL);
|
||||
virXMLFormatElement(buf, "vsock", &attrBuf, &childBuf);
|
||||
}
|
||||
|
||||
Index: libvirt-7.0.0/src/conf/domain_conf.h
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_conf.h
|
||||
+++ libvirt-7.0.0/src/conf/domain_conf.h
|
||||
@@ -2542,6 +2542,7 @@ struct _virDomainVsockDef {
|
||||
virTristateBool auto_cid;
|
||||
|
||||
virDomainDeviceInfo info;
|
||||
+ virDomainVirtioOptionsPtr virtio;
|
||||
};
|
||||
|
||||
struct _virDomainVirtioOptions {
|
||||
Index: libvirt-7.0.0/src/conf/domain_validate.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_validate.c
|
||||
+++ libvirt-7.0.0/src/conf/domain_validate.c
|
||||
@@ -1450,6 +1450,15 @@ virDomainMemoryDefValidate(const virDoma
|
||||
}
|
||||
|
||||
|
||||
+static bool
|
||||
+virDomainVsockIsVirtioModel(const virDomainVsockDef *vsock)
|
||||
+{
|
||||
+ return (vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO ||
|
||||
+ vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL ||
|
||||
+ vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL);
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virDomainVsockDefValidate(const virDomainVsockDef *vsock)
|
||||
{
|
||||
@@ -1459,6 +1468,10 @@ virDomainVsockDefValidate(const virDomai
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!virDomainVsockIsVirtioModel(vsock) &&
|
||||
+ virDomainCheckVirtioOptions(vsock->virtio) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index: libvirt-7.0.0/src/qemu/qemu_command.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/qemu/qemu_command.c
|
||||
+++ libvirt-7.0.0/src/qemu/qemu_command.c
|
||||
@@ -9731,6 +9731,9 @@ qemuBuildVsockDevStr(virDomainDefPtr def
|
||||
virBufferAsprintf(&buf, ",id=%s", vsock->info.alias);
|
||||
virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid);
|
||||
virBufferAsprintf(&buf, ",vhostfd=%s%u", fdprefix, priv->vhostfd);
|
||||
+
|
||||
+ qemuBuildVirtioOptionsStr(&buf, vsock->virtio);
|
||||
+
|
||||
if (qemuBuildDeviceAddressStr(&buf, def, &vsock->info, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
Index: libvirt-7.0.0/src/qemu/qemu_validate.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/qemu/qemu_validate.c
|
||||
+++ libvirt-7.0.0/src/qemu/qemu_validate.c
|
||||
@@ -4200,6 +4200,9 @@ qemuValidateDomainDeviceDefVsock(const v
|
||||
"vsock"))
|
||||
return -1;
|
||||
|
||||
+ if (qemuValidateDomainVirtioOptions(vsock->virtio, qemuCaps) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index: libvirt-7.0.0/tests/qemuxml2argvdata/vhost-vsock-ccw-iommu.s390x-latest.args
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-7.0.0/tests/qemuxml2argvdata/vhost-vsock-ccw-iommu.s390x-latest.args
|
||||
@@ -0,0 +1,42 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
|
||||
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
|
||||
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-s390x \
|
||||
+-name guest=QEMUGuest1,debug-threads=on \
|
||||
+-S \
|
||||
+-object secret,id=masterKey0,format=raw,\
|
||||
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
+-machine s390-ccw-virtio,accel=tcg,usb=off,dump-guest-core=off,\
|
||||
+memory-backend=s390.ram \
|
||||
+-cpu qemu \
|
||||
+-m 214 \
|
||||
+-object memory-backend-ram,id=s390.ram,size=224395264 \
|
||||
+-overcommit mem-lock=off \
|
||||
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
+-display none \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-boot strict=on \
|
||||
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\
|
||||
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\
|
||||
+"file":"libvirt-1-storage"}' \
|
||||
+-device virtio-blk-ccw,devno=fe.0.0000,drive=libvirt-1-format,id=virtio-disk0,\
|
||||
+bootindex=1 \
|
||||
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0001 \
|
||||
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
+resourcecontrol=deny \
|
||||
+-device vhost-vsock-ccw,id=vsock0,guest-cid=4,vhostfd=6789,iommu_platform=on,\
|
||||
+devno=fe.0.0002 \
|
||||
+-msg timestamp=on
|
||||
Index: libvirt-7.0.0/tests/qemuxml2argvdata/vhost-vsock-ccw-iommu.xml
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-7.0.0/tests/qemuxml2argvdata/vhost-vsock-ccw-iommu.xml
|
||||
@@ -0,0 +1,37 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <cpu mode='custom' match='exact' check='none'>
|
||||
+ <model fallback='forbid'>qemu</model>
|
||||
+ </cpu>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='qemu' type='raw'/>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='virtio'/>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
|
||||
+ </disk>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <memballoon model='virtio'>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
|
||||
+ </memballoon>
|
||||
+ <panic model='s390'/>
|
||||
+ <vsock model='virtio'>
|
||||
+ <cid auto='no' address='4'/>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
|
||||
+ <driver iommu='on'/>
|
||||
+ </vsock>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
Index: libvirt-7.0.0/tests/qemuxml2argvtest.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/tests/qemuxml2argvtest.c
|
||||
+++ libvirt-7.0.0/tests/qemuxml2argvtest.c
|
||||
@@ -3400,6 +3400,7 @@ mymain(void)
|
||||
DO_TEST_CAPS_LATEST("vhost-vsock-auto");
|
||||
DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw", "s390x");
|
||||
DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw-auto", "s390x");
|
||||
+ DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw-iommu", "s390x");
|
||||
|
||||
DO_TEST_CAPS_VER("launch-security-sev", "2.12.0");
|
||||
DO_TEST_CAPS_VER("launch-security-sev-missing-platform-info", "2.12.0");
|
||||
Index: libvirt-7.0.0/tests/qemuxml2xmloutdata/vhost-vsock-ccw-iommu.s390x-latest.xml
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-7.0.0/tests/qemuxml2xmloutdata/vhost-vsock-ccw-iommu.s390x-latest.xml
|
||||
@@ -0,0 +1,37 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <cpu mode='custom' match='exact' check='none'>
|
||||
+ <model fallback='forbid'>qemu</model>
|
||||
+ </cpu>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='qemu' type='raw'/>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='virtio'/>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
|
||||
+ </disk>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <memballoon model='virtio'>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
|
||||
+ </memballoon>
|
||||
+ <panic model='s390'/>
|
||||
+ <vsock model='virtio'>
|
||||
+ <cid auto='no' address='4'/>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
|
||||
+ <driver iommu='on'/>
|
||||
+ </vsock>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
Index: libvirt-7.0.0/tests/qemuxml2xmltest.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/tests/qemuxml2xmltest.c
|
||||
+++ libvirt-7.0.0/tests/qemuxml2xmltest.c
|
||||
@@ -1402,6 +1402,8 @@ mymain(void)
|
||||
QEMU_CAPS_CCW);
|
||||
DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK,
|
||||
QEMU_CAPS_CCW);
|
||||
+ DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw-iommu", "s390x");
|
||||
+
|
||||
|
||||
DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory");
|
||||
DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages");
|
49
c05f0066-conf-drop-empty-virDomainNetDefPostParse.patch
Normal file
49
c05f0066-conf-drop-empty-virDomainNetDefPostParse.patch
Normal file
@ -0,0 +1,49 @@
|
||||
commit c05f00666c730de95a2e18f75326d3e9ee128bdd
|
||||
Author: Michal Prívozník <mprivozn@redhat.com>
|
||||
Date: Thu Jan 28 14:08:24 2021 +0100
|
||||
|
||||
conf: Drop empty virDomainNetDefPostParse()
|
||||
|
||||
The previous commit rendered this function empty and needless.
|
||||
Remove it.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
Index: libvirt-7.0.0/src/conf/domain_conf.c
|
||||
===================================================================
|
||||
--- libvirt-7.0.0.orig/src/conf/domain_conf.c
|
||||
+++ libvirt-7.0.0/src/conf/domain_conf.c
|
||||
@@ -5274,13 +5274,6 @@ virDomainControllerDefPostParse(virDomai
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-virDomainNetDefPostParse(virDomainNetDefPtr net G_GNUC_UNUSED)
|
||||
-{
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static void
|
||||
virDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
|
||||
{
|
||||
@@ -5329,10 +5322,6 @@ virDomainDeviceDefPostParseCommon(virDom
|
||||
ret = virDomainControllerDefPostParse(dev->data.controller);
|
||||
break;
|
||||
|
||||
- case VIR_DOMAIN_DEVICE_NET:
|
||||
- ret = virDomainNetDefPostParse(dev->data.net);
|
||||
- break;
|
||||
-
|
||||
case VIR_DOMAIN_DEVICE_VSOCK:
|
||||
virDomainVsockDefPostParse(dev->data.vsock);
|
||||
ret = 0;
|
||||
@@ -5340,6 +5329,7 @@ virDomainDeviceDefPostParseCommon(virDom
|
||||
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_FS:
|
||||
+ case VIR_DOMAIN_DEVICE_NET:
|
||||
case VIR_DOMAIN_DEVICE_INPUT:
|
||||
case VIR_DOMAIN_DEVICE_SOUND:
|
||||
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 17 15:11:25 UTC 2021 - James Fehlig <jfehlig@suse.com>
|
||||
|
||||
- qemu: Add virtio related options to vsock
|
||||
8a4b8996-conf-move-virDomainCheckVirtioOptions.patch,
|
||||
c05f0066-conf-drop-empty-virDomainNetDefPostParse.patch,
|
||||
19d4e467-conf-improve-virDomainVirtioOptionsCheckABIStability.patch,
|
||||
bd112c9e-qemu-virtio-options-vsock.patch
|
||||
bsc#1182365
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 11 17:21:23 UTC 2021 - James Fehlig <jfehlig@suse.com>
|
||||
|
||||
|
@ -295,6 +295,10 @@ Patch0: 32c5e432-revert-f035f53b.patch
|
||||
Patch1: e3d60f76-fix-socket-file-gen.patch
|
||||
Patch2: 7cf60006-qemu-swtpm-aarch64.patch
|
||||
Patch3: afb823fc-qemu-validate-swtpm.patch
|
||||
Patch4: 8a4b8996-conf-move-virDomainCheckVirtioOptions.patch
|
||||
Patch5: c05f0066-conf-drop-empty-virDomainNetDefPostParse.patch
|
||||
Patch6: 19d4e467-conf-improve-virDomainVirtioOptionsCheckABIStability.patch
|
||||
Patch7: bd112c9e-qemu-virtio-options-vsock.patch
|
||||
# Patches pending upstream review
|
||||
Patch100: libxl-dom-reset.patch
|
||||
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch
|
||||
|
Loading…
Reference in New Issue
Block a user