From patchwork Wed Jan 23 21:32:29 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156397
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201294jaa;
Wed, 23 Jan 2019 13:33:21 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4E5UPz0Y6itg8rXdR38/r9c8ZYOagprbbKZeYh4H1I/MIUQ7GpmorYcSGPNBTrojUV6mLL
X-Received: by 2002:a37:6a42:: with SMTP id f63mr3362276qkc.224.1548279201934;
Wed, 23 Jan 2019 13:33:21 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279201; cv=none;
d=google.com; s=arc-20160816;
b=vv/EP28YHowmUX1myybamt3L7AwkEwhR0UASG0TXYuxwYeeZx5CDX/BuIPtMRJL9KS
zsYov2G2sH1Q7L5Zs6zA9yUqijjUtyGLaTOWBHFbk5tJR1zMKdvq93q8WHDs6Pux/wgX
7N50AchXnPMBbpnOFtrvOCE0aHFpH4XQ5j5J4CXBinML7cnozHMSto3g4dQnkBdLsY//
9QcQZPX9G3oRd4PXZroHBuABEljFQKmSH+wLNn69bhkWSQT6Q3OAmxN5fn8l8Px3tP63
eZcNmcmlGRT6aZPn0uFpkgkK3PILhgtUEzS7olcHBDUrP4WJ33i3/7240reNlqtG1K1C
Gnwg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=9xH3mvpp5TNJJoolG0cj+cbW+J6377byEkR58QTiKOA=;
b=EBc1dNiVhr2nU+WcC9TWrnHhwdk1lFqzVgoglxA7DtUlhUI+QWk3UhF14JCJuh3UCF
G/zPM+hM8mXVcbyhy2P1DYfkb+wMbwTDIgGEe56dL9QywPWmuBFE5Hvqb0Ke1yIToVXt
sR5y09VC4hV0DieFP4keJTfHAzr5UyMxVyUxKLIdNqa6ey6iXkHDXiIl4a+FzG3Jrq0D
psSyTCrgNaiJKJh3q3umy8DbmA9D1K22f3h+977Vj4wPNT04FGqah5iLgWA05mFFgK8C
EDsbN5siZzX68xndmIUjB6/k2Fpw3pqUV95uC3Ta5BQzOO8y8vtzFgmYyrxGNFONSx5M
j/6Q==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
v63si1405251qkl.145.2019.01.23.13.33.21
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:21 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 698CB2CD80F;
Wed, 23 Jan 2019 21:33:20 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C2BD26348;
Wed, 23 Jan 2019 21:33:19 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9FC3E3F7D0;
Wed, 23 Jan 2019 21:33:17 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXFl1032243 for ;
Wed, 23 Jan 2019 16:33:15 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 88CA1BA50; Wed, 23 Jan 2019 21:33:15 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id C1AD167141;
Wed, 23 Jan 2019 21:33:14 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:29 -0500
Message-Id: <3ef0b006becbb1912099ab98ce77f5b4de7232bf.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 01/25] conf: Set net->model earlier
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.29]);
Wed, 23 Jan 2019 21:33:21 +0000 (UTC)
So later code can more easily access def->model
Signed-off-by: Cole Robinson
---
src/conf/domain_conf.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 54d6364f4f..564248e021 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11305,6 +11305,22 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
+ /* NIC model (see -net nic,model=?). We only check that it looks
+ * reasonable, not that it is a supported NIC type. FWIW kvm
+ * supports these types as of April 2008:
+ * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio
+ * QEMU PPC64 supports spapr-vlan
+ */
+ if (model != NULL) {
+ if (strspn(model, NET_MODEL_CHARS) < strlen(model)) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Model name contains invalid characters"));
+ goto error;
+ }
+ def->model = model;
+ model = NULL;
+ }
+
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
if (network == NULL) {
@@ -11322,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
- if (STRNEQ_NULLABLE(model, "virtio")) {
+ if (STRNEQ_NULLABLE(def->model, "virtio")) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Wrong or no 'type' attribute "
"specified with . "
@@ -11550,22 +11566,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
ifname_guest_actual = NULL;
}
- /* NIC model (see -net nic,model=?). We only check that it looks
- * reasonable, not that it is a supported NIC type. FWIW kvm
- * supports these types as of April 2008:
- * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio
- * QEMU PPC64 supports spapr-vlan
- */
- if (model != NULL) {
- if (strspn(model, NET_MODEL_CHARS) < strlen(model)) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("Model name contains invalid characters"));
- goto error;
- }
- def->model = model;
- model = NULL;
- }
-
if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
STREQ_NULLABLE(def->model, "virtio")) {
if (backend != NULL) {
From patchwork Wed Jan 23 21:32:30 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156400
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201440jaa;
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
X-Google-Smtp-Source: ALg8bN6aglL5oJjxKVWTJHvPSxirq6dqEh2F5q8eMeybbbnKce0i2Lsy53X4zZG/L5qbbqpaepG2
X-Received: by 2002:a37:4d03:: with SMTP id a3mr3341323qkb.181.1548279209527;
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279209; cv=none;
d=google.com; s=arc-20160816;
b=1HlJKdGFHzloRjika4BxetV4pVEvkKZ5tjdncSNq2kCvawKbTJdQYgDDFtcGZjLsMn
e5wLzbYFfA7efWhxStN4RwtN6Y1lEMNqfVHJOuuWy8OwojKp1JAp0FV4Fv8eovgz3Ew2
dDrXyEBVb3QIM930uqNygs3kQhi9EVIwUxNO+4Tcd+yaLvjxX7bNXoYJpVaxp+u10SoH
2mn/MBy351MQtsmZkZ/mthiE+8bOs4xFMvYb3dIO1TzXf2MoZOJZBYV1+YyuxTcT+hpa
1MaYb9Q4N/4sEjxkoYlB7BhryN8QYkXe0aXzfedkN12F+Dsb62nV/LZ/mOGTzagVdmiO
9fAg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=3/Fdey+3TKVytSTM7C5BST5pdfHLOYxpkvJnmKJADxw=;
b=IPCfi07ZkXsKcxerUtHMrUuENwEv3cDFXdiST2wbRlVukA2Z4GmzlGzJXrmrWol8v7
vSZOPhNlF2Yp/+o0D1f3dP5UF8AwlOpIuATcZlt4wx1ZMVSM/hu3xyGwgkGoDRziaE1w
RQxd8b3Ulg7CDvHDwxRYEpOr4AXVRsgbRd1TTZ1vcjEQE6Ne9NkGWPQzJIXkysnxAFeo
HFTHXLm5MUh0Z78XIbrwS4mHv8J7LMIPmq12A8OuA8jXzZqfHR277iueZFflwDgFh2oc
trZirbs9MxEAwsxbF0sSwAivSGtEQcul+9fMP5xFjcQ/0MyaKT2L6NW37BCb7nxd09EQ
hyyA==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
j90si1036694qtd.27.2019.01.23.13.33.29
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id C2E1512F91F;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 91FF565F72;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4BF4B180BAAC;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXGYP032253 for ;
Wed, 23 Jan 2019 16:33:16 -0500
Received: by smtp.corp.redhat.com (Postfix)
id AB4B3BA8B; Wed, 23 Jan 2019 21:33:16 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id E993DBA50;
Wed, 23 Jan 2019 21:33:15 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:30 -0500
Message-Id: <47ddb9fa42a14fdb72e1dfd8d4a66752ebee00ea.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 02/25] conf: Add virDomainNetIsVirtioModel
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
This will be extended in the future, so let's simplify things by
centralizing the checks.
Signed-off-by: Cole Robinson
---
src/conf/domain_conf.c | 15 +++++++++++----
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domain_address.c | 2 +-
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_interface.c | 8 ++++----
src/security/virt-aa-helper.c | 2 +-
tests/qemuxml2argvmock.c | 2 +-
10 files changed, 23 insertions(+), 14 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 564248e021..bcdb6b0a3a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4732,7 +4732,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_NET) {
virDomainNetDefPtr net = dev->data.net;
- if (STRNEQ_NULLABLE(net->model, "virtio") &&
+ if (!virDomainNetIsVirtioModel(net) &&
virDomainCheckVirtioOptions(net->virtio) < 0)
return -1;
}
@@ -11338,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
- if (STRNEQ_NULLABLE(def->model, "virtio")) {
+ if (!virDomainNetIsVirtioModel(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Wrong or no 'type' attribute "
"specified with . "
@@ -11567,7 +11567,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
- STREQ_NULLABLE(def->model, "virtio")) {
+ virDomainNetIsVirtioModel(def)) {
if (backend != NULL) {
if ((val = virDomainNetBackendTypeFromString(backend)) < 0 ||
val == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
@@ -25462,7 +25462,7 @@ virDomainNetDefFormat(virBufferPtr buf,
if (def->model) {
virBufferEscapeString(buf, "\n",
def->model);
- if (STREQ(def->model, "virtio")) {
+ if (virDomainNetIsVirtioModel(def)) {
char *str = NULL, *gueststr = NULL, *hoststr = NULL;
int rc = 0;
@@ -29716,6 +29716,13 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface)
}
+bool
+virDomainNetIsVirtioModel(const virDomainNetDef *net)
+{
+ return STREQ_NULLABLE(net->model, "virtio");
+}
+
+
/* Return listens[i] from the appropriate union for the graphics
* type, or NULL if this is an unsuitable type, or the index is out of
* bounds. If force0 is TRUE, i == 0, and there is no listen array,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7776a3afb2..218aa4dd94 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3217,6 +3217,7 @@ virNetDevBandwidthPtr
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
+bool virDomainNetIsVirtioModel(const virDomainNetDef *net);
int virDomainNetAppendIPAddress(virDomainNetDefPtr def,
const char *address,
int family,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c3d6306809..6f4809a68a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -469,6 +469,7 @@ virDomainNetGetActualType;
virDomainNetGetActualVirtPortProfile;
virDomainNetGetActualVlan;
virDomainNetInsert;
+virDomainNetIsVirtioModel;
virDomainNetNotifyActualDevice;
virDomainNetReleaseActualDevice;
virDomainNetRemove;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2fb7d32dd4..128cf331b3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3654,7 +3654,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
bool usingVirtio = false;
char macaddr[VIR_MAC_STRING_BUFLEN];
- if (STREQ(net->model, "virtio")) {
+ if (virDomainNetIsVirtioModel(net)) {
if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0)
goto error;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 32a43f2064..1376819020 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4665,7 +4665,7 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
return -1;
}
- if (STREQ_NULLABLE(net->model, "virtio")) {
+ if (virDomainNetIsVirtioModel(net)) {
if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("rx_queue_size has to be a power of two"));
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9e0b50d41e..cb1e5f9e40 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -320,7 +320,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
- if (STREQ_NULLABLE(net->model, "virtio") &&
+ if (virDomainNetIsVirtioModel(net) &&
net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
net->info.type = type;
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1df80fcab6..5894c3dd49 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3710,7 +3710,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
goto cleanup;
}
- if (olddev->model && STREQ(olddev->model, "virtio") &&
+ if (virDomainNetIsVirtioModel(olddev) &&
(olddev->driver.virtio.name != newdev->driver.virtio.name ||
olddev->driver.virtio.txmode != newdev->driver.virtio.txmode ||
olddev->driver.virtio.ioeventfd != newdev->driver.virtio.ioeventfd ||
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index 2607dea1f5..2816db908a 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -261,7 +261,7 @@ qemuInterfaceDirectConnect(virDomainDefPtr def,
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
unsigned int macvlan_create_flags = VIR_NETDEV_MACVLAN_CREATE_WITH_TAP;
- if (net->model && STREQ(net->model, "virtio"))
+ if (virDomainNetIsVirtioModel(net))
macvlan_create_flags |= VIR_NETDEV_MACVLAN_VNET_HDR;
if (virNetDevMacVLanCreateWithVPortProfile(net->ifname,
@@ -434,7 +434,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
template_ifname = true;
}
- if (net->model && STREQ(net->model, "virtio"))
+ if (virDomainNetIsVirtioModel(net))
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
@@ -533,7 +533,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
template_ifname = true;
}
- if (net->model && STREQ(net->model, "virtio"))
+ if (virDomainNetIsVirtioModel(net))
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
if (virQEMUDriverIsPrivileged(driver)) {
@@ -653,7 +653,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def,
}
/* If the nic model isn't virtio, don't try to open. */
- if (!(net->model && STREQ(net->model, "virtio"))) {
+ if (!virDomainNetIsVirtioModel(net)) {
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("vhost-net is only supported for "
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 46443a3153..56d7cfadf1 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1255,7 +1255,7 @@ get_files(vahControl * ctl)
if (net && net->model) {
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU)
continue;
- if (STRNEQ(net->model, "virtio"))
+ if (!virDomainNetIsVirtioModel(net))
continue;
}
needsvhost = true;
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index b300793732..3f0c1c3fef 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -228,7 +228,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def ATTRIBUTE_UNUSED,
{
size_t i;
- if (!(net->model && STREQ(net->model, "virtio"))) {
+ if (!virDomainNetIsVirtioModel(net)) {
*vhostfdSize = 0;
return 0;
}
From patchwork Wed Jan 23 21:32:31 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156399
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201437jaa;
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7L71O52dehIb4mAhvnGmaIB3AYak1X3o9t49aFaMlHhEubE38TxmdYkLGyWjvexbEYq/ZH
X-Received: by 2002:ac8:31ed:: with SMTP id i42mr4082903qte.323.1548279209330;
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279209; cv=none;
d=google.com; s=arc-20160816;
b=EZ6EVqeFykXm4fitCi5tyWxmAwcpnHYN+N+TpA6ATsrZT1n4qlZVdoJ3VMGGUQ0j0j
xTSBbrQ3CR6KnVo4Jmm9Lr648Bkj4aQn8e5EC2+v5LSfdSL8NAu+/8QCEnfgiNzwAhwn
X/oSfblM7bJpZrU7UWfYcuJUN11GrAcf5m5a7Wcjicb0kQ+KHxHLcCyn6uunl01fwAar
uM/SrLUR28ihdDQefa4Ycc2nI+JskKbcB6m/Ql9g0ZehI9jVLyVqHORyyd8M+CbDc0Kv
cnI/syFlqB/RLfjM1SShMhBYElCoFIJePjol9Tlx3FxZUaKR0A6f+EjsLAhBDqHwDeZp
Atjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=K2kL8qqcxUhITNw95t0TAVxPljuK0vfR7A88Ea7mLek=;
b=c9sGntyLkzzSXiCOB3lVvii1D98fTDZSKBLmvcfx0yCpZ0m0L94sA8PiWxgyDXznG3
/9plReDeWg4O8NWmk8xgEDyLbAelnWE8Fq3RTr7J6slezw1HoPf4nyVdqt33kMPeNYFy
2QlpPtHXSufqK/bSHVmbRUfcqxhN0CjNzZP+d2+EvNbCmNbOIeZhXVpob7/y0Nh1yDFz
iFw53dVUoLgjbMCnpaOd4POqzndF/BdluYNyT3RoF6dxYwwG6NRiLJVZgIsju6WMJNVv
u+jJiJjAOxTbAmKtNkeAf9oeTcsX6nO1GqbtYQ0FO446iPCMIhyChYRH6ouaoYfepCB7
5bDw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id t1si2675224qkj.73.2019.01.23.13.33.29
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id D8BC77FDE6;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BAB360469;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 54CAB18033A1;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXHXK032261 for ;
Wed, 23 Jan 2019 16:33:17 -0500
Received: by smtp.corp.redhat.com (Postfix)
id B09A8BA8B; Wed, 23 Jan 2019 21:33:17 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id EE851BA50;
Wed, 23 Jan 2019 21:33:16 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:31 -0500
Message-Id: <4125ca8687d60bf72f717b5642adf6cf95739759.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 03/25] qemu: Move validation out
of qemu_command.c
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
If we validate that memballoon is NONE|VIRTIO at parse time,
we can drop similar checks elsewhere in the qemu driver
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 17 ----------------
src/qemu/qemu_domain.c | 36 +++++++++++++++++++++++++++++++++-
src/qemu/qemu_domain_address.c | 10 ++++------
src/qemu/qemu_driver.c | 17 +++++++---------
src/qemu/qemu_process.c | 3 +--
5 files changed, 47 insertions(+), 36 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 128cf331b3..2d05b4a93b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4046,20 +4046,9 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- if (STRPREFIX(def->os.machine, "s390-virtio") &&
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon)
- def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
-
if (!virDomainDefHasMemballoon(def))
return 0;
- if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Memory balloon device type '%s' is not supported by this version of qemu"),
- virDomainMemballoonModelTypeToString(def->memballoon->model));
- return -1;
- }
-
if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
def->memballoon->info.type) < 0) {
goto error;
@@ -4070,12 +4059,6 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
goto error;
if (def->memballoon->autodeflate != VIR_TRISTATE_SWITCH_ABSENT) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("deflate-on-oom is not supported by this QEMU binary"));
- goto error;
- }
-
virBufferAsprintf(&buf, ",deflate-on-oom=%s",
virTristateSwitchTypeToString(def->memballoon->autodeflate));
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1376819020..a0ab55d5db 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3481,6 +3481,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
def->memballoon = memballoon;
}
+ if (STRPREFIX(def->os.machine, "s390-virtio") &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon)
+ def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
+
if (addDefaultUSBKBD &&
def->ngraphics > 0 &&
virDomainDefMaybeAddInput(def,
@@ -5980,6 +5984,33 @@ qemuDomainDeviceDefValidateInput(const virDomainInputDef *input,
}
+static int
+qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *memballoon,
+ virQEMUCapsPtr qemuCaps)
+{
+ if (!memballoon ||
+ memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) {
+ return 0;
+ }
+
+ if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Memory balloon device type '%s' is not supported by this version of qemu"),
+ virDomainMemballoonModelTypeToString(memballoon->model));
+ return -1;
+ }
+
+ if (memballoon->autodeflate != VIR_TRISTATE_SWITCH_ABSENT &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("deflate-on-oom is not supported by this QEMU binary"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDeviceDefValidateZPCIAddress(virDomainDeviceInfoPtr info,
virQEMUCapsPtr qemuCaps)
@@ -6088,11 +6119,14 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
ret = qemuDomainDeviceDefValidateInput(dev->data.input, def, qemuCaps);
break;
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ ret = qemuDomainDeviceDefValidateMemballoon(dev->data.memballoon, qemuCaps);
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_HUB:
- case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_MEMORY:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index cb1e5f9e40..1802c36b86 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -358,8 +358,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
def->hostdevs[i]->info->type = type;
}
- if (def->memballoon &&
- def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ /* All memballoon devices accepted by the qemu driver are virtio */
+ if (virDomainDefHasMemballoon(def) &&
def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
def->memballoon->info.type = type;
@@ -2268,11 +2268,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
goto error;
}
- /* VirtIO balloon */
- if (def->memballoon &&
- def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ /* memballoon. the qemu driver only accepts virtio memballoon devices */
+ if (virDomainDefHasMemballoon(def) &&
virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) {
-
if (qemuDomainPCIAddressReserveNextAddr(addrs,
&def->memballoon->info) < 0)
goto error;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 90319261ff..26a83a754b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2439,11 +2439,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
priv = vm->privateData;
if (def) {
- if (!def->memballoon ||
- def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+ if (!virDomainDefHasMemballoon(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Memory balloon model must be virtio to set the"
- " collection period"));
+ _("No memory balloon device configured, "
+ "can not set the collection period"));
goto endjob;
}
@@ -2463,11 +2462,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
}
if (persistentDef) {
- if (!persistentDef->memballoon ||
- persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+ if (!virDomainDefHasMemballoon(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Memory balloon model must be virtio to set the"
- " collection period"));
+ _("No memory balloon device configured, "
+ "can not set the collection period"));
goto endjob;
}
persistentDef->memballoon->period = period;
@@ -11964,8 +11962,7 @@ qemuDomainMemoryStatsInternal(virQEMUDriverPtr driver,
if (virDomainObjCheckActive(vm) < 0)
return -1;
- if (vm->def->memballoon &&
- vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+ if (virDomainDefHasMemballoon(vm->def)) {
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm),
vm->def->memballoon, stats, nr_stats);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8120201eb6..9ccc3601a2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7593,8 +7593,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
if (running) {
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_UNPAUSED);
- if (vm->def->memballoon &&
- vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ if (virDomainDefHasMemballoon(vm->def) &&
vm->def->memballoon->period) {
qemuDomainObjEnterMonitor(driver, vm);
qemuMonitorSetMemoryStatsPeriod(priv->mon, vm->def->memballoon,
From patchwork Wed Jan 23 21:32:32 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156401
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201490jaa;
Wed, 23 Jan 2019 13:33:33 -0800 (PST)
X-Google-Smtp-Source: ALg8bN50vXr5DLqz+zd6JrmH1rU7hKkMcAFaR+f/ujeaZ78mABpBYQttz5oHe1JuZA4TXLIGgEyM
X-Received: by 2002:a37:af42:: with SMTP id y63mr3219877qke.251.1548279213753;
Wed, 23 Jan 2019 13:33:33 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279213; cv=none;
d=google.com; s=arc-20160816;
b=YgBJPzpOYMPgh3pb0vYTxNTl9uHAH4EEle7QlJpCLZG47v4mo+iJViFYcOFFoG65H+
b4RXvht7/bTl+CGs1gK7hOI76t1o270CWzLx7Wzdw/bns7fzI2qnORfVbapziKWvxY4l
t+Gr737GzLHdMANNvxOyusy0rFzMzouRYCNez3iEGKI3EQHyLb9aX97c14TObSaHXrSQ
1np0jHZf+Wf74QCipG/66ujkJGQfbyvYUbspBjiV8bG4MiqMGO3Lry/PnnJqtvZzY+xp
WcJ00TxFgTHxwPvK0In8vK+CySxyIm3LEWyLh5bb3LRyN+lKyGTUrHmMqg+D3wAc7+e6
l7Nw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=0jh5bKjab9wzQfj4u5tcK1OcmRQr2GwG0GsAVceIBO0=;
b=JMJ7/+T7gtdFvG6jFhEOM0oJTmy5uzXYSGSk/HOtZX/ba8jUdu2Iyl1bS6ehXHIgb4
hE+4OLlt55WJAxzPCBOzBa9LDHNDdgHJxkLBnjrEQWVqygilbs931Nuc4q8GkDtEOeSm
efLB81gzHrwISggPHt2fc5YCQ1obQQX4rKb4mWpGvub+La79FkVpLtkVjUc0dpV0lQDi
Yjg77unEpEKzP9EBvZtmzOix1qpJq1jg6PyWaq1Wt/a6c5yKQIMxnBTJwDU8JES+idcC
hEnyhivw5QWazKAiQRk93cnY1igcLnbDsqfQlpBEH5KF7QEh23PFWiDMyIjlgqqQ7j5f
wWQw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
k15si3289170qke.86.2019.01.23.13.33.33
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:33 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 186D87FDF3;
Wed, 23 Jan 2019 21:33:32 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id C746B6C212;
Wed, 23 Jan 2019 21:33:31 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 731B318033A1;
Wed, 23 Jan 2019 21:33:31 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXIhj032268 for ;
Wed, 23 Jan 2019 16:33:18 -0500
Received: by smtp.corp.redhat.com (Postfix)
id CFC00BA8B; Wed, 23 Jan 2019 21:33:18 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id F2EA8BA96;
Wed, 23 Jan 2019 21:33:17 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:32 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 04/25] qemu: Move validation out of
qemu_command.c
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:33:32 +0000 (UTC)
Move the rng->model == VIRTIO check to parse time. This also
allows us to remove similar checks throughout the qemu driver
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 8 --------
src/qemu/qemu_domain.c | 23 +++++++++++++++++++++--
src/qemu/qemu_domain_address.c | 9 ++++-----
tests/qemuxml2xmltest.c | 9 ++++++---
4 files changed, 31 insertions(+), 18 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2d05b4a93b..bbc85e75f0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5871,14 +5871,6 @@ qemuBuildRNGDevStr(const virDomainDef *def,
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- if (dev->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("this qemu doesn't support RNG device type '%s'"),
- virDomainRNGModelTypeToString(dev->model));
- goto error;
- }
-
if (!qemuDomainCheckCCWS390AddressSupport(def, dev->info, qemuCaps,
dev->source.file))
goto error;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a0ab55d5db..27cdb30ca2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4536,12 +4536,31 @@ qemuDomainSmartcardDefValidate(const virDomainSmartcardDef *def)
static int
-qemuDomainRNGDefValidate(const virDomainRNGDef *def)
+qemuDomainRNGDefValidate(const virDomainRNGDef *def,
+ virQEMUCapsPtr qemuCaps)
{
+ bool model_supported = false;
+
if (def->backend == VIR_DOMAIN_RNG_BACKEND_EGD &&
qemuDomainChrSourceDefValidate(def->source.chardev) < 0)
return -1;
+ switch ((virDomainRNGModel) def->model) {
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO:
+ model_supported = virQEMUCapsGet(qemuCaps,
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
+ break;
+ case VIR_DOMAIN_RNG_MODEL_LAST:
+ break;
+ }
+
+ if (!model_supported) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("this qemu doesn't support RNG device type '%s'"),
+ virDomainRNGModelTypeToString(def->model));
+ return -1;
+ }
+
return 0;
}
@@ -6073,7 +6092,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
break;
case VIR_DOMAIN_DEVICE_RNG:
- ret = qemuDomainRNGDefValidate(dev->data.rng);
+ ret = qemuDomainRNGDefValidate(dev->data.rng, qemuCaps);
break;
case VIR_DOMAIN_DEVICE_REDIRDEV:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 1802c36b86..f2ae0804a8 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -364,8 +364,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
def->memballoon->info.type = type;
for (i = 0; i < def->nrngs; i++) {
- if (def->rngs[i]->model == VIR_DOMAIN_RNG_MODEL_VIRTIO &&
- def->rngs[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
+ /* All devices accepted by the qemu driver are virtio */
+ if (def->rngs[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
def->rngs[i]->info.type = type;
}
@@ -2276,10 +2276,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
goto error;
}
- /* VirtIO RNG */
+ /* rng. the qemu driver only accepts virtio rng devices */
for (i = 0; i < def->nrngs; i++) {
- if (def->rngs[i]->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
- !virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
+ if (!virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
continue;
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info) < 0)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 82e2c0ee0f..b2c0c8505d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -585,8 +585,10 @@ mymain(void)
DO_TEST("disk-serial", NONE);
- DO_TEST("virtio-rng-random", NONE);
- DO_TEST("virtio-rng-egd", NONE);
+ DO_TEST("virtio-rng-random",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
+ DO_TEST("virtio-rng-egd",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
DO_TEST("pseries-nvram",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
@@ -1019,7 +1021,8 @@ mymain(void)
DO_TEST("disk-backing-chains-index", NONE);
DO_TEST("disk-backing-chains-noindex", NONE);
- DO_TEST("chardev-label", NONE);
+ DO_TEST("chardev-label",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
DO_TEST("cpu-numa1", NONE);
DO_TEST("cpu-numa2", NONE);
From patchwork Wed Jan 23 21:32:33 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156403
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201557jaa;
Wed, 23 Jan 2019 13:33:37 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7/j9/upf9TMTTW4n7fcZcQcg/4WcXYDrELitz1/TOdaOdbVYVTJMRYYFhog/wUWZ5AgFqt
X-Received: by 2002:ae9:c106:: with SMTP id z6mr3335384qki.197.1548279217329;
Wed, 23 Jan 2019 13:33:37 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279217; cv=none;
d=google.com; s=arc-20160816;
b=H2n+k2Pi8bu0pcv65kYG50SOYLXnIebKJ/JhI5dCCwAqu62jUrNFCnJCBao5bLA75j
XKqtZZ24uXXCbFr+gtO1hNv1ZGLXkvhsZBmz6/1dPT1vc4WAAjLfCYkbFvL2vIopZi5F
gHc5u/pjEDvJvWW0RunpUytSJv7fqA//Dt973f8732IgHKtaJeW0Bre/kWzyZJabOahc
8dOJhNPNNByExbWKUZNfnxAiqOVrTSJ6eVZNopEFON7vJhU21DZXbWYKKDEC3aTmeaB4
DwowD/UPK+iOPtARKA/BOS25VqvkmT4+bzGOPmsO2dZZSO1zqS5Psn8LKjgR5BJOiCmO
dqYA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=F8Xf77iFqbysLyWw277x9CKI46DMmdYyGbTl1T7Vwdg=;
b=ZX3QTWMlPTSrBdDZBQeNNcE0KQIMmxU684RPPBLaFughT+a06l+HxTYNmv+QoqBMmS
kBAECd6jz3eoVp0unZMC/3ENtUnk8MufXKCzN6y46qwFTEhfKb29eGYU/Qq9VBnrjtIn
ZuZBMiuNT6dOZDMptU5dD2rAT+xvAbVF54CNl64PYx52kz8HtwBBVM0WT1KyFExcv2fZ
3fxjwcZ/7i8Oe1x7ymT0KdzddhE+XW8+ovq+i4m3LSqRBEX4J+66tFnNV37qSbkQHUmI
g+Mm8/dHV8rCt77qOLPX3Y+Qzu0aLblhrYt7n0FbGQiBTFhmDneQO9+TTbWcVGAq5nep
tT2Q==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
d197si3301622qkb.84.2019.01.23.13.33.37
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:37 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 023532CD814;
Wed, 23 Jan 2019 21:33:36 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id C43EF1048104;
Wed, 23 Jan 2019 21:33:35 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7769D18033A1;
Wed, 23 Jan 2019 21:33:35 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXJD7032282 for ;
Wed, 23 Jan 2019 16:33:19 -0500
Received: by smtp.corp.redhat.com (Postfix)
id EC9AEBA8B; Wed, 23 Jan 2019 21:33:19 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 20C5CBA50;
Wed, 23 Jan 2019 21:33:19 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:33 -0500
Message-Id: <31eaef0e389c7a33846a473fcf6b0676961b530a.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 05/25] qemu: command: Make vhost-scsi device
string depend on address
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.29]);
Wed, 23 Jan 2019 21:33:36 +0000 (UTC)
The vhost-scsi device string should depend on the requested
address type, not strictly on the emulated arch. This is the
same logic used by qemuBuildVirtioDevStr, and this particular
path is already tested in the hostdev-scsi-vhost-scsi-ccw tests
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bbc85e75f0..a1d991cefc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4925,7 +4925,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
goto cleanup;
}
- if (ARCH_IS_S390(def->os.arch))
+ if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
virBufferAddLit(&buf, "vhost-scsi-ccw");
else
virBufferAddLit(&buf, "vhost-scsi-pci");
From patchwork Wed Jan 23 21:32:34 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156404
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201638jaa;
Wed, 23 Jan 2019 13:33:42 -0800 (PST)
X-Google-Smtp-Source: ALg8bN6gzfsjUKziJH2orN/VJFlDbuITVsDJ1nPa54c182XE1fpvuGrf/PNB2CqfBNMzNJK3zN2g
X-Received: by 2002:ac8:548a:: with SMTP id h10mr4250764qtq.15.1548279222330;
Wed, 23 Jan 2019 13:33:42 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279222; cv=none;
d=google.com; s=arc-20160816;
b=bXulo9+Bfv7StdlKI1nMJwSrL/LbimaJ+CYHvG3B+IqO+jK3tvE5+l61CebPXR9NY+
QkENhGXD53rTwJ2Dy3MQyHV+pPl3C/dUERQXRzpnaCuAS5B6UA/F2bhGqdJhWXoIE0Ex
Pnk2AObGQh/CtkmJ0aZF6sdRl6hAUOlnIfyaIYNPulX11BSPasEYXsgPqiYDR2IPkT+2
NcFONY1P4yI9y/Rb4ItUi5Y2WkNAF9u5kGuJxOhufkrAhkGW9SoNOkVjZkBxx8bBWOdz
oz6X0TdCfHG/gJLwogZTl3NgFs5O6jcRfK7VoNguoKlx/86c6y/sVfUyjwBve1IDsSuc
rrng==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=NCIsm0cmkwO5I9DF5MnqhQzaJLxn91RkRyb8bOdEYhk=;
b=aODfzIvOtx8zXhXP83ejNWS1sPyPoJxuS8B+VtcKh1wTJms5GdY+Tm0PJ61ad8DmRo
xE1ZmN8Tb+OUFBzDPvUp5Ov4kM/iBQiqoPuyOAVPlUjJ+kUpWLuKdTP6iayzySHjobf8
MBK9OQ1jtw5FbIkNITfPR8FgF+UBqxlezC2rVUrdCqlc4L51Yj2hakME4czMCO0nG4rc
LDuiLTw6E8fYjF0D12eXY21yAICia4M9HNY0qvKUS2qXymHa309ZfHi1/5ClL7DVS8i5
bMGzpk/iizPl0Z5eMU4+JuMxzIQFgKBZBicN5iNXkcBEm+2Y+HSbAECzUFAF5w0nMIgx
obtw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
u37si4514926qtu.230.2019.01.23.13.33.42
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:42 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id CCB9719F34;
Wed, 23 Jan 2019 21:33:39 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 9380CBA96;
Wed, 23 Jan 2019 21:33:39 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 30BF73F608;
Wed, 23 Jan 2019 21:33:39 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXLMX032289 for ;
Wed, 23 Jan 2019 16:33:21 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 321F2BA6D; Wed, 23 Jan 2019 21:33:21 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 55FD2BA50;
Wed, 23 Jan 2019 21:33:20 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:34 -0500
Message-Id: <066d7b1e62cd29e74604d00c8a5940bec53e84db.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 06/25] qemu: command: Convert vhost-{vsock,
scsi} to qemuBuildVirtioDevStr
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:33:41 +0000 (UTC)
Current code essentially duplicates the same logic, but misses
some cases (like vhost-vsock-device).
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a1d991cefc..2dde4b9125 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4925,10 +4925,8 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
goto cleanup;
}
- if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
- virBufferAddLit(&buf, "vhost-scsi-ccw");
- else
- virBufferAddLit(&buf, "vhost-scsi-pci");
+ if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0)
+ goto cleanup;
virBufferAsprintf(&buf, ",wwpn=%s,vhostfd=%s,id=%s",
hostsrc->wwpn,
@@ -10347,11 +10345,9 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *ret = NULL;
- if (vsock->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
- virBufferAddLit(&buf, "vhost-vsock-ccw");
- } else {
- virBufferAddLit(&buf, "vhost-vsock-pci");
- }
+
+ if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0)
+ goto cleanup;
virBufferAsprintf(&buf, ",id=%s", vsock->info.alias);
virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid);
From patchwork Wed Jan 23 21:32:35 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156398
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201402jaa;
Wed, 23 Jan 2019 13:33:28 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5ghTDb4nai6EuURWrq7KRWeDDYhHd4UjkCDbeQ7PpTGYjPnzLWJS9O+6FSvGZgcGNrgNhT
X-Received: by 2002:aed:3442:: with SMTP id w60mr4212064qtd.339.1548279208287;
Wed, 23 Jan 2019 13:33:28 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279208; cv=none;
d=google.com; s=arc-20160816;
b=zotCyzm1NMy6yQOcCKevDLIRT+dQjLXKf3xrCYx9rfk97sw6FcRkM3TeAg7tZrXfGi
0Oy+l1FJOaOnW/Wo3m5YZ9L9D9xmMpg37fOsaJ1NvoOg+XEi8D0k0ImECXP1ejjFpeGb
1kI9fGNrntSme/OtlQlolfTL3GYx6bc8QzNh8evDFLcjA/bgQaLNzxPS3d7le5OUKAvk
khjLkSnkiI0szvh+zqXignmVu3GsG8B8RFjkshFU/8+kNax8Hy3tgdO9ZbW0Aa63eA1J
tMJIi1O5fvUEoFWwlSNq6C0xGSJQMKpvyWEFw5x7TOGoy33ZEowYxDqNi/IKg0Xh2SU8
LUPw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=2Bp5dSwt7GkJEeahEaRZ0in44Dc+ZPI36g77s3EZ02M=;
b=hCOKHywyKo6JjXhUtHdQoqdFrYcR7/ep/fY/PqXCDjLOeNpNeZ7aVouEYCRkYAB1wY
MFwU4qsj7vCrHWD6EMoFQtGKD/baudGgEVGKDZjmuLCvhjB5zQWkEkohBREbUwgt7Pjz
pf9IQY1wBQHBrvJg2X+JtJbMFCKGv1SO3ykhHfAZJK0G3X8AKVzW4KhM/hMs07V+Mh+7
L+L62XLyaVOc/qdfd48y5ir9htulIskItwzfGiM907QK6ustVmivkuTND81eJYZVVEMT
XbIVgq9Tr5rv5uf2oIU2o7kBxaTxRtk5VjiKXYLkwTZcenRWpEi058HXi+SmB9hLKz+4
0R1g==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
t5si5435030qvj.105.2019.01.23.13.33.28
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:28 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id CC18B80511;
Wed, 23 Jan 2019 21:33:26 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A8E458B2;
Wed, 23 Jan 2019 21:33:26 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5151C3F605;
Wed, 23 Jan 2019 21:33:26 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXMe0032297 for ;
Wed, 23 Jan 2019 16:33:22 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 68961BA8B; Wed, 23 Jan 2019 21:33:22 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 8E6D9BA50;
Wed, 23 Jan 2019 21:33:21 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:35 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 07/25] conf: Add virDomainDeviceSetData
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
This is essentially a wrapper for easily setting the variable
name in virDomainDeviceDef that matches its associated
VIR_DOMAIN_DEVICE_TYPE.
Signed-off-by: Cole Robinson
---
src/conf/domain_conf.c | 93 ++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 3 ++
src/libvirt_private.syms | 1 +
3 files changed, 97 insertions(+)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bcdb6b0a3a..8af1a4ae73 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3702,6 +3702,99 @@ virDomainSkipBackcompatConsole(virDomainDefPtr def,
}
+/**
+ * virDomainDeviceSetData
+ * @device: virDomainDeviceDefPtr with ->type filled in
+ * @data: *DefPtr data for a device. Ex: virDomainDiskDefPtr
+ *
+ * Set the data.X variable for the device->type value. Basically
+ * a mapping of virDomainDeviceType to the associated name in
+ * the virDomainDeviceDef union
+ */
+void
+virDomainDeviceSetData(virDomainDeviceDefPtr device,
+ void *devicedata)
+{
+ switch ((virDomainDeviceType) device->type) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ device->data.disk = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_NET:
+ device->data.net = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_SOUND:
+ device->data.sound = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ device->data.hostdev = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_VIDEO:
+ device->data.video = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ device->data.controller = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
+ device->data.graphics = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_SMARTCARD:
+ device->data.smartcard = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_CHR:
+ device->data.chr = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_INPUT:
+ device->data.input = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_FS:
+ device->data.fs = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ device->data.watchdog = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ device->data.memballoon = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_RNG:
+ device->data.rng = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_NVRAM:
+ device->data.nvram = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_HUB:
+ device->data.hub = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_SHMEM:
+ device->data.shmem = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_TPM:
+ device->data.tpm = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_PANIC:
+ device->data.panic = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ device->data.memory = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
+ device->data.redirdev = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ device->data.vsock = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_IOMMU:
+ device->data.iommu = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_LEASE:
+ device->data.lease = devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_NONE:
+ case VIR_DOMAIN_DEVICE_LAST:
+ break;
+ }
+}
+
+
enum {
DOMAIN_DEVICE_ITERATE_ALL_CONSOLES = 1 << 0,
DOMAIN_DEVICE_ITERATE_GRAPHICS = 1 << 1
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 218aa4dd94..536b02ad3d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2937,6 +2937,9 @@ virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device);
void virDomainTPMDefFree(virDomainTPMDefPtr def);
+void virDomainDeviceSetData(virDomainDeviceDefPtr device,
+ void *devicedata);
+
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
virDomainDeviceInfoPtr info,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6f4809a68a..89b8ca3b4f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -307,6 +307,7 @@ virDomainDeviceDefParse;
virDomainDeviceFindSCSIController;
virDomainDeviceGetInfo;
virDomainDeviceInfoIterate;
+virDomainDeviceSetData;
virDomainDeviceTypeToString;
virDomainDeviceValidateAliasForHotplug;
virDomainDiskBusTypeToString;
From patchwork Wed Jan 23 21:32:36 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156405
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201706jaa;
Wed, 23 Jan 2019 13:33:46 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7L1Q+37kM1f6YJL45K2cMjhGeAXgYSCZGz4yvBAzc+7oCMIVPv2ZjEf1Yn7/pgBWxQ6aIj
X-Received: by 2002:ac8:34cb:: with SMTP id x11mr4137756qtb.115.1548279226662;
Wed, 23 Jan 2019 13:33:46 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279226; cv=none;
d=google.com; s=arc-20160816;
b=GL9YtWxf7qV8vXi1J8xpkeUaQ1TLYGyofauJhKismIxi6ze7v194h1xjPMU31HTARU
1it53Wakn8w/daXlc7SdvXsMXK+9hSuL6yrZnGX+6oD+zVhM2fvfnKl2k4RDsSemOcOt
daYsKlCyh0OAbYO7jAFw1iqqcm/IxWUJcXors5iJ5LvBpopexUDYenddSE1c0PpknQMu
zZHPpTr9zEPuXb3g+mDDYRn0zD6KdlDq17S9cpgB/+aWo0bHjW1mj9rEQB0NpSRhBsw2
KnNlynoW+GOCHoMbzVaNcLytYkPRZVjlKAGDlPeAxemDY5ugCVwFqEM/kgIra9P32gnA
fUUw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=WnDdKoAWWRKVdga5HlVjoJsy4X1v3aWEOAD1meFDVIo=;
b=akWWKnMW5mIlRocBI4h39vam1+bIBJBTVCs0zWc2l/MYzXwlwNtW6jn3UvAvFsd6kv
N+qs6V4vHrLOtDq4hlZI620wEvc9uAjHyimcl3FVHTUCsjKqof6hCWNPzOqxSlLtTizA
gdVsQ7m2kP/dbmMkukANQ+mGCZHfH/MxRwaPgsQxudgn7JFxsb4WxI/64pH9HCMdM7KC
ZTQx6za9MW+SN1rUDEL2ezBT93WbMjJTC4FkioJYFUuC9NbrZWFgr8c5BQW01FVRMD8D
OEpdqDgf5oSboYUStDytfDW9/j7X+V5h0Wa+dCK1VP1MCTOa9HmbjX9NC3+mUQAjkYDq
WRtA==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
w58si2995706qtb.24.2019.01.23.13.33.46
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:46 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 7850DC07F66B;
Wed, 23 Jan 2019 21:33:44 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 428E4BA9E;
Wed, 23 Jan 2019 21:33:44 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id F26C318033A8;
Wed, 23 Jan 2019 21:33:43 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXNOd032309 for ;
Wed, 23 Jan 2019 16:33:23 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 73368BA8D; Wed, 23 Jan 2019 21:33:23 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id C4E68BA50;
Wed, 23 Jan 2019 21:33:22 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:36 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 08/25] qemu: command: Make BuildVirtioDevStr
more generic
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.31]);
Wed, 23 Jan 2019 21:33:45 +0000 (UTC)
Switch qemuBuildVirtioDevStr to use virDomainDeviceSetData: callers
pass in the virDomainDeviceType and the void * DefPtr. This will
save us from having to repeatedly extend the function argument
list in subsequent patches.
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 82 ++++++++++++++++++++++++++++++++---------
1 file changed, 64 insertions(+), 18 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2dde4b9125..3a9e9def78 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -396,14 +396,34 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
}
+/**
+ * qemuBuildVirtioDevStr
+ * @buf: virBufferPtr to append the built string
+ * @baseName: qemu virtio device basename string. Ex: virtio-rng for
+ * @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE_RNG
+ * @devdata: *DefPtr of the device definition
+ *
+ * Build the qemu virtio -device name from the passed parameters. Currently
+ * this is mostly about attaching the correct string prefix to @baseName for
+ * the passed @type. So for @baseName "virtio-rng" and devdata->info.type
+ * VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, generate "virtio-rng-pci"
+ *
+ * Returns: -1 on failure, 0 on success
+ */
static int
qemuBuildVirtioDevStr(virBufferPtr buf,
const char *baseName,
- virDomainDeviceAddressType type)
+ virDomainDeviceType devtype,
+ void *devdata)
{
const char *implName = NULL;
+ virDomainDeviceDef device = { .type = devtype };
+ virDomainDeviceInfoPtr info;
- switch (type) {
+ virDomainDeviceSetData(&device, devdata);
+ info = virDomainDeviceGetInfo(&device);
+
+ switch (info->type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
implName = "pci";
break;
@@ -434,7 +454,7 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
default:
- virReportEnumRangeError(virDomainDeviceAddressType, type);
+ virReportEnumRangeError(virDomainDeviceAddressType, info->type);
return -1;
}
@@ -443,7 +463,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
return 0;
}
-
static int
qemuBuildVirtioOptionsStr(virBufferPtr buf,
virDomainVirtioOptionsPtr virtio,
@@ -2050,8 +2069,10 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
break;
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- if (qemuBuildVirtioDevStr(&opt, "virtio-blk", disk->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&opt, "virtio-blk",
+ VIR_DOMAIN_DEVICE_DISK, disk) < 0) {
goto error;
+ }
if (disk->iothread)
virBufferAsprintf(&opt, ",iothread=iothread%u", disk->iothread);
@@ -2639,8 +2660,10 @@ qemuBuildFSDevStr(const virDomainDef *def,
goto error;
}
- if (qemuBuildVirtioDevStr(&opt, "virtio-9p", fs->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&opt, "virtio-9p",
+ VIR_DOMAIN_DEVICE_FS, fs) < 0) {
goto error;
+ }
virBufferAsprintf(&opt, ",id=%s", fs->info.alias);
virBufferAsprintf(&opt, ",fsdev=%s%s",
@@ -2845,8 +2868,10 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
switch ((virDomainControllerModelSCSI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
- if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", def->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-scsi",
+ VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
goto error;
+ }
if (def->iothread) {
virBufferAsprintf(&buf, ",iothread=iothread%u",
@@ -2886,8 +2911,10 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
break;
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
- if (qemuBuildVirtioDevStr(&buf, "virtio-serial", def->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-serial",
+ VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
goto error;
+ }
virBufferAsprintf(&buf, ",id=%s", def->info.alias);
if (def->opts.vioserial.ports != -1) {
@@ -3655,8 +3682,10 @@ qemuBuildNicDevStr(virDomainDefPtr def,
char macaddr[VIR_MAC_STRING_BUFLEN];
if (virDomainNetIsVirtioModel(net)) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-net",
+ VIR_DOMAIN_DEVICE_NET, net) < 0) {
goto error;
+ }
usingVirtio = true;
} else {
@@ -4050,7 +4079,8 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
return 0;
if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
- def->memballoon->info.type) < 0) {
+ VIR_DOMAIN_DEVICE_MEMBALLOON,
+ def->memballoon) < 0) {
goto error;
}
@@ -4148,20 +4178,28 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
switch ((virDomainInputType)dev->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
- if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", dev->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-mouse",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_TABLET:
- if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", dev->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-tablet",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_KBD:
- if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", dev->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
- if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", dev->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-input-host",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_LAST:
default:
@@ -4479,8 +4517,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
}
if (STREQ(model, "virtio-gpu")) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", video->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-gpu",
+ VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
goto error;
+ }
} else {
virBufferAsprintf(&buf, "%s", model);
}
@@ -4925,8 +4965,10 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
goto cleanup;
}
- if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "vhost-scsi",
+ VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) {
goto cleanup;
+ }
virBufferAsprintf(&buf, ",wwpn=%s,vhostfd=%s,id=%s",
hostsrc->wwpn,
@@ -5873,8 +5915,10 @@ qemuBuildRNGDevStr(const virDomainDef *def,
dev->source.file))
goto error;
- if (qemuBuildVirtioDevStr(&buf, "virtio-rng", dev->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-rng",
+ VIR_DOMAIN_DEVICE_RNG, dev) < 0) {
goto error;
+ }
virBufferAsprintf(&buf, ",rng=obj%s,id=%s",
dev->info.alias, dev->info.alias);
@@ -10346,8 +10390,10 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
char *ret = NULL;
- if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "vhost-vsock",
+ VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) {
goto cleanup;
+ }
virBufferAsprintf(&buf, ",id=%s", vsock->info.alias);
virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid);
From patchwork Wed Jan 23 21:32:37 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156406
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201771jaa;
Wed, 23 Jan 2019 13:33:50 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5bHONBEFPiLcVbierzJ/FPxkuPfrDxOd/jErc1KWeFbpTOozZa6u676nwPffTH2XbyBJL4
X-Received: by 2002:ac8:28d2:: with SMTP id j18mr4087829qtj.191.1548279230569;
Wed, 23 Jan 2019 13:33:50 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279230; cv=none;
d=google.com; s=arc-20160816;
b=i7NRJFMiVdGeZqQH4KzIbhlwr3AsT1RTkdM3sBStWSgLmq2kn6Kb0Jxij3I0aiD5qu
aoYOUO+HcYQtmjTfmYzV4DXFG26d7KPOgjmNVqdgGDmWM5/s8heJaUSsKML2GNUuAt1N
XGKhqDqOPo3VD7leadDnJpOssLfX8tA90JZLVr8GgBHGiOZona5jQW38q/ESQc7bDcUf
7GWH7fgzyc8A+LHmEJNOXvvcQJseMfGCEJ0dCDbxMxu5mmuopNekZHMVJeLg3P9oyvXJ
jbfr8g2EFd50otV0rqOJXYUCI1laFgh1Stf9Jf7ZgD14sa6ic6an70We7u3qlQZ5AWFf
+G6g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=z3ocsB6q8W6aofWnZDgv8+ygDwfDYEZbdUxeAIWj6Z0=;
b=Zpl4N79c+VZs84e4YcaUjR8q7++CZxXiwjJtVE1mNxOWGCVR5pnUHKDKCPO806NW/O
aWMachPAdWBGxMeh/coKD+/oswtEuYRuXaPetdpbHfqZ5AYpdi4WyQ92WbaO2MmmTIf3
HEyp9Wev6oPgbsybfkH7dFuOHSE0ZhWS6l3lY0EjMEUTmD5sbSrQB7Hh/XXV8W7Bfja7
WBn2aceBbbF3pbOLhZOcTT4fPkc/eXDCyVXKevniR1SErVxqnKrbwzwLcOw4Ua+nd30g
HOoYXEdvWOtS7ko7GRtloyJ6Vg4ere4iBQBGeewNcvCx44hwO6kY38ODh40mhq0RH64D
rC+w==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
j13si7402416qti.103.2019.01.23.13.33.50
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:50 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id BF5097F3FA;
Wed, 23 Jan 2019 21:33:48 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E4EC5D75F;
Wed, 23 Jan 2019 21:33:48 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 262AF3F60C;
Wed, 23 Jan 2019 21:33:48 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXOH7032319 for ;
Wed, 23 Jan 2019 16:33:24 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8C318BA8D; Wed, 23 Jan 2019 21:33:24 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B7A7A65F72;
Wed, 23 Jan 2019 21:33:23 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:37 -0500
Message-Id: <4a44cafbddd520ecb3214afc1b334546de2d8441.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 09/25] qemu: command: Add qemuCaps to
BuildVirtioStr
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.25]);
Wed, 23 Jan 2019 21:33:49 +0000 (UTC)
It will be used in future patches
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3a9e9def78..659274f25a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -400,6 +400,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
* qemuBuildVirtioDevStr
* @buf: virBufferPtr to append the built string
* @baseName: qemu virtio device basename string. Ex: virtio-rng for
+ * @qemuCaps: virQEMUCapPtr
* @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE_RNG
* @devdata: *DefPtr of the device definition
*
@@ -413,6 +414,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
static int
qemuBuildVirtioDevStr(virBufferPtr buf,
const char *baseName,
+ virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
virDomainDeviceType devtype,
void *devdata)
{
@@ -2069,7 +2071,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
break;
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- if (qemuBuildVirtioDevStr(&opt, "virtio-blk",
+ if (qemuBuildVirtioDevStr(&opt, "virtio-blk", qemuCaps,
VIR_DOMAIN_DEVICE_DISK, disk) < 0) {
goto error;
}
@@ -2660,7 +2662,7 @@ qemuBuildFSDevStr(const virDomainDef *def,
goto error;
}
- if (qemuBuildVirtioDevStr(&opt, "virtio-9p",
+ if (qemuBuildVirtioDevStr(&opt, "virtio-9p", qemuCaps,
VIR_DOMAIN_DEVICE_FS, fs) < 0) {
goto error;
}
@@ -2868,7 +2870,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
switch ((virDomainControllerModelSCSI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
- if (qemuBuildVirtioDevStr(&buf, "virtio-scsi",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", qemuCaps,
VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
goto error;
}
@@ -2911,7 +2913,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
break;
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
- if (qemuBuildVirtioDevStr(&buf, "virtio-serial",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-serial", qemuCaps,
VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
goto error;
}
@@ -3682,7 +3684,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
char macaddr[VIR_MAC_STRING_BUFLEN];
if (virDomainNetIsVirtioModel(net)) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-net",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-net", qemuCaps,
VIR_DOMAIN_DEVICE_NET, net) < 0) {
goto error;
}
@@ -4078,7 +4080,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
if (!virDomainDefHasMemballoon(def))
return 0;
- if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-balloon", qemuCaps,
VIR_DOMAIN_DEVICE_MEMBALLOON,
def->memballoon) < 0) {
goto error;
@@ -4178,25 +4180,25 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
switch ((virDomainInputType)dev->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
- if (qemuBuildVirtioDevStr(&buf, "virtio-mouse",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
break;
case VIR_DOMAIN_INPUT_TYPE_TABLET:
- if (qemuBuildVirtioDevStr(&buf, "virtio-tablet",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
break;
case VIR_DOMAIN_INPUT_TYPE_KBD:
- if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
- if (qemuBuildVirtioDevStr(&buf, "virtio-input-host",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
@@ -4517,7 +4519,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
}
if (STREQ(model, "virtio-gpu")) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-gpu",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", qemuCaps,
VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
goto error;
}
@@ -4965,7 +4967,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
goto cleanup;
}
- if (qemuBuildVirtioDevStr(&buf, "vhost-scsi",
+ if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", qemuCaps,
VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) {
goto cleanup;
}
@@ -5915,7 +5917,7 @@ qemuBuildRNGDevStr(const virDomainDef *def,
dev->source.file))
goto error;
- if (qemuBuildVirtioDevStr(&buf, "virtio-rng",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-rng", qemuCaps,
VIR_DOMAIN_DEVICE_RNG, dev) < 0) {
goto error;
}
@@ -10390,7 +10392,7 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
char *ret = NULL;
- if (qemuBuildVirtioDevStr(&buf, "vhost-vsock",
+ if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", qemuCaps,
VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) {
goto cleanup;
}
From patchwork Wed Jan 23 21:32:38 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156407
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201839jaa;
Wed, 23 Jan 2019 13:33:54 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4vVuulVhOKYNvNhN9M6/TRf9o/HBq41myF52cF2y9/6+eyo5T5ovkyOTMPhIEOEZmqzrjD
X-Received: by 2002:aed:24b7:: with SMTP id t52mr4230286qtc.131.1548279234684;
Wed, 23 Jan 2019 13:33:54 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279234; cv=none;
d=google.com; s=arc-20160816;
b=XXZyD9Lmu1mmiKffFMrw0zvBGYS/YLHacsGNFDZ5cKDh7QFBg20/CnD1MxScYSRx9w
rWmxS4ZFiNCQ3adl5BNXhdptJPh9JWEY+zNMBv35lV95/ZTBiprc0Cq+0UfvwhaQtCnD
3WVpp+BQ8lXiCtnj5MJeX6dxgKpHTZUX4wiaj7Nrn2htlrvUX6e0eSb5zBsAj1928T/s
RTw+3Rvih3BbOocaYNU7T4IGzNxs3r3rluwiC/a1LJvz3oP28JCP0D5rXZvDh1IXV0p8
AzL3SjRx8kE5WNYlY8GzFlHQqE/jcq21RBWLyh1a+qdXW0/piD6MEmsG6ycv1F6AAAtS
yH1Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=X3aKp2KcE8iFuD9p8RbA1udRgsQwXaKhLK+oeM1OFA4=;
b=WNCewC4YTclmgF3BKzbSN7LtHFI6rPluwiYjbJn/MPKC1g8FemZQqIFF9Xzpu/gALb
htRGNMhTh9JwDjFck0pkFvd9RV7/+C6BAATbXdCWGP6IebOnjOkKIoExD6moWkmSEicU
aMB3yi1rZF92Ex0WKmZ/Qa8VOYBs/LXrTGYWTznxFx6lCZskIBxNNmyO7QLaAy7JWrRr
yWlJ0IDJ/M06meORmLH+3qp7gsbn7mKcyAf5VFFZ7BKfP5cGK3ihBnCiYfWlVyqk/BQ2
Q0O+phBIT4A7pBeRxetPvHhuwPIBc4C/GBjZni8Zn+RI5J7cOpqIB2afK3PgHy9B72Bm
irlg==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id a6si3577331qtn.52.2019.01.23.13.33.54
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:54 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id F3C9987645;
Wed, 23 Jan 2019 21:33:52 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id B18C46BF7B;
Wed, 23 Jan 2019 21:33:52 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5F6313F60D;
Wed, 23 Jan 2019 21:33:52 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXPmw032324 for ;
Wed, 23 Jan 2019 16:33:25 -0500
Received: by smtp.corp.redhat.com (Postfix)
id C70A5BA6D; Wed, 23 Jan 2019 21:33:25 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id EBD4EBA50;
Wed, 23 Jan 2019 21:33:24 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:38 -0500
Message-Id: <4410eb25e13925ff94a0a71cd9de86971bf2dc1e.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 10/25] qemu: capabilities: Add virtio/vhost
{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.26]);
Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
This adds QEMU_CAPS flags for the following devices
virtio-blk-pci-transitional
virtio-blk-pci-non-transitional
virtio-net-pci-transitional
virtio-net-pci-non-transitional
vhost-scsi-pci-transitional
vhost-scsi-pci-non-transitional
virtio-rng-pci-transitional
virtio-rng-pci-non-transitional
virtio-9p-pci-transitional
virtio-9p-pci-non-transitional
virtio-balloon-pci-transitional
virtio-balloon-pci-non-transitional
vhost-vsock-pci-transitional
vhost-vsock-pci-non-transitional
virtio-input-host-pci-transitional
virtio-input-host-pci-non-transitional
virtio-scsi-pci-transitional
virtio-scsi-pci-non-transitional
virtio-serial-pci-transitional
virtio-serial-pci-non-transitional
Signed-off-by: Cole Robinson
---
src/qemu/qemu_capabilities.c | 48 +++++++++++++++++++
src/qemu/qemu_capabilities.h | 28 +++++++++++
.../caps_4.0.0.x86_64.xml | 20 ++++++++
3 files changed, 96 insertions(+)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f504db7d05..ee471787d9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -520,6 +520,34 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
/* 325 */
"memory-backend-file.pmem",
"nvdimm.unarmed",
+ "virtio-blk-pci-transitional",
+ "virtio-blk-pci-non-transitional",
+ "virtio-net-pci-transitional",
+
+ /* 330 */
+ "virtio-net-pci-non-transitional",
+ "vhost-scsi-pci-transitional",
+ "vhost-scsi-pci-non-transitional",
+ "virtio-rng-pci-transitional",
+ "virtio-rng-pci-non-transitional",
+
+ /* 335 */
+ "virtio-9p-pci-transitional",
+ "virtio-9p-pci-non-transitional",
+ "virtio-balloon-pci-transitional",
+ "virtio-balloon-pci-non-transitional",
+ "vhost-vsock-pci-transitional",
+
+ /* 340 */
+ "vhost-vsock-pci-non-transitional",
+ "virtio-input-host-pci-transitional",
+ "virtio-input-host-pci-non-transitional",
+ "virtio-scsi-pci-transitional",
+ "virtio-scsi-pci-non-transitional",
+
+ /* 345 */
+ "virtio-serial-pci-transitional",
+ "virtio-serial-pci-non-transitional",
);
@@ -1108,6 +1136,26 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "vfio-ap", QEMU_CAPS_DEVICE_VFIO_AP },
{ "zpci", QEMU_CAPS_DEVICE_ZPCI },
{ "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD },
+ { "virtio-blk-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL },
+ { "virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL },
+ { "virtio-net-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL },
+ { "virtio-net-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL },
+ { "vhost-scsi-pci-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL },
+ { "vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL },
+ { "virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL },
+ { "virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL },
+ { "virtio-9p-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSITIONAL },
+ { "virtio-9p-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL },
+ { "virtio-balloon-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_TRANSITIONAL },
+ { "virtio-balloon-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL },
+ { "vhost-vsock-pci-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRANSITIONAL },
+ { "vhost-vsock-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL },
+ { "virtio-input-host-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL },
+ { "virtio-input-host-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL },
+ { "virtio-scsi-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRANSITIONAL },
+ { "virtio-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_NON_TRANSITIONAL },
+ { "virtio-serial-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL },
+ { "virtio-serial-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL },
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 6d5ed8a3cc..cff3506355 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -504,6 +504,34 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 325 */
QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM, /* -object memory-backend-file,pmem= */
QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */
+ QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL, /* -device virtio-blk-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL, /* -device virtio-blk-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL, /* -device virtio-net-pci-transitional */
+
+ /* 330 */
+ QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL, /* -device virtio-net-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL, /* -device vhost-scsi-pci-transitional */
+ QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL, /* -device vhost-scsi-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL, /* -device virtio-blk-rng-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL, /* -device virtio-rng-pci-non-transitional */
+
+ /* 335 */
+ QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSITIONAL, /* -device virtio-9p-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL, /* -device virtio-9p-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_TRANSITIONAL, /* -device virtio-balloon-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL, /* -device virtio-balloon-pci-transitional */
+ QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRANSITIONAL, /* -device vhost-vsock-pci-transitional */
+
+ /* 340 */
+ QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL, /* -device vhost-vsock-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL, /* -device virtio-input-host-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL, /* -device virtio-input-host-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRANSITIONAL, /* -device virtio-scsi-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_NON_TRANSITIONAL, /* -device virtio-scsi-pci-non-transitional */
+
+ /* 345 */
+ QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL, /* -device virtio-serial-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL, /* -device virtio-serial-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index c2db392e83..aaf7d404eb 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -212,6 +212,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 30010500446361
From patchwork Wed Jan 23 21:32:39 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156402
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201519jaa;
Wed, 23 Jan 2019 13:33:35 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4dSqzYzIFKavz+EDGpYnAr/PrwxqxLamxdJfcNMCM3BbIqptyyBr6VXF/x3MSmAOqpstx+
X-Received: by 2002:aed:384a:: with SMTP id j68mr4112666qte.171.1548279215288;
Wed, 23 Jan 2019 13:33:35 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279215; cv=none;
d=google.com; s=arc-20160816;
b=H+feObUtzk3060bQzgun/WEB9Nid6mQE+W5Da8mGBwaJ7U4pIU0dD5+xVE11K3uJKc
aSEIUDfFSrMwf4b8XY7tjS+qKAaNDSPo7jB8Z1Kub2Ky4GUm+oJxSlKCKCAsyBPXGUK9
EJoXkXQTEbLYVE6xT7O72nMvwkv3lsO6yzWUl+3Zt4GgMSLAumnxriTUAoSa8hlgELq0
0oGVHa3fQQs+z17zY7dzkkf6NPssONGbNbn5aFizxQK5gysEIM3NdmXc3ipa/8EdVQH7
5tGmc91VTkbDnpzkd9LOYtDo/S++bVqhxEKaNbt5Smn2VPCkrTqPAK+bMhatzAgjXH5q
pOAQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:cc:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=uk4ybrKQDXf0u3p1wNiHaZdTr9fu7IrQqgBlJKkVN3s=;
b=cVsZuyPtequd9hfwxM64gwk9hBYo64j5l8MD4GAjTJH8ywAMDLcG83kYZ0lVtnPwF3
6B3Mge5GoMnUwZnpZ2xvt7G8LnxEl3RtmsBWDZckrCzVhzaJMhUiXS+Pfnwax8XY8jPH
GsOmTqgoXkpbqjA8SSknQxXWnbXxphOsMKoMjFy8fCyr8+KiaKdOnJiWXOukl0Jp/fOv
OlDCXxB5FPhietzYuOq/btmo9DcgJgqAtk38555kXfTSa1G7PCGO9h5uKxkYKzWYxpHf
ptGmxg3tl/ezmpMCocY1f28kPMeHYvWAINZPD6fuSYYCPGRHOQEiyuAwbsdJZ2ue5Rzp
DHlA==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
z3si4162749qtj.337.2019.01.23.13.33.35
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:35 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 00DA2AD896;
Wed, 23 Jan 2019 21:33:32 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id A9FAB58824;
Wed, 23 Jan 2019 21:33:31 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5CBBC3F606;
Wed, 23 Jan 2019 21:33:31 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXRtY032340 for ;
Wed, 23 Jan 2019 16:33:27 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 6F787BA96; Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2D48EBA50;
Wed, 23 Jan 2019 21:33:25 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:39 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Cc: Andrea Bolognani
Subject: [libvirt] [PATCH v2 11/25] conf: Add
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.28]);
Wed, 23 Jan 2019 21:33:33 +0000 (UTC)
devices lack the model= attribute which is used by
most other device types. bus= mostly acts as one, but it
serves other purposes too like determing what target=
prefix to use, and for matching against controller type=
values.
Extending bus= to handle additional virtio transitional
devices will complicate apps lives, and it isn't a clean
mapping anyways. So let's bite the bullet and add a new
attribute, and wire up common handling
for virtio and virtio-{non-}transitional
Reviewed-by: Andrea Bolognani
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 10 +++++
docs/schemas/domaincommon.rng | 9 ++++
src/conf/domain_conf.c | 40 ++++++++++++++++++
src/conf/domain_conf.h | 11 +++++
src/libvirt_private.syms | 2 +
.../virtio-non-transitional.x86_64-3.1.0.args | 34 +++++++++++++++
...virtio-non-transitional.x86_64-latest.args | 34 +++++++++++++++
.../virtio-non-transitional.xml | 18 ++++++++
.../virtio-transitional.x86_64-3.1.0.args | 34 +++++++++++++++
.../virtio-transitional.x86_64-latest.args | 34 +++++++++++++++
.../qemuxml2argvdata/virtio-transitional.xml | 18 ++++++++
tests/qemuxml2argvtest.c | 6 +++
.../virtio-non-transitional.xml | 42 +++++++++++++++++++
.../virtio-transitional.xml | 42 +++++++++++++++++++
tests/qemuxml2xmltest.c | 11 +++++
15 files changed, 345 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.xml
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-non-transitional.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-transitional.xml
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7f07bb7f55..0f66b5a1fc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2922,6 +2922,16 @@
Since 0.1.4
+
model
+
+ Indicates the emulated device model of the disk. Typically
+ this is indicated solely by the bus property but
+ for bus "virtio" the model can be specified further
+ with "virtio-transitional", "virtio-non-transitional", or
+ "virtio" which matches the old behavior. These settings are
+ only applicable when using controller bus type "pci".
+ Since 5.1.0
+
rawio
Indicates whether the disk needs rawio capability. Valid
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index aa50eac424..7af6e2532b 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1506,6 +1506,15 @@
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8af1a4ae73..eeb1191677 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -889,6 +889,13 @@ VIR_ENUM_IMPL(virDomainDiskDetectZeroes, VIR_DOMAIN_DISK_DETECT_ZEROES_LAST,
"on",
"unmap")
+VIR_ENUM_IMPL(virDomainDiskModel, VIR_DOMAIN_DISK_MODEL_LAST,
+ "default",
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
+);
+
VIR_ENUM_IMPL(virDomainDiskMirrorState, VIR_DOMAIN_DISK_MIRROR_STATE_LAST,
"none",
"yes",
@@ -5525,6 +5532,17 @@ virDomainDiskDefValidate(const virDomainDiskDef *disk)
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;
+ }
+
return 0;
}
@@ -9612,6 +9630,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
VIR_FREE(tmp);
+ if ((tmp = virXMLPropString(node, "model")) &&
+ (def->model = virDomainDiskModelTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown disk model '%s'"), tmp);
+ goto error;
+ }
+ VIR_FREE(tmp);
+
snapshot = virXMLPropString(node, "snapshot");
rawio = virXMLPropString(node, "rawio");
@@ -21861,6 +21887,14 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
return false;
}
+ if (src->model != dst->model) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target disk model %s does not match source %s"),
+ virDomainDiskModelTypeToString(dst->model),
+ virDomainDiskModelTypeToString(src->model));
+ return false;
+ }
+
if (src->virtio && dst->virtio &&
!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
return false;
@@ -24426,6 +24460,12 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAsprintf(buf,
"model) {
+ virBufferAsprintf(buf, " model='%s'",
+ virDomainDiskModelTypeToString(def->model));
+ }
+
if (def->rawio) {
virBufferAsprintf(buf, " rawio='%s'",
virTristateBoolTypeToString(def->rawio));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 536b02ad3d..644dde3dd3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -567,6 +567,15 @@ typedef enum {
VIR_DOMAIN_DISK_DETECT_ZEROES_LAST
} virDomainDiskDetectZeroes;
+typedef enum {
+ VIR_DOMAIN_DISK_MODEL_DEFAULT = 0,
+ VIR_DOMAIN_DISK_MODEL_VIRTIO,
+ VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL,
+
+ VIR_DOMAIN_DISK_MODEL_LAST
+} virDomainDiskModel;
+
typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo;
struct _virDomainBlockIoTuneInfo {
unsigned long long total_bytes_sec;
@@ -674,6 +683,7 @@ struct _virDomainDiskDef {
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
char *domain_name; /* backend domain name */
unsigned int queues;
+ int model; /* enum virDomainDiskModel */
virDomainVirtioOptionsPtr virtio;
};
@@ -3417,6 +3427,7 @@ VIR_ENUM_DECL(virDomainDeviceSGIO)
VIR_ENUM_DECL(virDomainDiskTray)
VIR_ENUM_DECL(virDomainDiskDiscard)
VIR_ENUM_DECL(virDomainDiskDetectZeroes)
+VIR_ENUM_DECL(virDomainDiskModel)
VIR_ENUM_DECL(virDomainDiskMirrorState)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainControllerModelPCI)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 89b8ca3b4f..8d27d507cc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -344,6 +344,8 @@ virDomainDiskIoTypeFromString;
virDomainDiskIoTypeToString;
virDomainDiskMirrorStateTypeFromString;
virDomainDiskMirrorStateTypeToString;
+virDomainDiskModelTypeFromString;
+virDomainDiskModelTypeToString;
virDomainDiskPathByName;
virDomainDiskRemove;
virDomainDiskRemoveByName;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
new file mode 100644
index 0000000000..9e11e900da
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc-q35-3.1,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=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 \
+-no-acpi \
+-boot strict=on \
+-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
new file mode 100644
index 0000000000..070b4b8334
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine q35,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=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 \
+-no-acpi \
+-boot strict=on \
+-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
new file mode 100644
index 0000000000..7899994622
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -0,0 +1,18 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
new file mode 100644
index 0000000000..9e11e900da
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc-q35-3.1,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=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 \
+-no-acpi \
+-boot strict=on \
+-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
new file mode 100644
index 0000000000..070b4b8334
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine q35,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=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 \
+-no-acpi \
+-boot strict=on \
+-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
new file mode 100644
index 0000000000..678a7b9132
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -0,0 +1,18 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ba6fd4db35..4f7adf18f5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3073,6 +3073,12 @@ mymain(void)
DO_TEST("riscv64-virt",
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
+ /* Older version checks disable-legacy usage */
+ DO_TEST_CAPS_VER("virtio-transitional", "3.1.0");
+ DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0");
+ DO_TEST_CAPS_LATEST("virtio-transitional");
+ DO_TEST_CAPS_LATEST("virtio-non-transitional");
+
/* Simple headless guests for various architectures */
DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
new file mode 100644
index 0000000000..7e4aa16b32
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -0,0 +1,42 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
new file mode 100644
index 0000000000..1d28af9abb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -0,0 +1,42 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b2c0c8505d..a84f9241d6 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1268,6 +1268,17 @@ mymain(void)
DO_TEST("riscv64-virt",
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
+ DO_TEST("virtio-transitional",
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
+ DO_TEST("virtio-non-transitional",
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
From patchwork Wed Jan 23 21:32:40 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156409
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201894jaa;
Wed, 23 Jan 2019 13:33:58 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5r+5WdA8GsWn5I48hXK1myJc4mKGe4/fW/ixuVp8y0qfJaT5z9RVwB7uSOJQxn+07bD/JA
X-Received: by 2002:ac8:1add:: with SMTP id h29mr4115586qtk.258.1548279238600;
Wed, 23 Jan 2019 13:33:58 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279238; cv=none;
d=google.com; s=arc-20160816;
b=fuayaAXlCaKs0NNDIgbJd2qLqICfosqJD9mwTxJxQAezmkGqaTYme31decVrjFSR4v
p+/POIdKQnVhK3pl3QZjR1iuHud7WgPPQRZXBF4aDWZ/E597QrO264ExVspZPO0Vy7uX
iqZhdkiAJHZlRgUZQyNk9gJ+TLg24IaC3yhLU0l8YilxbqcpMRGtiLJpn+m205MYZsWK
WCxO6G89i+V8xotIYfsVVHA29+CbYSrVNechXC6QGm5YKZmTjyviLvkbTRRtakdo1uNd
K5KvmRumE89t+35zYpPjAWLMnO2G2MseFCGJOT63S8LkZ49yaBKXdKXetBF32+SGd7sA
v+fA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=H9acR3fNuhd9LyxyGDykS/hH7Juf+tUKRgJE0qrLLhg=;
b=J6vruy4g0o0KB2PNTj3NzhwWc9v0OZtjXOs70b4tgL2z07OPCExkXT6QAnwn1frFnx
wsMPE8X/He65yokcllX7Yw+Y5wPrqHteaFYa/IpK6oL9F9CtaTlUH7/s9CPVX8ZicpBw
MyuNh9fchXtxoECqGPIVtk/FYtomz0c52BShkiusaWSu/Q+9fa1eltmvb+1GCBvptpFv
9CayafIbMLA1ybQF1skfc66udv/54PxoVTvHJ+hf7j4dm8Hjl1GnPvn3gUoxsRPkm8dw
S0fXFgDs15Q+4CMy8BDAG/4mE+4mNZD4v8qhmJKfr9qgHQLJFXi3NlfcEpcPD8gxkHp5
JLrg==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
s127si1429935qkf.24.2019.01.23.13.33.58
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:58 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 0784B1451FD;
Wed, 23 Jan 2019 21:33:57 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id BBF711059592;
Wed, 23 Jan 2019 21:33:56 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6F8FC18033CA;
Wed, 23 Jan 2019 21:33:56 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXSXa032349 for ;
Wed, 23 Jan 2019 16:33:28 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8979CBA96; Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B0A0EBA50;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:40 -0500
Message-Id: <8a63a2f5e7d1a30d0cc8389790dfb1a799762aa2.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 12/25] qemu: Support disk
model=virtio-{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:33:57 +0000 (UTC)
Add new model values for virtio transitional devices. When
combined with bus='virtio':
* "virtio-transitional" maps to qemu "virtio-blk-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-blk-pci-non-transitional"
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 71 +++++++++++++++++++
src/qemu/qemu_domain_address.c | 3 +
.../virtio-non-transitional.x86_64-3.1.0.args | 4 +-
...virtio-non-transitional.x86_64-latest.args | 4 +-
.../virtio-transitional.x86_64-3.1.0.args | 5 +-
.../virtio-transitional.x86_64-latest.args | 7 +-
.../virtio-transitional.xml | 10 ++-
7 files changed, 92 insertions(+), 12 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 659274f25a..3cf0f5b13e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -421,6 +421,8 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
const char *implName = NULL;
virDomainDeviceDef device = { .type = devtype };
virDomainDeviceInfoPtr info;
+ int tmodel_cap, ntmodel_cap;
+ bool has_tmodel, has_ntmodel;
virDomainDeviceSetData(&device, devdata);
info = virDomainDeviceGetInfo(&device);
@@ -462,9 +464,78 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
virBufferAsprintf(buf, "%s-%s", baseName, implName);
+ switch (devtype) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ has_tmodel = device.data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = device.data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL;
+ break;
+
+ 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_VIDEO:
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
+ case VIR_DOMAIN_DEVICE_HUB:
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
+ case VIR_DOMAIN_DEVICE_NONE:
+ case VIR_DOMAIN_DEVICE_SMARTCARD:
+ case VIR_DOMAIN_DEVICE_CHR:
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
+ case VIR_DOMAIN_DEVICE_SHMEM:
+ case VIR_DOMAIN_DEVICE_TPM:
+ case VIR_DOMAIN_DEVICE_PANIC:
+ case VIR_DOMAIN_DEVICE_RNG:
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ case VIR_DOMAIN_DEVICE_LAST:
+ default:
+ return 0;
+ }
+
+ if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+ (has_tmodel || has_ntmodel)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("virtio (non-)transitional models are not "
+ "supported for address type=%s"),
+ virDomainDeviceAddressTypeToString(info->type));
+ return -1;
+ }
+
+ if (has_tmodel) {
+ if (virQEMUCapsGet(qemuCaps, tmodel_cap))
+ virBufferAddLit(buf, "-transitional");
+
+ /* No error for if -transitional is not supported: our address
+ * allocation will force the device into plain PCI bus, which
+ * is functionally identical to standard 'virtio-XXX' behavior
+ */
+ } else if (has_ntmodel) {
+ if (virQEMUCapsGet(qemuCaps, ntmodel_cap)) {
+ virBufferAddLit(buf, "-non-transitional");
+ } else if (virQEMUCapsGet(qemuCaps,
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
+ virBufferAddLit(buf, ",disable-legacy=on,disable-modern=off");
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio non-transitional model not supported "
+ "for this qemu"));
+ return -1;
+ }
+ }
+
return 0;
}
+
static int
qemuBuildVirtioOptionsStr(virBufferPtr buf,
virDomainVirtioOptionsPtr virtio,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index f2ae0804a8..808e551b9c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -720,6 +720,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_DISK:
switch ((virDomainDiskBus) dev->data.disk->bus) {
case VIR_DOMAIN_DISK_BUS_VIRTIO:
+ /* Transitional devices only work in conventional PCI slots */
+ if (dev->data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL)
+ return pciFlags;
return virtioFlags; /* only virtio disks use PCI */
case VIR_DOMAIN_DISK_BUS_IDE:
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 9e11e900da..70446f16f2 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -27,8 +27,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
-id=virtio-disk0,bootindex=1 \
+-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.1,\
+addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 070b4b8334..37078765bc 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -27,8 +27,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
-id=virtio-disk0,bootindex=1 \
+-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.1,addr=0x0,\
+drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 9e11e900da..356e8fdf4c 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -25,9 +25,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-boot strict=on \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \
--device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
+-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x1,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 070b4b8334..e78223eac8 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -25,10 +25,11 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-boot strict=on \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \
--device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
+-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\
-id=virtio-disk0,bootindex=1 \
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x1,\
+drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index 1d28af9abb..c19e133bb3 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -30,9 +30,13 @@
-
+
+
+
+
+
-
+
From patchwork Wed Jan 23 21:32:41 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156410
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201976jaa;
Wed, 23 Jan 2019 13:34:04 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7NGop79D4T5XJ4jHdA1/yQlAgJ8xD1UM0kcwo8zJeCfPbeWNGTG1cimUsfvbt6P+49yhng
X-Received: by 2002:a37:4350:: with SMTP id q77mr3319648qka.308.1548279244125;
Wed, 23 Jan 2019 13:34:04 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279244; cv=none;
d=google.com; s=arc-20160816;
b=Vc1Ixeq6pWgz999R/L3ZX99cy7DBwt/vUN2FJ4aye5ug3Fywm/uIYzSyYHQINi7SJ6
pWm2D/oP9oZr1bNmU1/ZWW+uLJAL88WGslhPSiMH+dhKC21/Uegx2TBC6kerKlGLTkZJ
btqbo6/EgH4dcFaJC3XOFoBIQF5q+i6YPhTlbTHhmhr+Ky8O5oEaZOrFuUrl6j0qDoER
OEsrzz7+Wq3sF5Ui10hxNdwY1Ad3bS9ABrKFyOZ3vbvp3ZUoQhxV04HIWL59u+C0ux4Y
bQ83krljk4xtPoHdwiwk5pyrzylX7cXrWSWHqIyfnKVSUDsWXsJcWLR7SraACHBR7gjO
LHFA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=4rLE4wInd1SkcH6rwnYQQR852Ch9Ffy/hBluDkjOO3U=;
b=AYilbUSz+k7ntnPL8w+k8D5i8o16M77iMlc86nv0r3dqSeTqmGs3RBPnMc/scfr5bZ
NQ4lJFr6NGj4H6AqUT+kSgBZkMTaWcsqR7WVGqd1TwF/dcYmZQMjzt9f2TeW4CC4EECG
VdXLXmgwGWBDglnmBbPe9cCLnigiEU5lLZsOp0BYyUTDeQMCP+hVu2CPBi1HxFHmmCBe
BUAxtgBnxE8BLujtbuXEOax6nTPoDzZdWCofbbOR8FYJMjzdUsb+3MdJIetB10rubSVQ
qem+fyQNe6inwUsJIIlqrNAsl+mMBN5cjIBC53dgHHc8Wz0n8v9LZuEDl6s1B2aQhj5p
mynQ==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id y4si343173qkj.29.2019.01.23.13.34.03
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:04 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id A3E1B43A2B;
Wed, 23 Jan 2019 21:34:02 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 6CC876BF6F;
Wed, 23 Jan 2019 21:34:02 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0BA283F604;
Wed, 23 Jan 2019 21:34:02 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXcIW032385 for ;
Wed, 23 Jan 2019 16:33:38 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 2DB61BA78; Wed, 23 Jan 2019 21:33:38 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B774367141;
Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:41 -0500
Message-Id: <272f56b10751db3c58d90813ec59ab34f6a661fa.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 13/25] qemu: Support interface
model=virtio-{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.30]);
Wed, 23 Jan 2019 21:34:03 +0000 (UTC)
Add new model handling for virtio transitional devices. Ex:
* "virtio-transitional" maps to qemu "virtio-net-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-net-pci-non-transitional"
Signed-off-by: Cole Robinson
---
src/conf/domain_conf.c | 4 +++-
src/qemu/qemu_command.c | 8 +++++++-
src/qemu/qemu_domain_address.c | 9 +++++++--
.../virtio-non-transitional.x86_64-3.1.0.args | 6 +++++-
.../virtio-non-transitional.x86_64-latest.args | 6 +++++-
tests/qemuxml2argvdata/virtio-non-transitional.xml | 4 ++++
.../virtio-transitional.x86_64-3.1.0.args | 5 ++++-
.../virtio-transitional.x86_64-latest.args | 5 ++++-
tests/qemuxml2argvdata/virtio-transitional.xml | 4 ++++
tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 12 +++++++++++-
tests/qemuxml2xmloutdata/virtio-transitional.xml | 7 ++++++-
11 files changed, 60 insertions(+), 10 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index eeb1191677..0a59a4e91f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29852,7 +29852,9 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface)
bool
virDomainNetIsVirtioModel(const virDomainNetDef *net)
{
- return STREQ_NULLABLE(net->model, "virtio");
+ return (STREQ_NULLABLE(net->model, "virtio") ||
+ STREQ_NULLABLE(net->model, "virtio-transitional") ||
+ STREQ_NULLABLE(net->model, "virtio-non-transitional"));
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3cf0f5b13e..6ddfe2703c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -472,9 +472,15 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_NET:
+ has_tmodel = STREQ_NULLABLE(device.data.net->model, "virtio-transitional");
+ has_ntmodel = STREQ_NULLABLE(device.data.net->model, "virtio-non-transitional");
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL;
+ break;
+
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_VIDEO:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 808e551b9c..9f1a2dc9b8 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -692,8 +692,13 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
return 0;
}
- if (STREQ_NULLABLE(net->model, "virtio"))
- return virtioFlags;
+ if (STREQ_NULLABLE(net->model, "virtio") ||
+ STREQ_NULLABLE(net->model, "virtio-non-transitional"))
+ return virtioFlags;
+
+ /* Transitional devices only work in conventional PCI slots */
+ if (STREQ_NULLABLE(net->model, "virtio-transitional"))
+ return pciFlags;
if (STREQ_NULLABLE(net->model, "e1000e"))
return pcieFlags;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 70446f16f2..827b4070d4 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -26,9 +26,13 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.1,\
+-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-netdev user,id=hostnet0 \
+-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
+id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 37078765bc..9a0eb9a1f3 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -26,9 +26,13 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-non-transitional,scsi=off,bus=pci.1,addr=0x0,\
+-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-netdev user,id=hostnet0 \
+-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
+mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 7899994622..a1b35d1c07 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -12,6 +12,10 @@
+
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 356e8fdf4c..9b80cd893a 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -28,8 +28,11 @@ addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x1,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
+-netdev user,id=hostnet0 \
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
+addr=0x1 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index e78223eac8..46e139d492 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -28,8 +28,11 @@ addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x1,\
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-netdev user,id=hostnet0 \
+-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
+mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index 678a7b9132..18f665577a 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -12,6 +12,10 @@
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 7e4aa16b32..f0dc7c0833 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -35,6 +35,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index c19e133bb3..f9729391a5 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -39,6 +39,11 @@
+
+
+
+
+
From patchwork Wed Jan 23 21:32:42 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156412
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202073jaa;
Wed, 23 Jan 2019 13:34:11 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5e3V3vF8M0LQF3EWvt161NAXTZhgkW13zE6ezk7PrS4tgMIDjmPOTeqqrNbkS7z07UqUd/
X-Received: by 2002:aed:3861:: with SMTP id j88mr4248203qte.31.1548279250951;
Wed, 23 Jan 2019 13:34:10 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279250; cv=none;
d=google.com; s=arc-20160816;
b=vSLOaDN1Le0sLXIlHOlxVUxrCkU4+2MIeEh2N+VtAx0dRVar2/Fq2PRLfauF/2lg4I
IV3H0yG2zqyTHZDRrKMSdCT1nJzNcIYqFpEGLXshw2HuOJB4lDx5Lx5AxfyyWNhtuU7z
qlcceONzpS9d+ju5OL+FT9MMq2S/fjqUpeSPmPFDSHvL4e/k9I5F6/T/+xZmjC6g0aE1
RXqHWgO0zWz7EcEXJPZQalyXQ7dFVzpfeWUFNzSoz1T7c5foDzo6U15jusrRLQ2hWFyh
Y+hOe6P++kF91rNqWeYqz7zc/BKrebtbp5eBNPDVF+Kk2ldpcEgHGTPHZIKvcG/ZoX+m
hxwg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:cc:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=iCuY8a/R7CORpLconQtiQk9/toCW7O8YhxTmzdaUovw=;
b=Gwgl+VKuqO/P3wHBAPr8FfOJTA0IX8/8ZPr+cCeUeTYsBZzlrM9lZbIf9kFLrE87mT
VR1HPM3URm00NHukw9+Gh041eGJH24bDV2Uh5lxDyTvJw+cXT8XiMxM9mP3G3BmSRm9a
WkiORRNqxx+teFu0L54JUAbSm0PD5T61TsufzVEr5nE1EdBp0sgGF0x9LXz+hmgss+Gu
j+9XtAkmHdSHK7R0Nc/sD87gWx8gZxu1E2RD2Yw+Tbpf5FU66ZnDkiWc6Uj5g65o4umj
6/cXnJUIGxKkr3+Joh3K3fiV0vtYoKQYEe0P0lqU+C7qUTB4wcL5XoX2z5XYIt5zDbBH
L5fw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
t24si2602521qtr.128.2019.01.23.13.34.10
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:10 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 208D37BDC4;
Wed, 23 Jan 2019 21:34:08 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id AEC8260C6E;
Wed, 23 Jan 2019 21:34:07 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1CAF43F60F;
Wed, 23 Jan 2019 21:34:07 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXkTu032423 for ;
Wed, 23 Jan 2019 16:33:46 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8514067141; Wed, 23 Jan 2019 21:33:46 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B1527BA8B;
Wed, 23 Jan 2019 21:33:38 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:42 -0500
Message-Id: <4cce1b7008b8dd44ae7eb05eecb48cebaa0f41ee.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Cc: Andrea Bolognani
Subject: [libvirt] [PATCH v2 14/25] conf: Add
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.26]);
Wed, 23 Jan 2019 21:34:09 +0000 (UTC)
qemu vhost-scsi devices map to XML roughly like:
To support vhost-scsi-pci-{non-}traditional in qemu, we
need to to extend the SCSI Host hostdev XML to handle
model= value. This matches the XML model= format used
for mediated devices. This is just the domain_conf bits
and some XML test cases.
Use of virtio-X naming here does not match the hostdev
protocol=vhost nor does it match the qemu vhost-X device
naming, however it's more consistent with all other
model= names in this area, and also matches the
inconsistency of devices which use model=virtio
but map to vhost-vsock on the qemu commandline
Reviewed-by: Andrea Bolognani
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 5 ++-
docs/schemas/domaincommon.rng | 9 +++++
src/conf/domain_conf.c | 38 ++++++++++++++++---
src/conf/domain_conf.h | 12 ++++++
src/libvirt_private.syms | 2 +
.../virtio-non-transitional.x86_64-3.1.0.args | 3 ++
...virtio-non-transitional.x86_64-latest.args | 3 ++
.../virtio-non-transitional.xml | 3 ++
.../virtio-transitional.x86_64-3.1.0.args | 3 ++
.../virtio-transitional.x86_64-latest.args | 3 ++
.../qemuxml2argvdata/virtio-transitional.xml | 3 ++
.../virtio-non-transitional.xml | 9 +++++
.../virtio-transitional.xml | 9 +++++
13 files changed, 96 insertions(+), 6 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0f66b5a1fc..c4a4639300 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4680,7 +4680,10 @@
since 2.5.0For SCSI devices, user
is responsible to make sure the device is not used by host. This
type passes all LUNs presented by a single HBA to
- the guest.
+ the guest. Since 5.1.0, the
+ model attribute can be specified further
+ with "virtio-transitional", "virtio-non-transitional", or
+ "virtio" which matches the old behavior.
mdev
For mediated devices (Since 3.2.0)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7af6e2532b..2b20a60edd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4627,6 +4627,15 @@
scsi_host
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0a59a4e91f..8db54daeeb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -714,6 +714,14 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIHostProtocol,
"none",
"vhost")
+VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIVHostModel,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
+ "default",
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
+);
+
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
"storage",
"misc",
@@ -7692,6 +7700,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
int ret = -1;
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = &def->source.subsys.u.scsi_host;
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev;
/* @managed can be read from the xml document - it is always an
@@ -7774,14 +7783,26 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
}
}
- if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
+ if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
+ def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
if (model) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'model' attribute in is only supported "
- "when type='mdev'"));
+ virReportError(VIR_ERR_XML_ERROR,
+ _("'model' attribute in is not supported "
+ "for type='%s'"),
+ virDomainHostdevSubsysTypeToString(def->source.subsys.type));
goto cleanup;
}
- } else {
+ }
+
+ if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
+ if (model &&
+ ((scsihostsrc->model = virDomainHostdevSubsysSCSIVHostModelTypeFromString(model)) < 0)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("unknown hostdev model '%s'"),
+ model);
+ goto cleanup;
+ }
+ } else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
if (!model) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing 'model' attribute in mediated device's "
@@ -27210,6 +27231,7 @@ virDomainHostdevDefFormat(virBufferPtr buf,
const char *mode = virDomainHostdevModeTypeToString(def->mode);
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev;
+ virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = &def->source.subsys.u.scsi_host;
const char *type;
if (!mode) {
@@ -27260,6 +27282,12 @@ virDomainHostdevDefFormat(virBufferPtr buf,
virTristateBoolTypeToString(scsisrc->rawio));
}
+ if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST &&
+ scsihostsrc->model) {
+ virBufferAsprintf(buf, " model='%s'",
+ virDomainHostdevSubsysSCSIVHostModelTypeToString(scsihostsrc->model));
+ }
+
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
virBufferAsprintf(buf, " model='%s'",
virMediatedDeviceModelTypeToString(mdevsrc->model));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 644dde3dd3..4812339163 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -394,11 +394,23 @@ typedef enum {
VIR_ENUM_DECL(virDomainHostdevSubsysSCSIHostProtocol)
+typedef enum {
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_DEFAULT,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL,
+
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
+} virDomainHostdevSubsysSCSIVHostModelType;
+
+VIR_ENUM_DECL(virDomainHostdevSubsysSCSIVHostModel)
+
typedef struct _virDomainHostdevSubsysSCSIVHost virDomainHostdevSubsysSCSIVHost;
typedef virDomainHostdevSubsysSCSIVHost *virDomainHostdevSubsysSCSIVHostPtr;
struct _virDomainHostdevSubsysSCSIVHost {
int protocol; /* enum virDomainHostdevSubsysSCSIHostProtocolType */
char *wwpn;
+ int model; /* enum virDomainHostdevSubsysSCSIVHostModelType */
};
typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8d27d507cc..25038b4e92 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -408,6 +408,8 @@ virDomainHostdevInsert;
virDomainHostdevModeTypeToString;
virDomainHostdevRemove;
virDomainHostdevSubsysPCIBackendTypeToString;
+virDomainHostdevSubsysSCSIVHostModelTypeFromString;
+virDomainHostdevSubsysSCSIVHostModelTypeToString;
virDomainHostdevSubsysTypeToString;
virDomainHPTResizingTypeToString;
virDomainHubTypeFromString;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 827b4070d4..9c38d713b2 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
+-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
+-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
+bus=pci.3,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 9a0eb9a1f3..82255909c4 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
+-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
+-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
+bus=pci.3,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index a1b35d1c07..32d2bdc638 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -16,6 +16,9 @@
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 9b80cd893a..4e991d6187 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
addr=0x1 \
+-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
+bus=pci.3,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 46e139d492..dab25ba2e8 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
+-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
+bus=pci.3,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index 18f665577a..eddc1ce9f5 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -16,6 +16,9 @@
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index f0dc7c0833..2af5195dfd 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -40,6 +40,11 @@
+
+
+
+
+
@@ -47,6 +52,10 @@
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index f9729391a5..ce7b109845 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,6 +39,11 @@
+
+
+
+
+
@@ -46,6 +51,10 @@
+
+
+
+
From patchwork Wed Jan 23 21:32:43 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156408
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201854jaa;
Wed, 23 Jan 2019 13:33:55 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5985p+AQx8QX0veUOUa/xpWqOr06VNkv+7FfDSusVfqGJS57BEPzkk9MH51NKVfcbP5q8j
X-Received: by 2002:a37:8846:: with SMTP id k67mr3358071qkd.214.1548279235792;
Wed, 23 Jan 2019 13:33:55 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279235; cv=none;
d=google.com; s=arc-20160816;
b=nWl5Tlv7xgEPe5z8ZymivhkA2w6stVu+qQWWwosxR9etagttN2riX1KSPkZMNy+5cT
WpkkMH2zSvPyUKKnupEoFfFGXJKrm4cbf9yT03aAElyw1LywTe2dhhESlC3jyOgc0R26
qmbWds2GsgjhjCTP3tv94TyCzrqBPkK4WVwJyCmKrNhhvI0v50Bk3VZUu7ej7rzAQ6Z5
95ybuTtfGJ0BPtnBlNQLBK5Wq7KL4FU3xDb6Tv1fXn89l07H+UJqJAzWdyWKAh/1T4MC
Kfd9oW82h6cJxttLcEG1LHFJn7LWl6kS/1ZctTIaR9wRB3rZk8T8Vy1IZFZKJer5lPaQ
Xm3g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=k07SWx/wXmaNI0fGpWhBmzgKgd3jGAWiyy5/dam9ltE=;
b=klLuqZQYwMMEDZ5ycFMcrHTyH1QqYr5qa2kz0U6RI1zTY+e7b/hWmMcxsUH1dBE7ul
giR6CpOcgUW8Pc/ZJ30ZDozlxNni7mdDEKE8V4vrWTxmcRNaknnHcCsdPcZGa3FcLCKu
EQCQNYBoh5ZNOMxu21OX+NfKw0V79zZQ4FT9xrRSBCqPF/lrF2QdTH4hHXCnQuD5f3/1
zMV4oPD3ymVsUrQVuesS8cV0ZESKzE2rvvQiP8ctBqvMHsKW5+TSH3+JypFkLlLU3kzP
fOlaNdXFsb9uep1izeogNH4B24ru1ScrTKB37d0Ez0Z1HSevOrLjrYA02hQ5UqnK7pXt
9vvg==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
j76si4419857qke.150.2019.01.23.13.33.55
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:33:55 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 4BEE8432D4;
Wed, 23 Jan 2019 21:33:54 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 18C706BF7B;
Wed, 23 Jan 2019 21:33:54 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id BFEDB18033AA;
Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLXrGD032482 for ;
Wed, 23 Jan 2019 16:33:53 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 24D91BA8B; Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id D07CCBA50;
Wed, 23 Jan 2019 21:33:46 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:43 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 15/25] qemu: Support hostdev
model=virtio-{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.30]);
Wed, 23 Jan 2019 21:33:54 +0000 (UTC)
Add protocol=vhost model handling for virtio transitional
devices. Ex:
* "virtio-transitional" maps to qemu "vhost-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-scsi-pci-non-transitional"
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 10 +++++++++-
src/qemu/qemu_domain_address.c | 9 ++++++---
.../virtio-non-transitional.x86_64-3.1.0.args | 4 ++--
.../virtio-non-transitional.x86_64-latest.args | 4 ++--
.../virtio-transitional.x86_64-3.1.0.args | 3 +--
.../virtio-transitional.x86_64-latest.args | 5 ++---
tests/qemuxml2xmloutdata/virtio-transitional.xml | 7 +------
7 files changed, 23 insertions(+), 19 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6ddfe2703c..eced41a98f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -479,12 +479,20 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ if (device.data.hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)
+ return 0;
+ has_tmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL;
+ has_ntmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL;
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
- case VIR_DOMAIN_DEVICE_HOSTDEV:
case VIR_DOMAIN_DEVICE_WATCHDOG:
case VIR_DOMAIN_DEVICE_CONTROLLER:
case VIR_DOMAIN_DEVICE_GRAPHICS:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9f1a2dc9b8..993f33299f 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -785,11 +785,14 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
return pcieFlags;
/* according to pbonzini, from the guest PoV vhost-scsi devices
- * are the same as virtio-scsi, so they should use virtioFlags
- * (same as virtio-scsi) to determine Express vs. legacy placement
+ * are the same as virtio-scsi, so they should follow virtio logic
*/
- if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)
+ if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
+ /* Transitional devices only work in conventional PCI slots */
+ if (hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL)
+ return pciFlags;
return virtioFlags;
+ }
if (!(pciDev = virPCIDeviceNew(hostAddr->domain,
hostAddr->bus,
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 9c38d713b2..500c03bdc3 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -34,8 +34,8 @@ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
--device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.3,addr=0x0 \
+-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
+wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 82255909c4..c8dbffda65 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -34,8 +34,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
--device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.3,addr=0x0 \
+-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
+id=hostdev0,bus=pci.3,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 4e991d6187..38a9e348b3 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
--device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
@@ -35,7 +34,7 @@ id=virtio-disk0,bootindex=1 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
addr=0x1 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.3,addr=0x0 \
+bus=pci.2,addr=0x3 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index dab25ba2e8..ab2c35514d 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,15 +27,14 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
--device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
--device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.3,addr=0x0 \
+-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
+id=hostdev0,bus=pci.2,addr=0x3 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index ce7b109845..8c1baced0e 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,11 +39,6 @@
-
-
-
-
-
@@ -53,7 +48,7 @@
-
+
From patchwork Wed Jan 23 21:32:44 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156414
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202151jaa;
Wed, 23 Jan 2019 13:34:15 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5sL2QCcTwpsDyc0h8hOVMH3587kID7tEGvahrdnH3PayMt2uis2xwYrG89o7wzguQa2ui7
X-Received: by 2002:a0c:a3e2:: with SMTP id v89mr3539637qvv.226.1548279255136;
Wed, 23 Jan 2019 13:34:15 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279255; cv=none;
d=google.com; s=arc-20160816;
b=JLf+vP6g2Gpce3Pkk3fSPi6IJmjP1OrULBZ5IBi26UPqj19IexN59sgixoQC6hOdKH
GOhXqpRyLufntX63C4fbm3q98xqP0UXO1UcUNRpAI7ZupxiS5//p3gWZAaeucICW+ucB
VNLlT5v8QodlvG0Kkl+ReFoEkEE1k9gQPRkZlqUmG1BXMP4VTofNebFAJQC2PPfH6tiK
qQU+ntG+8KKC/PBNeFeUZl8OFsnnQzpYpa4bHXkvQtvW90JPOcC8Q20OFlJnEui3VDUZ
chrqXI+RhUXZkjWl6vkyTIV1PXV76ZkLLKmxvu9kGTUqS1NMdnrO8yVGOLd6G0+oUH4r
ncEw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=fR7W38rq5uenq7GOGJ2Nz4RL8ats5rGDZU1f9ZcvjJs=;
b=pLEWFOPGlBi2uclvdLN14X5e+bpFKsb5Y6IrXLFUDFEcPsk+BEOqgNQEA9NmWnZGFD
oVxOa/f8Ye+bBf8G2lOOXitHZT3L+PAl/mctpmJuXZdK3D+WVgJb2CB8tOE/Rp0zUZTz
yGqnAY38jtvveWqYmGOKfupqcZfLXstHKGVBGyBE0wB1nb24LNSUIRFyR8Mw1ePaZMoS
/yNrsdrqkoTZ7df+mwFqQq4D94e1fvA/sXyP2YRe0IWP/Ef8nCL0nDdhNiTyzIbvk9so
eSf4L5E7SfDGepjvH87E/C2n/BR3vmIv969moxv3vkQcnoT06YB0dcOi9TFveDkvFs5N
I19g==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
y36si3159358qtd.218.2019.01.23.13.34.14
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:15 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 8C7E41441B9;
Wed, 23 Jan 2019 21:34:13 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 953C96C212;
Wed, 23 Jan 2019 21:34:12 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 311EB18033CA;
Wed, 23 Jan 2019 21:34:12 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLY4Ug032571 for ;
Wed, 23 Jan 2019 16:34:04 -0500
Received: by smtp.corp.redhat.com (Postfix)
id A48B46715E; Wed, 23 Jan 2019 21:34:04 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2ECE4BA50;
Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:44 -0500
Message-Id: <6ec24ad917b9b9d8da1a64d4e4fbfd6d77bdb712.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 16/25] qemu: Support rng
model=virtio-{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:34:14 +0000 (UTC)
Add new model values for virtio transitional devices. Ex:
...
* "virtio-transitional" maps to qemu "virtio-rng-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-rng-pci-non-transitional"
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 2 ++
docs/schemas/domaincommon.rng | 6 +++++-
src/conf/domain_conf.c | 5 ++++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_command.c | 8 +++++++-
src/qemu/qemu_domain.c | 8 ++++++++
src/qemu/qemu_domain_address.c | 4 ++++
.../virtio-non-transitional.x86_64-3.1.0.args | 4 ++++
.../virtio-non-transitional.x86_64-latest.args | 3 +++
tests/qemuxml2argvdata/virtio-non-transitional.xml | 3 +++
.../virtio-transitional.x86_64-3.1.0.args | 2 ++
.../virtio-transitional.x86_64-latest.args | 2 ++
tests/qemuxml2argvdata/virtio-transitional.xml | 3 +++
tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 9 +++++++++
tests/qemuxml2xmloutdata/virtio-transitional.xml | 4 ++++
15 files changed, 62 insertions(+), 3 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c4a4639300..bf64bf9feb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7971,6 +7971,8 @@ qemu-kvm -net nic,model=? /dev/null
'virtio' - supported by qemu and virtio-rng kernel module
+
'virtio-transitional' Since 5.1.0
+
'virtio-non-transitional' Since 5.1.0
rate
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2b20a60edd..58ae874dfd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5452,7 +5452,11 @@
- virtio
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8db54daeeb..fa772da52f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -859,7 +859,10 @@ VIR_ENUM_IMPL(virDomainDiskTray, VIR_DOMAIN_DISK_TRAY_LAST,
VIR_ENUM_IMPL(virDomainRNGModel,
VIR_DOMAIN_RNG_MODEL_LAST,
- "virtio");
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
+);
VIR_ENUM_IMPL(virDomainRNGBackend,
VIR_DOMAIN_RNG_BACKEND_LAST,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4812339163..d73fcd1221 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2127,6 +2127,8 @@ struct _virBlkioDevice {
typedef enum {
VIR_DOMAIN_RNG_MODEL_VIRTIO,
+ VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL,
VIR_DOMAIN_RNG_MODEL_LAST
} virDomainRNGModel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eced41a98f..bf59ed72e1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -488,6 +488,13 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_RNG:
+ has_tmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL;
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
@@ -506,7 +513,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
- case VIR_DOMAIN_DEVICE_RNG:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
case VIR_DOMAIN_DEVICE_VSOCK:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 27cdb30ca2..52c73df9ea 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4550,6 +4550,14 @@ qemuDomainRNGDefValidate(const virDomainRNGDef *def,
model_supported = virQEMUCapsGet(qemuCaps,
QEMU_CAPS_DEVICE_VIRTIO_RNG);
break;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
+ model_supported = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY));
+ break;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL:
+ model_supported = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY));
+ break;
case VIR_DOMAIN_RNG_MODEL_LAST:
break;
}
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 993f33299f..8880c946f6 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -862,7 +862,11 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_RNG:
switch ((virDomainRNGModel) dev->data.rng->model) {
case VIR_DOMAIN_RNG_MODEL_VIRTIO:
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL:
return virtioFlags;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
+ /* Transitional devices only work in conventional PCI slots */
+ return pciFlags;
case VIR_DOMAIN_RNG_MODEL_LAST:
return 0;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 500c03bdc3..10cc6236cb 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -28,6 +28,7 @@ addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
+-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -36,6 +37,9 @@ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x0 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\
+id=rng0,bus=pci.4,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index c8dbffda65..a0fc475c2f 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -28,6 +28,7 @@ addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
+-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -36,6 +37,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.3,addr=0x0 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.4,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 32d2bdc638..2075ccbf57 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -19,6 +19,9 @@
+
+ /dev/urandom
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 38a9e348b3..dc830d21b1 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -35,6 +35,8 @@ id=virtio-disk0,bootindex=1 \
addr=0x1 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
bus=pci.2,addr=0x3 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index ab2c35514d..64fb4153fd 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -35,6 +35,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.2,addr=0x3 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index eddc1ce9f5..82535c84d6 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -19,6 +19,9 @@
+
+ /dev/urandom
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 2af5195dfd..4a315050ab 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -45,6 +45,11 @@
+
+
+
+
+
@@ -57,5 +62,9 @@
+
+ /dev/urandom
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index 8c1baced0e..ae3789ad93 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -51,5 +51,9 @@
+
+ /dev/urandom
+
+
From patchwork Wed Jan 23 21:32:45 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156411
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202068jaa;
Wed, 23 Jan 2019 13:34:10 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7sqvs6Xf95e8UTtCuRoj9K9gw45qkOvcXSbslbp4GGdxECrKdZRwJ33P7G6j3qschx/M3u
X-Received: by 2002:a0c:bd15:: with SMTP id m21mr3529617qvg.57.1548279250662;
Wed, 23 Jan 2019 13:34:10 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279250; cv=none;
d=google.com; s=arc-20160816;
b=ZWx0YXvB1ZCzcWCSUZlXk6qydnbk6/CR6Lsc2+TmRq+UmjderXTV3EfYOCL5+MJez9
TcaoYR5DXd5Xaqt89QV4lhVmh5m89hevPnp6zHHOfXPYkCf4P0MBaYuK/8xVOk/+9wEz
bqzSSuC0iTDKSP6pOHxf2zk+i9UwY65T+F7NPhi/e9HZT0Fn/DGdy90Wl5a9nBtPBioF
AoKMaIyHFO3+AY2j+EYUSzMxvGjA/v7QKOHAbDgh4BeYIkq9yxxejUKjxH8VeB3tt3Ff
2mX+9gLxBHpeLg6qZD5cUrjswd5p2YExvflyEKtfS1Jzrl9oxdlLY6jK69sZS6pLtLdb
D1Yw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=5egEaGNTMIxluiluicWOA1CawjPZfBo5kgqxGjKG7QE=;
b=GXdM/wLwvMAmK0fpIOGdSq5/t+EhvH42uoEoX1mr+p5DltRq0+MHRYTXD3jH7eFpmz
zjJcgfrNOjYlw5vsBmMaI/lS6UFwMt5YqHxcjKaL+rLq6e/+kWBFDDHJwiK1RdfX7BIu
FcP91firKnh9iGmz516P2sMx0jklr/EV3trrL/IMlnoCYhsl8L/7WInIPFfwipBIlMBB
RVn0zkAkqHSsULoJmFnHsTqAhChSldp3gZLWScBiASJlpmdOB7fJKRsfSOn2M8qEizn0
Vmb6C81KEUNBwzEsEKjBs9zD2mn9pMdMtppaAZxrr5GTedZrE7yLoR6fdyC425WgYuJ6
o0SQ==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id e32si836902qvd.6.2019.01.23.13.34.10
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:10 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 30C48432A0;
Wed, 23 Jan 2019 21:34:09 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id F086E600C6;
Wed, 23 Jan 2019 21:34:08 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 99306180339D;
Wed, 23 Jan 2019 21:34:08 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLY7Tx032594 for ;
Wed, 23 Jan 2019 16:34:07 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 443A060C6E; Wed, 23 Jan 2019 21:34:07 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 064E767144;
Wed, 23 Jan 2019 21:34:04 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:45 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 17/25] conf: Add
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.30]);
Wed, 23 Jan 2019 21:34:09 +0000 (UTC)
devices lack the model= attribute which is used by
most other device types. To eventually support
virtio-9p-pci-{non-}traditional in qemu, let's add a standard
model= attribute. The accepted values are:
- virtio-9p
- virtio-9p-transitional
- virtio-9p-non-transitional
The divergence in naming from other *-transitional values is
because we expect to support virtio-fs in the future.
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 +++
docs/schemas/domaincommon.rng | 9 +++++
src/conf/domain_conf.c | 33 +++++++++++++++++--
src/conf/domain_conf.h | 11 +++++++
.../virtio-non-transitional.x86_64-3.1.0.args | 11 ++++---
...virtio-non-transitional.x86_64-latest.args | 11 ++++---
.../virtio-non-transitional.xml | 4 +++
.../virtio-transitional.x86_64-3.1.0.args | 15 +++++----
.../virtio-transitional.x86_64-latest.args | 15 +++++----
.../qemuxml2argvdata/virtio-transitional.xml | 4 +++
.../virtio-non-transitional.xml | 18 +++++++---
.../virtio-transitional.xml | 26 ++++++++++-----
12 files changed, 127 insertions(+), 34 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bf64bf9feb..1f39601749 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3880,6 +3880,10 @@
+ Since 5.1.0, the filesystem element
+ has an optional attribute model with supported values
+ "virtio-9p-transitional", "virtio-9p-non-transitional", or
+ "virtio-9p" which matches the default behavior of the QEMU driver.
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index d2429d2d2c..06fe70bb11 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,6 +27,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
@@ -35,6 +36,8 @@ id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
addr=0x2 \
+-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\
+addr=0x0 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
bus=pci.2,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index f3a4e0804e..24b49e6009 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,6 +27,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -36,6 +37,8 @@ bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
+-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\
+addr=0x0 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index dd33071eb9..5daea19ada 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -26,6 +26,9 @@
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 5ba39ea30f..32c57a27f1 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -65,6 +65,11 @@
+
+
+
+
+
@@ -75,6 +80,10 @@
+
+
+
+
@@ -90,7 +99,7 @@
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index 5cb6568cc8..b0da885c79 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,6 +39,11 @@
+
+
+
+
+
@@ -49,6 +54,10 @@
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c5ad3ba4b6..be8ef921ee 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1273,13 +1273,15 @@ mymain(void)
QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
- QEMU_CAPS_DEVICE_VHOST_VSOCK);
+ QEMU_CAPS_DEVICE_VHOST_VSOCK,
+ QEMU_CAPS_VIRTIO_INPUT_HOST);
DO_TEST("virtio-non-transitional",
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
- QEMU_CAPS_DEVICE_VHOST_VSOCK);
+ QEMU_CAPS_DEVICE_VHOST_VSOCK,
+ QEMU_CAPS_VIRTIO_INPUT_HOST);
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
From patchwork Wed Jan 23 21:32:50 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156417
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202236jaa;
Wed, 23 Jan 2019 13:34:20 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7KDMXC+fBVnnbV+cJ33F/bu/QpbP5kWzrojWjBnU6sIU4tFf/Cj/fjllvjIATPaeVeYx+n
X-Received: by 2002:ac8:2dc3:: with SMTP id q3mr4233996qta.178.1548279260323;
Wed, 23 Jan 2019 13:34:20 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279260; cv=none;
d=google.com; s=arc-20160816;
b=NjH2M0SbN1QTif9nhBDDyqTLt/QgUMWZ6dVgehSQlGbMuI4A+kkCg0nZ48VOW3YRpW
CzNDe5+f2jJenrz9TVMDIp4RjukvUcqD8FIn2mBep3Ok4kJNaIQ17Ln3zIUDXbBmVFFF
nU720RJBbB/i/ObxW0VkDw8tIroJqiewjDFcePDsmML/biTZyTf8iipZSH7OjNgzxFOi
RtK9glfPpT/Oi3RewQUx07QpawZ1fdzpfJRPkPNWCDtvhHn8fP8puhsRMQp/d33RxRbG
I1lA5ry8FGM29A1oFtsy4UDKNJy8IndhnfjJ7/Tt9UXDS+rRLninPNpRvXzg4TPM8ZAS
UlUA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=YveCdWjdingCf0vEPdhg5pwC2FDdKByV75hl7fNaTdQ=;
b=OPRWEsoCkG9o8dnPQKahLF0WfBC+Kd9jV/zuQEQ4NdGOeJHp+cwGElozH0x1bXSZUw
UDswBU8b2e4ZNghGmIAyobBXkRcv4bC7iNJIiQQMm8sT4cfWPBmE51KV/gttKIgRJldK
8DfRX1/zF9VH1oE8uRW9XTAiggblLyBWREpz8MqkLt++TapKxjHfC8DtmyVLVNGVyOtn
h4nBDLVa122Cs1sUrpgJRqonO0YyCCD06MsU1s6I3cgt4fTsP4htdPuYTwDSucaCrg2c
ZkGMpnIMkeP25wS/VIy7I6ongdAE0CjN2YePVcg5goSlswr8U6FzeJqOAhY03q1XnSPg
sUhg==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
e186si8330989qkf.27.2019.01.23.13.34.20
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:20 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 288587EBC5;
Wed, 23 Jan 2019 21:34:18 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id DB4D86C1F1;
Wed, 23 Jan 2019 21:34:17 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 716B918033A1;
Wed, 23 Jan 2019 21:34:17 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLYF5k032670 for ;
Wed, 23 Jan 2019 16:34:15 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 422B1BA9E; Wed, 23 Jan 2019 21:34:15 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id A236065F72;
Wed, 23 Jan 2019 21:34:13 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:50 -0500
Message-Id: <3b52eb01e5c90f4c1ada71a5eefe63e5acd72c2e.1548278586.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 22/25] qemu: Support input
model=virtio-{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:34:18 +0000 (UTC)
Add model handling for virtio transitional devices. Ex:
...
* "virtio-transitional" maps to qemu "virtio-input-host-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-input-host-non-transitional"
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 10 +++++++++-
src/qemu/qemu_domain_address.c | 13 ++++++++++++-
.../virtio-non-transitional.x86_64-3.1.0.args | 4 ++--
.../virtio-non-transitional.x86_64-latest.args | 4 ++--
.../virtio-transitional.x86_64-3.1.0.args | 7 +++----
.../virtio-transitional.x86_64-latest.args | 7 +++----
tests/qemuxml2xmloutdata/virtio-transitional.xml | 9 ++-------
7 files changed, 33 insertions(+), 21 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Andrea Bolognani
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9d64c7d7b0..a5c11956ed 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -516,8 +516,16 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL;
break;
- case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT:
+ if (device.data.input->type != VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH)
+ return 0;
+ has_tmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL;
+ break;
+
+ case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
case VIR_DOMAIN_DEVICE_WATCHDOG:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 4767b7aadc..7878d827de 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -919,7 +919,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_INPUT:
switch ((virDomainInputBus) dev->data.input->bus) {
case VIR_DOMAIN_INPUT_BUS_VIRTIO:
- return virtioFlags;
+ switch ((virDomainInputModel) dev->data.input->model) {
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL:
+ /* Transitional devices only work in conventional PCI slots */
+ return pciFlags;
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO:
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL:
+ case VIR_DOMAIN_INPUT_MODEL_DEFAULT:
+ return virtioFlags;
+ case VIR_DOMAIN_INPUT_MODEL_LAST:
+ break;
+ }
+ return 0;
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_USB:
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 9130572abe..0f5de86315 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -42,8 +42,8 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
--device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\
-addr=0x0 \
+-device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\
+evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 8e0709816b..383b29f629 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -42,8 +42,8 @@ bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
--device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\
-addr=0x0 \
+-device virtio-input-host-pci-non-transitional,id=input0,\
+evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 06fe70bb11..8046e5c102 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
--device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
@@ -36,8 +35,8 @@ id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
addr=0x2 \
--device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\
-addr=0x0 \
+-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\
+addr=0x7 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
bus=pci.2,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \
@@ -45,5 +44,5 @@ bus=pci.2,addr=0x4 \
-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
--device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x7 \
+-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x8 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 24b49e6009..410eb28f0a 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
--device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -37,8 +36,8 @@ bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
--device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\
-addr=0x0 \
+-device virtio-input-host-pci-transitional,id=input0,\
+evdev=/dev/input/event1234,bus=pci.2,addr=0x7 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \
@@ -47,5 +46,5 @@ id=hostdev0,bus=pci.2,addr=0x4 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\
-bus=pci.2,addr=0x7 \
+bus=pci.2,addr=0x8 \
-msg timestamp=on
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index b0da885c79..c944f0d9f8 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,11 +39,6 @@
-
-
-
-
-
@@ -56,7 +51,7 @@
-
+
@@ -73,7 +68,7 @@
-
+
From patchwork Wed Jan 23 21:32:51 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156416
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202224jaa;
Wed, 23 Jan 2019 13:34:19 -0800 (PST)
X-Google-Smtp-Source: ALg8bN52x5ap71C6yqAWYnQX0E/DBzJgSYfhaWN7IkZ1HUaNTyK8g98jwnVxOpHo/NnpiyT6ismv
X-Received: by 2002:a37:de09:: with SMTP id h9mr3396419qkj.113.1548279259685;
Wed, 23 Jan 2019 13:34:19 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279259; cv=none;
d=google.com; s=arc-20160816;
b=gRoA4qVazBPQUuO/rUk5hj+1Qlli/7CNxRHhi+KUpcPFbXLpDPXDHgAsUxO22NqCbD
pD/TCwS9JxGn+XvBx0FMMvJRHlm1TTs/pseGPlKbc3V+eomR8WduUXrc0b93UAwkJsUP
jTUzfhHQ9hTHHo5lgVwToVz2CTeen0WAwmd/a6tDikSK9v3b72xIewnhfT3nkg3FHPvF
JQLW5oHuwRC19TUa7C/lve8NGC/V6mTOC+tg58vbbeXPGZe7CfaZyCxV1ZECSHO6EUdd
BkAdLR6JliTvpcV6D/7LIU8oBlXE2v+kiibIV47pFiLzoJfjvOTxlyInhmgzNhRss8J7
z6Ig==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=pa7mJvHtw1XWO6rOzvwkhrQ4hhdalvHovJt5YjCDh8M=;
b=kaBqaFpidTMWqJ0Y9NVa1YsA6gzm+XT9aZf3d0WWRljYqhWHtWOmrPtQTrs7a9/WPU
jXSM8OAWs631/2ES+LFm9LmHM9Wcu7w6WgXri4kz6KyTCqa7JGMbl+SrlJaRBPNmZkEA
ErItTR7jva85v5wzMdps7MrldddnL9naf+iKjhNAOWynq30GUQz5uYy6KOqQ1a/G3R9K
jyTXzz9KGP1dRfs2EE+LU22V/2E5G3Ub5mz26VRv3Xef6ZjOThy/+u7yUqDol1FqfEQR
lw9IVlkqiSYp+PhuZHXJnzcNCT4lGT1qY3Y6xBpqZDvqiuUhFcdFNKe2H3HzYnSsRSyg
1JEw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
63si1474989qth.271.2019.01.23.13.34.19
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:19 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Received: from smtp.corp.redhat.com
(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 3A958145206;
Wed, 23 Jan 2019 21:34:18 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id EE1666C20A;
Wed, 23 Jan 2019 21:34:17 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 892D8180339F;
Wed, 23 Jan 2019 21:34:17 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0NLYG5t032694 for ;
Wed, 23 Jan 2019 16:34:16 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 7C42ABA9E; Wed, 23 Jan 2019 21:34:16 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 851EEBAA5;
Wed, 23 Jan 2019 21:34:15 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:51 -0500
Message-Id: <19ade9466bcfe2b5e3da94c22aa564d7f9c6711c.1548278586.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 23/25] qemu: Support virtio-serial controller
model=virtio-{non-}transitional
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:34:18 +0000 (UTC)
Add controller type='virtio-serial' model handling for virtio
transitional devices. Ex:
* "virtio-transitional" maps to qemu "virtio-serial-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-serial-pci-non-transitional"
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 +++-
docs/schemas/domaincommon.rng | 9 ++++++++
src/conf/domain_conf.c | 11 ++++++++++
src/conf/domain_conf.h | 10 +++++++++
src/qemu/qemu_command.c | 12 +++++++++-
src/qemu/qemu_domain_address.c | 15 ++++++++++++-
.../virtio-non-transitional.x86_64-3.1.0.args | 18 +++++++++------
...virtio-non-transitional.x86_64-latest.args | 18 +++++++++------
.../virtio-non-transitional.xml | 1 +
.../virtio-transitional.x86_64-3.1.0.args | 13 ++++++-----
.../virtio-transitional.x86_64-latest.args | 13 ++++++-----
.../qemuxml2argvdata/virtio-transitional.xml | 1 +
.../virtio-non-transitional.xml | 22 +++++++++++++------
.../virtio-transitional.xml | 15 ++++++++-----
14 files changed, 120 insertions(+), 42 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6838774c74..b820adbc8a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4135,7 +4135,9 @@
The virtio-serial controller has two additional
optional attributes ports and vectors,
which control how many devices can be connected through the
- controller.
+ controller. Since 5.1.0, it
+ supports an optional attribute model which can
+ be 'virtio', 'virtio-transitional', or 'virtio-non-transitional'
A scsi controller has an optional attribute
model, which is one of 'auto', 'buslogic', 'ibmvscsi',
- 'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi' or
- 'vmpvscsi'.