From patchwork Thu Jan 17 17:52: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: 155865
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257681jaa;
Thu, 17 Jan 2019 09:53:31 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7BcfoOkvQ1zWGjqLUHxtAjJ/UISbkaGhk3f5mU8iWIAGZ5QzC8aBtTkLGKQ+MfjmfZAT1S
X-Received: by 2002:a0c:8286:: with SMTP id i6mr12169530qva.65.1547747611927;
Thu, 17 Jan 2019 09:53:31 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747611; cv=none;
d=google.com; s=arc-20160816;
b=b/lEWMUnWXYHOfIMoNZkTQAr5f9TV3LxDXQehO76j2byk2qvV+s5ZYIIePpjXjAayk
d9EtNZNnJTeoRPoNZv/6ySYkTSWWEZLOVc7WorWJPJfcLCl6iqYTUhyxLMHiEsGi9FtO
w8VhLqE5u5MglnM4j0EGZfpnhBGpV3zdD5piTrDOoumnNAnLiqx5W3alok23bxVdepZa
78FXbTPirPepYpKrZTr3GGkdJ5jRT7/O5AOOVIWL21GtEQPwbo0xGYTEs5heAiqXnj2P
iP1svX1u5mbsYlULKiCJ2IfPcpPxBsBIlhZlbFaEJj7COCv7O6SIO6hcLpT92DKyr6pa
G2Og==
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=cTCgl2/6zOS85iydixykMvsuM+NkGfXNKVp+UUgphpg=;
b=PKHXOxZwyD/KsFgRH52hkp++6Du0zHtR8h5opmLZmaz0yiMFhHGFmAN3uqo3BdKz2b
6RerrNsFw/ABRPcbdcVABJS7KP/IuKG4C3rjfL8ivm+6slAPOqN+AtRGvgY92ufxd+f8
MoVamMaVHyMnV4CdM5x0FLu/zRAQUbW94hrbxIjE09QHXtoTdyJMHrRoY/6BGmp3Jd69
o7Ifwt8EnCJ43S4ZJXX/kbhzNiZIIs3Ln+/4QTdskcvqirdrg7qrKo0qRwJDwqquNloG
0arXnaYHGRWKugdLTVsxpHkfqsPR1OM7U7QlVXgR+SRj1S2jIqd2+5B9qjvN+UdlMiA8
88Qw==
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
a19si8394329qta.325.2019.01.17.09.53.31
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:31 -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 2E472A7FDE;
Thu, 17 Jan 2019 17:53:30 +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 71A1317AB4;
Thu, 17 Jan 2019 17:53:29 +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 0F7F7180339F;
Thu, 17 Jan 2019 17:53:29 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHr5t2005474 for ;
Thu, 17 Jan 2019 12:53:05 -0500
Received: by smtp.corp.redhat.com (Postfix)
id A3A59600C9; Thu, 17 Jan 2019 17:53:05 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2C245600C7;
Thu, 17 Jan 2019 17:53:05 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:29 -0500
Message-Id: <9c4a237e7b9682550346cad454e3f01afd29c140.1547746867.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 02/18] 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.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.28]);
Thu, 17 Jan 2019 17:53:31 +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
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 10 +++++
docs/schemas/domaincommon.rng | 8 ++++
src/conf/domain_conf.c | 38 +++++++++++++++++
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, 342 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..29e4bb1bda 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 setting 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..425d7f851a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1506,6 +1506,14 @@
+
+
+
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 222bb8c482..facb84a425 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -889,6 +889,12 @@ 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",
@@ -5431,6 +5437,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;
}
@@ -9518,6 +9535,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");
@@ -21746,6 +21771,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;
@@ -24311,6 +24344,11 @@ 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 fae130668f..16c2c6e75b 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;
};
@@ -3408,6 +3418,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 c3d6306809..0d6f054cf2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -343,6 +343,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 2cb8860d26..8da99fc390 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3068,6 +3068,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 82e2c0ee0f..0eca113e23 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1265,6 +1265,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 Thu Jan 17 17:52: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: 155862
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257397jaa;
Thu, 17 Jan 2019 09:53:14 -0800 (PST)
X-Google-Smtp-Source: ALg8bN6GvJqce/E9v9AVDvzS490PCidN0LuBQyRCNWkHeQodB6W7or6+Ft8RBdFx9lg4w2ckn/77
X-Received: by 2002:a37:d947:: with SMTP id
u68mr11629176qki.296.1547747594841;
Thu, 17 Jan 2019 09:53:14 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747594; cv=none;
d=google.com; s=arc-20160816;
b=fMZA1KtSJUhQeJG0feP7HV0k+Lf3D0dcWlmbWpef84K6+i2ZBp1J/LCRrALXHWiefn
UUtXV5mXUhR+cCPzj+/RTjVTCupSR46RhBxHPrU4VNK1O9Vz/sbGz3sniUQPRwhmErPH
kuYZFz7MzqFnGfUFvbLO3Q4Mi5ffx9+dCUA/J3GOM3k/CuHeQuPg4vtc1g+ezSWS7zjV
1pr3q6R+6W8nf10JqOBhHZKrRGWy4MblRLzPUyAA+/WZT9K7gNzxt6HfuZjkvLy88tj4
gXiqSnK/YlASz3dvfn8LhpoJvMTd4UWVn0VuOxkfiM9w83BuqcxlTIYZFW0MXP8iKaKC
9LGg==
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=+XzdeR8wuEO4jo8HYK9K7m2Hl0TGiHBEtHHCD9DUgdM=;
b=xS+6ik7bEXnD3T/8gOVFt70i3vlEpWczuhJZEgs7lHL1xqnFsKyz37E0OdcKBW1av3
ZkKVtPQ6O77QjekyDk7CB6rPrcfChO82DbqjGywCZ/LRX/ASqYE5dY1KA5uTjALIqXIO
LUY2J33aLKpvQMusTcYyAlqyJs3zoSUm8n6LV59IRkEvhJ8rsIJW+tm6ZA05S5xgEgEv
3iJj4yO3EqGW45COsEVsMGq9I43+9jye7yMliVnSf6iMWVV4uhChZr6fVSMmWylk4uMF
dJIMvoIfJq+3XBB2s+5PM90HZAC3E4nu8/vPzNKMFazHCxvWjWaTEVKkp0/iJLcibEmn
1eyw==
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 9si816582qtd.29.2019.01.17.09.53.14
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:14 -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 2A9D2C073D7D;
Thu, 17 Jan 2019 17:53:12 +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 E3B9860933;
Thu, 17 Jan 2019 17:53:11 +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 6DFAB3F606;
Thu, 17 Jan 2019 17:53:11 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHr9ZU005489 for ;
Thu, 17 Jan 2019 12:53:09 -0500
Received: by smtp.corp.redhat.com (Postfix)
id B3B1B600C9; Thu, 17 Jan 2019 17:53:09 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 33E24600C6;
Thu, 17 Jan 2019 17:53:05 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:30 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 03/18] 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.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.32]);
Thu, 17 Jan 2019 17:53:13 +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_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 90 ++++++++++++++++++-
src/qemu/qemu_domain_address.c | 2 +
.../caps_4.0.0.x86_64.xml | 2 +
.../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 ++-
10 files changed, 117 insertions(+), 13 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_capabilities.c b/src/qemu/qemu_capabilities.c
index f504db7d05..b7c0387f8e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -520,6 +520,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
/* 325 */
"memory-backend-file.pmem",
"nvdimm.unarmed",
+ "virtio-blk-pci-transitional",
+ "virtio-blk-pci-non-transitional",
);
@@ -1108,6 +1110,8 @@ 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_TRANSITIONAL},
+ {"virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 6d5ed8a3cc..34265d7cc0 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -504,6 +504,8 @@ 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_TRANSITIONAL, /* -device virtio-blk-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL, /* -device virtio-blk-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 822d5f8669..608cd65806 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -443,6 +443,91 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
return 0;
}
+static int
+qemuBuildVirtioTransitional(virBufferPtr buf,
+ const char *baseName,
+ virQEMUCapsPtr qemuCaps,
+ virDomainDeviceAddressType type,
+ int model,
+ virDomainDeviceType devtype)
+{
+ int tmodel_cap, ntmodel_cap;
+ bool has_tmodel, has_ntmodel;
+
+ if (qemuBuildVirtioDevStr(buf, baseName, type) < 0)
+ return -1;
+
+ switch (devtype) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ has_tmodel = model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_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 (type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+ (has_tmodel || has_ntmodel)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("virtio transitional models are not supported "
+ "for address type=%s"),
+ virDomainDeviceAddressTypeToString(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");
+ } 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,
@@ -2049,7 +2134,10 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
break;
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- if (qemuBuildVirtioDevStr(&opt, "virtio-blk", disk->info.type) < 0)
+ if (qemuBuildVirtioTransitional(&opt, "virtio-blk", qemuCaps,
+ disk->info.type,
+ disk->model,
+ VIR_DOMAIN_DEVICE_DISK) < 0)
goto error;
if (disk->iothread)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index bd6c4031e0..4a7c71d76d 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -723,6 +723,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_DISK:
switch ((virDomainDiskBus) dev->data.disk->bus) {
case VIR_DOMAIN_DISK_BUS_VIRTIO:
+ 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/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index c2db392e83..8cf9083035 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -212,6 +212,8 @@
+
+ 30010500446361
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..9c5d553077 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,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 Thu Jan 17 17:52: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: 155861
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257372jaa;
Thu, 17 Jan 2019 09:53:13 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4RsmDgDS1hq04di8MSoRTaxwXZdkmRNJTu7vUDbvJjsfXHrGnXGFePXLHISljpzEmTguPs
X-Received: by 2002:ac8:548a:: with SMTP id h10mr12741505qtq.15.1547747593342;
Thu, 17 Jan 2019 09:53:13 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747593; cv=none;
d=google.com; s=arc-20160816;
b=hidDHYNBUzlE7fEDeU9UoJOhPxGxmix7TeQhYpjsfqpBSHoVFNqhwmCQKHqJzeAGcb
8mPaErnhtPi1eV8DGI7k+7R3aYJzo8VEM4noVNfpQhlZ94pCXG8WAq2tqowG/YweAS7b
u3iXQMjhxaLAAUSSlVPQx+4k088QeGk0uOr7WFoQLxmvVzTN6ux/Ozq2RxQp894w20DX
ZV9PczZ28kNuP20YoivLEW1CeXR9P9nQYD/bfwu9zfcY2QGk4ow/KEkWP3If4qOGztDL
N0M/tv83Q77wWO/9wBrBYXD/q/czlVfeDJNtl/MwUrebpH4pqVMU5YeePxijWCUCMso6
Hcmw==
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=y3ei40UvygVK2NNKWI8sjlUC9yoTsM5eIqcLTuRjidA=;
b=AiilZUH69stXr5OJbiLEciFCUR/ui4OZDw3YuHxEk+1p70r5KigdZJKFIAmxE84Uwd
jbRrwAulogE1Dow7XfxQNk4Qx4hrgyaKusZmpwJOA4iM4Nx9hSIH/SE7/yvSGJDePcQR
AX9Vh5mWgVtlrJbW6I0srUVcdSziRh0/U6BBfy5WfDglw1p9pZVbqepZNR7+fb/dlYlQ
GTNBnNdLpkBzdGwB3gqWJ80dG5vrbmnonYZ9X4ZWpJRPg5EVOtLZ7xnD9xXnM1GUcmfV
pkwBsSLcuqZZmyjL5oezzJXQ0aHykPgFjsK3cYkbmwJD9tEJD2K2sIti4Q5QeSv1eZcb
Ef6w==
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
z14si789736qtn.132.2019.01.17.09.53.13
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:13 -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 8E5A5C0C4268;
Thu, 17 Jan 2019 17:53:11 +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 3C31F5C5BB;
Thu, 17 Jan 2019 17:53:11 +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 C8E8B1803391;
Thu, 17 Jan 2019 17:53:10 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrAlA005494 for ;
Thu, 17 Jan 2019 12:53:10 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 44D36600C9; Thu, 17 Jan 2019 17:53:10 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id D8AD1600C6;
Thu, 17 Jan 2019 17:53:09 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:31 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 04/18] conf: Add virDomainNetHasVirtioModel
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.32]);
Thu, 17 Jan 2019 17:53:12 +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 | 47 +++++++++++++++++++---------------
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domain_address.c | 3 +--
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_interface.c | 8 +++---
src/security/virt-aa-helper.c | 2 +-
tests/qemuxml2argvmock.c | 2 +-
9 files changed, 38 insertions(+), 30 deletions(-)
--
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 facb84a425..4fc33c7e2f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4737,7 +4737,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_NET) {
virDomainNetDefPtr net = dev->data.net;
- if (STRNEQ_NULLABLE(net->model, "virtio") &&
+ if (!virDomainNetHasVirtioModel(net) &&
virDomainCheckVirtioOptions(net->virtio) < 0)
return -1;
}
@@ -11329,6 +11329,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) {
@@ -11346,7 +11362,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
- if (STRNEQ_NULLABLE(model, "virtio")) {
+ if (!virDomainNetHasVirtioModel(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Wrong or no 'type' attribute "
"specified with . "
@@ -11574,24 +11590,8 @@ 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")) {
+ virDomainNetHasVirtioModel(def)) {
if (backend != NULL) {
if ((val = virDomainNetBackendTypeFromString(backend)) < 0 ||
val == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
@@ -25478,7 +25478,7 @@ virDomainNetDefFormat(virBufferPtr buf,
if (def->model) {
virBufferEscapeString(buf, "\n",
def->model);
- if (STREQ(def->model, "virtio")) {
+ if (virDomainNetHasVirtioModel(def)) {
char *str = NULL, *gueststr = NULL, *hoststr = NULL;
int rc = 0;
@@ -29732,6 +29732,13 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface)
}
+bool
+virDomainNetHasVirtioModel(const virDomainNetDef *iface)
+{
+ return STREQ_NULLABLE(iface->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 16c2c6e75b..e3f4273b55 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3222,6 +3222,7 @@ virNetDevBandwidthPtr
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
+bool virDomainNetHasVirtioModel(const virDomainNetDef *iface);
int virDomainNetAppendIPAddress(virDomainNetDefPtr def,
const char *address,
int family,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0d6f054cf2..bd7e896654 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -470,6 +470,7 @@ virDomainNetGetActualTrustGuestRxFilters;
virDomainNetGetActualType;
virDomainNetGetActualVirtPortProfile;
virDomainNetGetActualVlan;
+virDomainNetHasVirtioModel;
virDomainNetInsert;
virDomainNetNotifyActualDevice;
virDomainNetReleaseActualDevice;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ec6b340308..08bb2f9ebc 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4573,7 +4573,7 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
return -1;
}
- if (STREQ_NULLABLE(net->model, "virtio")) {
+ if (virDomainNetHasVirtioModel(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 4a7c71d76d..0950197a44 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -322,8 +322,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
- if (net->model &&
- STREQ(net->model, "virtio") &&
+ if (virDomainNetHasVirtioModel(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 a1c3ca999b..2fdc71d07b 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 (virDomainNetHasVirtioModel(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..2cbb382b10 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 (virDomainNetHasVirtioModel(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 (virDomainNetHasVirtioModel(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 (virDomainNetHasVirtioModel(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 (!virDomainNetHasVirtioModel(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 64a425671d..3bd30bb417 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1241,7 +1241,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 (!virDomainNetHasVirtioModel(net))
continue;
}
needsvhost = true;
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index b300793732..729e8146b1 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 (!virDomainNetHasVirtioModel(net)) {
*vhostfdSize = 0;
return 0;
}
From patchwork Thu Jan 17 17:52: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: 155863
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257613jaa;
Thu, 17 Jan 2019 09:53:27 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5sQ3FAHxW5LTT/BT7N1tT9FCQ4ya+xutHKa/1BnaD7aYKlmCy7CcXti3JzWIh3eIcA75k/
X-Received: by 2002:a0c:872a:: with SMTP id 39mr12271189qvh.1.1547747607628;
Thu, 17 Jan 2019 09:53:27 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747607; cv=none;
d=google.com; s=arc-20160816;
b=i7I4G5ZL6Sq//33YODyqNju1GtoZyOK52jkZxrKXn+jxssGH+pB5eHcYnEkK2jqBXe
7eygA9KVKtMfc3nquhvgj/j2Qbm1WniX76Q2w8BqpKrpWhH2j+bKJMR9pu5htMhQj/dQ
yQHpdly0jHyApbsfgTDoaoLMP72yhc/LLj3WUj2hkPZ/uNZrDfDP84tu9pZUBqV9aMbv
roAjxG4QBfoHx/+KaQ60DPyFGGQaqBwo7YYedTtcN8G9cD7iyOffBkJnQQoZMThJrIdh
CwRnL1ghyAMPSMSi1RTR+GIZDq7dQiA4bZNRUX2lper6l99zvP4++tJIzvKEmizwlaTS
NYVw==
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=av8pDQf9PM9mUqUorgRaY82FqBn9P298D3CRNIWB6Z8=;
b=sFhV3zrF+gK/W9XG+q8mPCKGYI3xoERDTMebIESriljVEpuf+6x7SXApBMHTHR7OSh
eTDOqNoXvM4VXChXipEr9Vuuojz8FA2w0RzBjN4Pt+OXFODUZvXm1NRyW3nQ2xxmOCk6
fzya8J3GJ/Avj+uI+TTmttIi23Fj+DIzwby+iqPzXtc306KGwknJSX09zkbfg0wyY7eo
Yq2dxw2KyOIJRbg1GLHiPSkKqgI3yuEVDK+7g05vqDYXDWrAMBpPNmsNZjmL2jhb0uY/
V0kK+8ge9Ef1yVXypM2gLJEzuAuzLzu9vMi38u8A+TZTEcN+5JUZHfMSNVr6P6f0wRqI
S9Jw==
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
c185si3126738qkb.52.2019.01.17.09.53.27
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:27 -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 E49FDC0C115F;
Thu, 17 Jan 2019 17:53:25 +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 A56225D77A;
Thu, 17 Jan 2019 17:53:25 +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 5E48F180339B;
Thu, 17 Jan 2019 17:53:25 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrATH005502 for ;
Thu, 17 Jan 2019 12:53:10 -0500
Received: by smtp.corp.redhat.com (Postfix)
id E86AB600CC; Thu, 17 Jan 2019 17:53:10 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 6FCF6600C6;
Thu, 17 Jan 2019 17:53:10 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:32 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 05/18] 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.15
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.32]);
Thu, 17 Jan 2019 17:53:26 +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
(cherry picked from commit b6698b81846e2010e0cc030bcd6c2c549cf04e97)
---
src/conf/domain_conf.c | 4 +++-
src/qemu/qemu_capabilities.c | 6 ++++++
src/qemu/qemu_capabilities.h | 4 ++++
src/qemu/qemu_command.c | 17 +++++++++++++----
src/qemu/qemu_domain_address.c | 8 ++++++--
.../qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++
.../virtio-non-transitional.x86_64-3.1.0.args | 6 +++++-
.../virtio-non-transitional.x86_64-latest.args | 6 +++++-
.../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 ++++
.../virtio-non-transitional.xml | 12 +++++++++++-
.../qemuxml2xmloutdata/virtio-transitional.xml | 7 ++++++-
14 files changed, 77 insertions(+), 13 deletions(-)
--
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 4fc33c7e2f..9c68e41765 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29735,7 +29735,9 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface)
bool
virDomainNetHasVirtioModel(const virDomainNetDef *iface)
{
- return STREQ_NULLABLE(iface->model, "virtio");
+ return (STREQ_NULLABLE(iface->model, "virtio") ||
+ STREQ_NULLABLE(iface->model, "virtio-transitional") ||
+ STREQ_NULLABLE(iface->model, "virtio-non-transitional"));
}
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b7c0387f8e..44c4b890b9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -522,6 +522,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"nvdimm.unarmed",
"virtio-blk-pci-transitional",
"virtio-blk-pci-non-transitional",
+ "virtio-net-pci-transitional",
+
+ /* 330 */
+ "virtio-net-pci-non-transitional",
);
@@ -1112,6 +1116,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD },
{"virtio-blk-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_TRANSITIONAL},
{"virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL},
+ {"virtio-net-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_TRANSITIONAL},
+ {"virtio-net-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 34265d7cc0..1a92c00575 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -506,6 +506,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */
QEMU_CAPS_DEVICE_VIRTIO_BLK_TRANSITIONAL, /* -device virtio-blk-pci-transitional */
QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL, /* -device virtio-blk-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_NET_TRANSITIONAL, /* -device virtio-net-pci-transitional */
+
+ /* 330 */
+ QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL, /* -device virtio-net-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 608cd65806..d3b74211b7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -449,6 +449,7 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
virQEMUCapsPtr qemuCaps,
virDomainDeviceAddressType type,
int model,
+ const char *modelstr,
virDomainDeviceType devtype)
{
int tmodel_cap, ntmodel_cap;
@@ -464,10 +465,15 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_TRANSITIONAL;
ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_NET:
+ has_tmodel = STREQ(modelstr, "virtio-transitional");
+ has_ntmodel = STREQ(modelstr, "virtio-non-transitional");
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_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:
@@ -2136,7 +2142,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
case VIR_DOMAIN_DISK_BUS_VIRTIO:
if (qemuBuildVirtioTransitional(&opt, "virtio-blk", qemuCaps,
disk->info.type,
- disk->model,
+ disk->model, NULL,
VIR_DOMAIN_DEVICE_DISK) < 0)
goto error;
@@ -3741,8 +3747,11 @@ qemuBuildNicDevStr(virDomainDefPtr def,
bool usingVirtio = false;
char macaddr[VIR_MAC_STRING_BUFLEN];
- if (STREQ(net->model, "virtio")) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0)
+ if (virDomainNetHasVirtioModel(net)) {
+ if (qemuBuildVirtioTransitional(&buf, "virtio-net", qemuCaps,
+ net->info.type,
+ 0, net->model,
+ VIR_DOMAIN_DEVICE_NET) < 0)
goto error;
usingVirtio = true;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 0950197a44..654567c500 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -694,8 +694,12 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
return 0;
}
- if (STREQ(net->model, "virtio"))
- return virtioFlags;
+ if (STREQ(net->model, "virtio") ||
+ STREQ(net->model, "virtio-non-transitional"))
+ return virtioFlags;
+
+ if (STREQ(net->model, "virtio-transitional"))
+ return pciFlags;
if (STREQ(net->model, "e1000e"))
return pcieFlags;
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index 8cf9083035..137dcaf156 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -214,6 +214,8 @@
+
+ 30010500446361
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 9c5d553077..6eaf3086ef 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,scsi=off,bus=pci.1,addr=0x0,\
+-device virtio-blk-pci,disable-legacy=on,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,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 Thu Jan 17 17:52: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: 155868
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257757jaa;
Thu, 17 Jan 2019 09:53:35 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7LD8Hjl+yJPOQRxfksi7RNSiLJH7Co9iMJ70VxNkn8vvULyhbna2Cu/hs6v9HVmZcJxZ12
X-Received: by 2002:ac8:7493:: with SMTP id
v19mr12285452qtq.309.1547747615728;
Thu, 17 Jan 2019 09:53:35 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747615; cv=none;
d=google.com; s=arc-20160816;
b=J2oQryvRO4FqELJTEfzwoZ8RQPDQ/bS59YI5rJak+tZ9WaCR00Z7mP57ezsTPjvjzW
Uc729PuJOREvLdpu23NYK+rbkhFBqjT5k4rJKGu66Cw23SWRjf6HIUvaI3XAHRgyriE5
UoHILlxGw5VrWY4iltlKwDvxeTKjcYrEFx434NCFSjSt5d1xgzzhu5wHB9aqBvPwRoU7
QPen1fWqiYElUWM0OLh63zb7oesKqzMZtZlH/mmpX6zRooIQs6JsbRgdFf+hBVgbY0X1
8iU5J05SxcaV8Chm5fPZbMgLwb3VzQ0OPjylnne4oFCA5C3+J9UBUJNvRFrVVwo05UNl
1u+g==
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=4F3My+ChtYGsOUuaXjCZ4JaiW5TjTuQS/XAG8PViqw0=;
b=clr5p1Mmgb9Z7VwUx+G2cxTkPGhTkyL/xyWRFG+OsLUDWgKGQCmyLteS+pVsgbpWqb
tUKu1R35Uk3adv6Z+rn1wRK7d43brUvlgj1RKjQudY80Y6KmAgmFhBFESx13fOdAi2Ch
inyjyLEiI1/bmVrjo4FChq59XRrfgTtIuOcgsjlBD92Qn8VwTQQIOIrQbqpBlEPNj/rh
2R+WFhvCcStONzeHd6gQSbpPPqBOe7NG1EDfLEAY2AH8k9H9UdubedX8/VVcTg8e4YOw
WBqlIaj0brX1xM+sSvHlP7KkNq0XnOTk/m1CCBz66/nzzOLGG6AquLDoKq2XmTUHenga
R61g==
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
e126si9821425qkb.261.2019.01.17.09.53.35
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53: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-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 CD7477E9CB;
Thu, 17 Jan 2019 17:53:33 +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 9598F1048114;
Thu, 17 Jan 2019 17:53:33 +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 3E4323F60B;
Thu, 17 Jan 2019 17:53:33 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrB8k005512 for ;
Thu, 17 Jan 2019 12:53:11 -0500
Received: by smtp.corp.redhat.com (Postfix)
id BEEF2600CC; Thu, 17 Jan 2019 17:53:11 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 1E7CD600C6;
Thu, 17 Jan 2019 17:53:11 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:33 -0500
Message-Id: <14f1f820a928c6d5e4cca54d573f8857df9956df.1547746867.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 06/18] 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.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.26]);
Thu, 17 Jan 2019 17:53:34 +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
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 5 ++-
docs/schemas/domaincommon.rng | 9 +++++
src/conf/domain_conf.c | 37 ++++++++++++++++---
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, 95 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 29e4bb1bda..36dce863ac 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 425d7f851a..532a78ce32 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4626,6 +4626,15 @@
scsi_host
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9c68e41765..3776079e1d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -714,6 +714,13 @@ 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",
@@ -7597,6 +7604,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
@@ -7679,14 +7687,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 "
@@ -27093,6 +27113,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) {
@@ -27143,6 +27164,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 e3f4273b55..36ab544dd3 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 bd7e896654..60a193450b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -407,6 +407,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 6eaf3086ef..2eaa509c04 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,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,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 Thu Jan 17 17:52: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: 155871
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257831jaa;
Thu, 17 Jan 2019 09:53:40 -0800 (PST)
X-Google-Smtp-Source: ALg8bN77F14ikRJ6GvXVk6dkxXWZffBN11XTOxVto9aZAl70Cb/ranuPh7fiqasZzGo/jgdLSOSf
X-Received: by 2002:a0c:e905:: with SMTP id a5mr11922164qvo.181.1547747619944;
Thu, 17 Jan 2019 09:53:39 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747619; cv=none;
d=google.com; s=arc-20160816;
b=MoxuuhmAOsQkvmn+KzRUv1qR8j24TOpRVp/XREV4VkWxb9Jz1Q3aDF04zwLiAWMuu9
EqXpc8lRBnNrwMrjwCcK+QDkqcoAwmjRwd72DZPR26l2SahCQSOE+fRj5v3HKUlbpLAH
fPiPeCvqR19MYh5YEn84lRIhSZjwNTCKHCBPkxfAPw33EdGk779XvWfGn+evdSmJnje/
6GkeyjqD8H6nXVuSOJP6eF0nA1d7K5zXrScBLG5vLocADFkUNeCx5MgEwijjkrBm0RNz
VE8L6TN1/lg5psuCRpAiC6jx0rVwL+Cm7waOzQtuhHvFPZZdzfTly66XMCge/vxak7FK
dHYQ==
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=dM2071eFT/Oehmlwlt7f3K3T+zM8zAWQ/oNKeLd7xTQ=;
b=EOf4i5SWmMYJp7loixCi/0+yGdeo/I4xxsDPS8mlYTk4diRbYdScnA4wizJlBg7/4l
z7bXwCFiNkHC0Pc9Q9v7FZVSnUPgzgNuhtL2iKjIeKFjJoGL1ySv6u2M/A7i3pK3p5bg
/XKOGdK72FYJ0B2a37Mlhdn9hriQ5h0fvwW59086503edN0GlcM12dc3hR98fGVNboEh
tN1pAt6iCgVvvpI3nhJraYvLqi5sYqSR6I2siYUjC2itBNJGi51ZkFIUmqEC3mEEzHlJ
RGRFizR+0A7d5NJKyJIleTe/DGRowFIE3CkhO/tNAWMKtN7nan9dn638u/MDg52+8d1I
lCYA==
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
o89si10385089qvo.208.2019.01.17.09.53.39
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:39 -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 4C6B47AEA1;
Thu, 17 Jan 2019 17:53:38 +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 E9EF26014A;
Thu, 17 Jan 2019 17:53:37 +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 7180C18033A5;
Thu, 17 Jan 2019 17:53:37 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrCZD005519 for ;
Thu, 17 Jan 2019 12:53:12 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 55DA8600CC; Thu, 17 Jan 2019 17:53:12 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id E9226600C6;
Thu, 17 Jan 2019 17:53:11 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:34 -0500
Message-Id: <7a29cd9ffb8aa6df22e21965f38cf6949ad53cd4.1547746867.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 07/18] 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.11
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.25]);
Thu, 17 Jan 2019 17:53:39 +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_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 16 +++++++++++-----
src/qemu/qemu_domain_address.c | 8 +++++---
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++
.../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 +------
10 files changed, 32 insertions(+), 23 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_capabilities.c b/src/qemu/qemu_capabilities.c
index 44c4b890b9..70fc510cdb 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -526,6 +526,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
/* 330 */
"virtio-net-pci-non-transitional",
+ "vhost-scsi-pci-transitional",
+ "vhost-scsi-pci-non-transitional",
);
@@ -1118,6 +1120,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{"virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL},
{"virtio-net-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_TRANSITIONAL},
{"virtio-net-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL},
+ {"vhost-scsi-pci-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_TRANSITIONAL},
+ {"vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 1a92c00575..f213ad98cc 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -510,6 +510,8 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 330 */
QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL, /* -device virtio-net-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VHOST_SCSI_TRANSITIONAL, /* -device vhost-scsi-pci-transitional */
+ QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL, /* -device vhost-scsi-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d3b74211b7..7cdbd215a6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -471,13 +471,18 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_TRANSITIONAL;
ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ has_tmodel = model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL;
+ has_ntmodel = model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_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:
@@ -5038,10 +5043,11 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
goto cleanup;
}
- if (ARCH_IS_S390(def->os.arch))
- virBufferAddLit(&buf, "vhost-scsi-ccw");
- else
- virBufferAddLit(&buf, "vhost-scsi-pci");
+ if (qemuBuildVirtioTransitional(&buf, "vhost-scsi", qemuCaps,
+ dev->info->type,
+ hostsrc->model, NULL,
+ VIR_DOMAIN_DEVICE_HOSTDEV) < 0)
+ goto cleanup;
virBufferAsprintf(&buf, ",wwpn=%s,vhostfd=%s,id=%s",
hostsrc->wwpn,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 654567c500..c334ba441f 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -785,11 +785,13 @@ 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 follor 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) {
+ 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/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index 137dcaf156..c5079c4028 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -216,6 +216,8 @@
+
+ 30010500446361
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 2eaa509c04..5ab8560377 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 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,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,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 Thu Jan 17 17:52: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: 155864
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257621jaa;
Thu, 17 Jan 2019 09:53:27 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5r23n1w7ctU6JQseLAfAl2H0cRf7UeqTSeN1u88uJ7M651TJ0mVdzkv2s8+BsasKmuF5CV
X-Received: by 2002:aed:2342:: with SMTP id i2mr12758006qtc.341.1547747607735;
Thu, 17 Jan 2019 09:53:27 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747607; cv=none;
d=google.com; s=arc-20160816;
b=Qv81bwa8WGNWTK/yjdeARGxJcT91oDMzy61razmuAu8i6aQHKqXkPqV5VmbMmymwfV
Vcic1Wifg+9xLaU6eaYeL+LUYZGDthfgJL/TZ5FDduEPbmpsStn6fFoTN8C1GrMFbQ2H
9CzkSZ3nl6wAYK6dZojsRXPNXO2s7+1BJ/gYrV6vEwqeiNK1LM/TuD7WFw8ieMMKah50
sclpQWTMWruL7yGgGDiZrHIvRy+pdrZSWo5ULnUZ7Yen3bMrdjWgvS9SuImGSKMRHKem
TgYgKY6vyboiqWf8P701po4AhqAEBzQs0Bvf1b5KBMqGByaSVvOzSOLlhhg1qnmxXgTk
TxPg==
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=t9IuN0KJNtD/fABxdZnZpKiacBwRy5SeyxejmywiJc0=;
b=KzEsblWYiLIcXq3UFV9xpkDeFQhgFg5pHGVOTEIqXmWIcFTYIMDY8XHg9D58jknmwd
zsDs/HUEGaiv4fQ9RDRF0GazKUe5NbnoSPYdli0PoJQjIlJcLGNJgS4XpbTRdtRZkb+S
edZY62TuryYuyvdaPa19ygvLTXURiC5s1O/S9HV7HYOSmwWCjZNqByOT5S2PJxpFcjfp
DkKXHdVE7Yfd48FIbCWpBhk3k/347ZmdBsmXLGYN7HoZCtUSaEZFxZJbZymJ8PbNwnDd
ZJiUhso6YqihevMEZKm+UEBVsrEMtv4P3PkaFAXhkUpvFSce9QT2gcjFnUjYNZ4toKAj
Qdog==
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
43si1598126qvw.171.2019.01.17.09.53.27
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:27 -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 4920712F8E8;
Thu, 17 Jan 2019 17:53:26 +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 141461048114;
Thu, 17 Jan 2019 17:53: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 B9A361803398;
Thu, 17 Jan 2019 17:53:25 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrC4P005525 for ;
Thu, 17 Jan 2019 12:53:12 -0500
Received: by smtp.corp.redhat.com (Postfix)
id E04C4600CC; Thu, 17 Jan 2019 17:53:12 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 7D9FD600C6;
Thu, 17 Jan 2019 17:53:12 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:35 -0500
Message-Id: <28817417f19a1301bcc38ccb0ff893395b320137.1547746867.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 08/18] 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.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]);
Thu, 17 Jan 2019 17:53:26 +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 | 4 +++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 14 +++++++++++---
src/qemu/qemu_domain_address.c | 10 +++++++---
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++
.../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 +++
.../qemuxml2xmloutdata/virtio-non-transitional.xml | 9 +++++++++
tests/qemuxml2xmloutdata/virtio-transitional.xml | 4 ++++
17 files changed, 68 insertions(+), 8 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 36dce863ac..04e6dc2721 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 532a78ce32..040fa29914 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5451,7 +5451,11 @@
- virtio
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3776079e1d..cc48599dd1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -858,7 +858,9 @@ 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 36ab544dd3..dc49cbe4d9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2125,6 +2125,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_capabilities.c b/src/qemu/qemu_capabilities.c
index 70fc510cdb..0241353006 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -528,6 +528,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"virtio-net-pci-non-transitional",
"vhost-scsi-pci-transitional",
"vhost-scsi-pci-non-transitional",
+ "virtio-rng-pci-transitional",
+ "virtio-rng-pci-non-transitional",
);
@@ -1122,6 +1124,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{"virtio-net-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL},
{"vhost-scsi-pci-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_TRANSITIONAL},
{"vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL},
+ {"virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL},
+ {"virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index f213ad98cc..b01578d88a 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -512,6 +512,8 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DEVICE_VIRTIO_NET_NON_TRANSITIONAL, /* -device virtio-net-pci-non-transitional */
QEMU_CAPS_DEVICE_VHOST_SCSI_TRANSITIONAL, /* -device vhost-scsi-pci-transitional */
QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL, /* -device vhost-scsi-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL, /* -device virtio-blk-rng-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL, /* -device virtio-rng-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7cdbd215a6..73f145dcd7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -477,6 +477,12 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
tmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_TRANSITIONAL;
ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_RNG:
+ has_tmodel = model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL;
+ break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
@@ -496,7 +502,6 @@ qemuBuildVirtioTransitional(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:
@@ -5990,7 +5995,7 @@ qemuBuildRNGDevStr(const virDomainDef *def,
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- if (dev->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
+ 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'"),
@@ -6002,7 +6007,10 @@ qemuBuildRNGDevStr(const virDomainDef *def,
dev->source.file))
goto error;
- if (qemuBuildVirtioDevStr(&buf, "virtio-rng", dev->info.type) < 0)
+ if (qemuBuildVirtioTransitional(&buf, "virtio-rng", qemuCaps,
+ dev->info.type,
+ dev->model, NULL,
+ VIR_DOMAIN_DEVICE_RNG) < 0)
goto error;
virBufferAsprintf(&buf, ",rng=obj%s,id=%s",
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index c334ba441f..a5491a1c0e 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -366,7 +366,9 @@ 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 &&
+ if ((def->rngs[i]->model == VIR_DOMAIN_RNG_MODEL_VIRTIO ||
+ def->rngs[i]->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL ||
+ def->rngs[i]->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL) &&
def->rngs[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
def->rngs[i]->info.type = type;
}
@@ -861,7 +863,10 @@ 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:
+ return pciFlags;
case VIR_DOMAIN_RNG_MODEL_LAST:
return 0;
@@ -2290,8 +2295,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
/* VirtIO RNG */
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/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index c5079c4028..e54fe53590 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -218,6 +218,8 @@
+
+ 30010500446361
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 5ab8560377..a3c81828c0 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,scsi=off,bus=pci.2,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -36,6 +37,9 @@ 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,disable-legacy=on,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,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 Thu Jan 17 17:52: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: 155866
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257693jaa;
Thu, 17 Jan 2019 09:53:32 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5w+UzpA1CuG/o9lV7ywd1bqcQp04Luro4Jhxvcg/GY60315Ti916ZN+J9SmVJZSOx0F2m/
X-Received: by 2002:a37:96c2:: with SMTP id
y185mr11241015qkd.239.1547747612604;
Thu, 17 Jan 2019 09:53:32 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747612; cv=none;
d=google.com; s=arc-20160816;
b=UvKZlUfEbUefoYElbSRg4tGjct2Saog6Wxsem0iwTKRqAXbjG8ZX6/uZIADYIF9JBH
daJtRPLKH0KpMeZh9tSU1nuMnSkytIwUQJenW5qs7f9+t8ldiMibrwb5ejIWk4Zwub3w
caQAs1DaCOaS1cv01bpoFSeEDiDvN5K4m8BoHwJbqux1hExnTN5r6kX/3dyVn2F3nQhy
9qVgSF+Mkevv4nZCtbWoOAnXRAIVhi3R94gxbQGQkVFqYgU6WLtXYHssJOAg2D0wvS2J
JEob8qu6YTaUtzmYvV1DAQNl+dmIHq+cZg63vJtaKIrT/vfd6a06RjZ+WrtzFfKSO077
TpgQ==
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=N3GJMF49OvJMYKDt+HoJONPbvwFo4fixAdhbQo8j+x8=;
b=o7aCUdsQ5H52N+4P7fkaks+fsJCDQIDLwWhmPQKMmhkmBl5DkQYbFoYjBzhfrJtmzh
coj9YZKOikWEv27Ldm2MrN4cnPThzEcZTLPVIIdO/UWZm7wBEObizQ7pt0F/OurXxZ6H
mzNbscPxdOLg7UuNZ4cy/B8e7goH8Oylsg3uLL9FSLEDqqf8t25avnPD6pNxn9YhALPx
NlMuvnOtd0sWNDck+viXh83PFMSGBJ3JXGXf33zxc2gFkrX0VcHXNFWs6jlYFH2PmiAp
3l1C4XuuYLpyoU5UB5URTxPIs+JiSgfZV8/Y05mCYe7WZiPHOrqz989JiRba6RV8E7gk
sMrg==
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
s34si3204983qtb.17.2019.01.17.09.53.32
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:32 -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 D2B0688E7E;
Thu, 17 Jan 2019 17:53:30 +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 9533F6149F;
Thu, 17 Jan 2019 17:53:30 +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 3EC8C3F606;
Thu, 17 Jan 2019 17:53:30 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrDSM005534 for ;
Thu, 17 Jan 2019 12:53:13 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 7ADE7600CC; Thu, 17 Jan 2019 17:53:13 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 15426600C6;
Thu, 17 Jan 2019 17:53:12 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:36 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 09/18] 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.25]);
Thu, 17 Jan 2019 17:53:31 +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. This just adds the domain_conf wiring
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 +++
docs/schemas/domaincommon.rng | 9 ++++++
src/conf/domain_conf.c | 32 +++++++++++++++++--
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, 126 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 04e6dc2721..a2a0757b95 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-transitional", "virtio-non-transitional", or
+ "virtio" which matches the default behavior of the QEMU driver.
driver
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 040fa29914..dc570b78b8 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2498,6 +2498,15 @@
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cc48599dd1..16594a302e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -408,6 +408,12 @@ VIR_ENUM_IMPL(virDomainFSWrpolicy, VIR_DOMAIN_FS_WRPOLICY_LAST,
"default",
"immediate")
+VIR_ENUM_IMPL(virDomainFSModel, VIR_DOMAIN_FS_MODEL_LAST,
+ "default",
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional")
+
VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
"user",
"ethernet",
@@ -10626,6 +10632,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
char *wrpolicy = NULL;
char *usage = NULL;
char *units = NULL;
+ char *model = NULL;
ctxt->node = node;
@@ -10654,6 +10661,15 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH;
}
+ model = virXMLPropString(node, "model");
+ if (model) {
+ if ((def->model = virDomainFSModelTypeFromString(model)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown model '%s'"), model);
+ goto error;
+ }
+ }
+
if (virDomainParseScaledValue("./space_hard_limit[1]",
NULL, ctxt, &def->space_hard_limit,
1, ULLONG_MAX, false) < 0)
@@ -10782,6 +10798,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_FREE(usage);
VIR_FREE(units);
VIR_FREE(format);
+ VIR_FREE(model);
return def;
@@ -21889,6 +21906,12 @@ virDomainFsDefCheckABIStability(virDomainFSDefPtr src,
return false;
}
+ if (src->model != dst->model) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target filesystem model does not match source"));
+ return false;
+ }
+
if (src->virtio && dst->virtio &&
!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
return false;
@@ -24693,10 +24716,15 @@ virDomainFSDefFormat(virBufferPtr buf,
goto cleanup;
}
-
virBufferAsprintf(buf,
- "\n",
+ "model) {
+ virBufferAsprintf(buf, " model='%s'",
+ virDomainFSModelTypeToString(def->model));
+ }
+ virBufferAddLit(buf, ">\n");
+
virBufferAdjustIndent(buf, 2);
if (def->fsdriver) {
virBufferAsprintf(&driverBuf, " type='%s'", fsdriver);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index dc49cbe4d9..cebe8768cd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -903,12 +903,22 @@ typedef enum {
VIR_DOMAIN_FS_WRPOLICY_LAST
} virDomainFSWrpolicy;
+typedef enum {
+ VIR_DOMAIN_FS_MODEL_DEFAULT = 0,
+ VIR_DOMAIN_FS_MODEL_VIRTIO,
+ VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL,
+
+ VIR_DOMAIN_FS_MODEL_LAST
+} virDomainFSModel;
+
struct _virDomainFSDef {
int type;
int fsdriver; /* enum virDomainFSDriverType */
int accessmode; /* enum virDomainFSAccessMode */
int wrpolicy; /* enum virDomainFSWrpolicy */
int format; /* virStorageFileFormat */
+ int model; /* virDomainFSModel */
unsigned long long usage; /* in bytes */
virStorageSourcePtr src;
char *dst;
@@ -3445,6 +3455,7 @@ VIR_ENUM_DECL(virDomainFS)
VIR_ENUM_DECL(virDomainFSDriver)
VIR_ENUM_DECL(virDomainFSAccessMode)
VIR_ENUM_DECL(virDomainFSWrpolicy)
+VIR_ENUM_DECL(virDomainFSModel)
VIR_ENUM_DECL(virDomainNet)
VIR_ENUM_DECL(virDomainNetBackend)
VIR_ENUM_DECL(virDomainNetVirtioTxMode)
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 a3c81828c0..a7b663a728 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
@@ -29,16 +29,19 @@ addr=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 \
+-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,disable-legacy=on,scsi=off,bus=pci.2,addr=0x0,\
+-device virtio-blk-pci,disable-legacy=on,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,netdev=hostnet0,id=net0,\
-mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
+mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.3,addr=0x0 \
+id=hostdev0,bus=pci.4,addr=0x0 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,disable-legacy=on,rng=objrng0,id=rng0,bus=pci.4,\
+-device virtio-rng-pci,disable-legacy=on,rng=objrng0,id=rng0,bus=pci.5,\
addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index a0fc475c2f..e454eeadbd 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -29,16 +29,19 @@ addr=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 \
+-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
-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,\
+-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,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.1,addr=0x0 \
+mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.3,addr=0x0 \
+id=hostdev0,bus=pci.4,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 \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.5,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 2075ccbf57..df19c1b540 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -22,6 +22,10 @@
/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 dc830d21b1..6f07d5b707 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -25,18 +25,21 @@ 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-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=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \
+-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,\
+-device virtio-blk-pci,scsi=off,bus=pci.3,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
+-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \
-netdev user,id=hostnet0 \
--device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.3,\
addr=0x1 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.2,addr=0x3 \
+bus=pci.3,addr=0x3 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.3,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 64fb4153fd..43c1cafd45 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -25,18 +25,21 @@ 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-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=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \
+-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,\
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.3,addr=0x2,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \
-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 \
+mac=00:11:22:33:44:55,bus=pci.3,addr=0x1 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.2,addr=0x3 \
+id=hostdev0,bus=pci.3,addr=0x3 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.3,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 82535c84d6..1ee560212c 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -22,6 +22,10 @@
/dev/urandom
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 4a315050ab..18ef85092a 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -50,21 +50,31 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
/dev/urandom
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index ae3789ad93..6e18c1c301 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -30,30 +30,40 @@
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
-
+
-
+
/dev/urandom
-
+
From patchwork Thu Jan 17 17:52: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: 155874
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257936jaa;
Thu, 17 Jan 2019 09:53:45 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4HQk+ysiy5wRMmgKZuhi8y9q4sEkf9+e88fhCDVNrHKHf5eionh6n8ULEbMhgJ3f//EzDm
X-Received: by 2002:ac8:2eb8:: with SMTP id h53mr12394428qta.18.1547747625645;
Thu, 17 Jan 2019 09:53:45 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747625; cv=none;
d=google.com; s=arc-20160816;
b=GVBfTdwF1GHePdhaSbdPiCC2LH61OZhT61LAYuaSK9mPvFDdBdKD6v1gD26Ypu6fWA
Mtu5FUWZW+8//vQseoC4Jxtp5BELxFsAas6eOcCStMVhmcL8o3O7bygdNISGQ3u4AJIs
zt/Xb566HOeaNGvH5C82BpXBzx61xHKMjikL7rm4yGAUTGMP3HebEwNN2dui5m214TUO
RitOCuvPzHdmVM7++NB2riaOf914+DKsWaq8u9YiHBDl+ABw7xp0oQ80/On75I2J18oP
TMu0iMaGSjnUydqzplMdRe/VQ59vzcZpKhi/l88cpoce0iJSncZSPMqfyA3IW3dIS8GC
LACw==
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=rrNxz1EHKkQh3DHOIOA5lJL6fMXe9uKBbqQUQFFHoIQ=;
b=dMClBqWR0PgihzlRoxNNQ8lnHC3ANy4GmS6IwXuh7bqS7cvIgwWUCEDkGdPJiHgxJZ
B9H5qCT2xWi3HNdOR4Muymx1qd6DenAIJm8xZb+58jioGmNmhJdeQYGKLstlCiNcN/tz
X6zAFlfAewrxIrTIhLJstZNymp9npNR1MkF9UN6fWZ5Fx41YdaJviZtrfCrJBRYTfj2F
UDJlMmEnZUO/xC3UQCDbykRDD9to3fSp52+wrDQYCY6w81zVfKR57jdUlLFWI9hW9fVf
8Nk/TOTpGhgNXpDk/n6mWshu71NqdeKmF4BUdRxXLYESTE8e904nhQ9/BFWmcjbuSpD7
oiwA==
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
v60si6324158qtd.31.2019.01.17.09.53.45
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:45 -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 A5FD38AE45;
Thu, 17 Jan 2019 17:53:42 +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 D70A91048118;
Thu, 17 Jan 2019 17:53:41 +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 897F218033AA;
Thu, 17 Jan 2019 17:53:41 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrEZA005545 for ;
Thu, 17 Jan 2019 12:53:14 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 1136F600CC; Thu, 17 Jan 2019 17:53:14 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id A588D600C6;
Thu, 17 Jan 2019 17:53:13 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:37 -0500
Message-Id: <95116e9e597f703acd654bdae2c6411fb20084e5.1547746867.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 10/18] qemu: Support filesystem
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.25]);
Thu, 17 Jan 2019 17:53:44 +0000 (UTC)
Add model handling for virtio transitional devices. Ex:
...
---
src/qemu/qemu_capabilities.c | 6 +++++
src/qemu/qemu_capabilities.h | 4 ++++
src/qemu/qemu_command.c | 12 ++++++++--
src/qemu/qemu_domain_address.c | 3 ++-
.../caps_4.0.0.x86_64.xml | 2 ++
.../virtio-non-transitional.x86_64-3.1.0.args | 3 ++-
...virtio-non-transitional.x86_64-latest.args | 3 ++-
.../virtio-transitional.x86_64-3.1.0.args | 17 +++++++-------
.../virtio-transitional.x86_64-latest.args | 16 ++++++-------
.../virtio-transitional.xml | 23 ++++++++-----------
10 files changed, 53 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_capabilities.c b/src/qemu/qemu_capabilities.c
index 0241353006..2f54b2c81b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -530,6 +530,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"vhost-scsi-pci-non-transitional",
"virtio-rng-pci-transitional",
"virtio-rng-pci-non-transitional",
+
+ /* 335 */
+ "virtio-9p-pci-transitional",
+ "virtio-9p-pci-non-transitional",
);
@@ -1126,6 +1130,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{"vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL},
{"virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL},
{"virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL},
+ {"virtio-9p-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL},
+ {"virtio-9p-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index b01578d88a..fef94883c9 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -515,6 +515,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL, /* -device virtio-blk-rng-transitional */
QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL, /* -device virtio-rng-pci-non-transitional */
+ /* 335 */
+ QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL, /* -device virtio-9p-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL, /* -device virtio-9p-pci-non-transitional */
+
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 73f145dcd7..56d52e1d7e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -483,9 +483,14 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL;
ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_FS:
+ has_tmodel = model == VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = model == VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_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:
@@ -2742,7 +2747,10 @@ qemuBuildFSDevStr(const virDomainDef *def,
goto error;
}
- if (qemuBuildVirtioDevStr(&opt, "virtio-9p", fs->info.type) < 0)
+ if (qemuBuildVirtioTransitional(&opt, "virtio-9p", qemuCaps,
+ fs->info.type,
+ fs->model, NULL,
+ VIR_DOMAIN_DEVICE_FS) < 0)
goto error;
virBufferAsprintf(&opt, ",id=%s", fs->info.alias);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index a5491a1c0e..b7a1cbe2d1 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -681,7 +681,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
break;
case VIR_DOMAIN_DEVICE_FS:
- /* the only type of filesystem so far is virtio-9p-pci */
+ if (dev->data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL)
+ return pciFlags;
return virtioFlags;
case VIR_DOMAIN_DEVICE_NET: {
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index e54fe53590..1de12a9828 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -220,6 +220,8 @@
+
+ 30010500446361
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 a7b663a728..60c84bee29 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,7 +34,8 @@ addr=0x1 \
-device virtio-blk-pci,disable-legacy=on,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
--device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
+-device virtio-9p-pci,disable-legacy=on,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
+bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index e454eeadbd..8c571c04f1 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -34,7 +34,8 @@ addr=0x1 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
--device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
+-device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
+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 \
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 6f07d5b707..8fbeb6e937 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -25,21 +25,20 @@ 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.3,bus=pci.1,addr=0x0 \
--device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
+-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.3,addr=0x2,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
--device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \
--device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.3,\
-addr=0x1 \
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
+addr=0x2 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.3,addr=0x3 \
+bus=pci.2,addr=0x4 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \
-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 43c1cafd45..eb8da465f6 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -25,21 +25,21 @@ 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.3,bus=pci.1,addr=0x0 \
--device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
+-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.3,addr=0x2,\
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
--device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \
+-device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
+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.3,addr=0x1 \
+mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.3,addr=0x3 \
+id=hostdev0,bus=pci.2,addr=0x4 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \
-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 6e18c1c301..334cfaa6e4 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -30,40 +30,35 @@
-
-
-
-
-
-
+
-
+
-
-
+
+
-
+
-
+
-
+
/dev/urandom
-
+
From patchwork Thu Jan 17 17:52: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: 155870
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257814jaa;
Thu, 17 Jan 2019 09:53:38 -0800 (PST)
X-Google-Smtp-Source: ALg8bN6FkBZCPmRqIqMw8IVe52VNWw5u1iYePD1G019ul69WXhFzg4X2h6MBs6DtKzM47SCvMMdD
X-Received: by 2002:ac8:1b82:: with SMTP id z2mr12651289qtj.321.1547747618562;
Thu, 17 Jan 2019 09:53:38 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747618; cv=none;
d=google.com; s=arc-20160816;
b=eWZRFbZzzT52nxl0OWxGqfH3odV/x+xfVVj6heQOfuVnUvearQU/pa88TXBEuvg8Bi
oBoirI/xtUkEOV643gYZzTAR96DoUPUVfrUIfzxKki6rMtwqkJwZ5ucSCxGzMQV1TW8j
IPLN1SFU/OVBil7HkXPF80eEcIZcJ23btJG7rJCxDcDHwDUxBumG7nN48hcRGgHyy3Wk
+pY1HxLtrbU6WC6v6oiV2b+2x5Gu8L/LuK3UeeuGqm2DLzG84ECQ8zz9gTJ/qzWBqfBz
D2gUIrAsy755MGeoP9OBGLJbzcxEKWHs0QwCBRq8eXGxiXz1XeA7Xl7OTDkBh1HKLkUm
ImGw==
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=olzPSRtXzCI6uo4AKWT/NQTM1xeO0vjJK2WL8z+ahBg=;
b=sMrpeCNE3hGGiI2vyl8cUdjioYNw8xLbWCCeMRNPTMXotgSb0lx+7U7lmUHW/GgPOL
hprU9qpZM5gdhOPJzy2pdayM/2u7pEDLr5lyjGUyjM9+4qu4ZhBMpKYjo+6g8k+fciVb
PXjHeqNnVzMRHoA1xmVdcJlurELUeevn4kLGfAd9iW3KkfjMatJSl3DR6B+jNGuf/jFY
fFRj4VC/7Yx32pDgvrq9qVUUW1U/ji/2kNHAQam9RdlYX+txPPherUOXBbTQKeXPFjvT
syLaKXXw+eiqb/HFfWCgmP4hs3CspqcMORx8h2IM0Pl+Q2Z+l4odeh9DGOkZAbinUXBT
pv1A==
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
i127si5636048qkd.79.2019.01.17.09.53.38
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:38 -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 1A3271326B7;
Thu, 17 Jan 2019 17:53: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 CF5E15ED52;
Thu, 17 Jan 2019 17:53: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 88E19180BAAC;
Thu, 17 Jan 2019 17:53:34 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrEQc005555 for ;
Thu, 17 Jan 2019 12:53:14 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 9C518600D6; Thu, 17 Jan 2019 17:53:14 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 3C784600C6;
Thu, 17 Jan 2019 17:53:14 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:38 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 11/18] qemu: Move memballoon validation out of
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.38]);
Thu, 17 Jan 2019 17:53:37 +0000 (UTC)
If we validate that memballoon is NONE or VIRTIO earlier,
we can simplify some checks in some driver APIs
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 17 -----------------
src/qemu/qemu_domain.c | 35 +++++++++++++++++++++++++++++++++-
src/qemu/qemu_domain_address.c | 3 +--
src/qemu/qemu_driver.c | 9 +++------
src/qemu/qemu_process.c | 3 +--
5 files changed, 39 insertions(+), 28 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 56d52e1d7e..07fa2b9209 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4160,20 +4160,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;
@@ -4184,12 +4173,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 08bb2f9ebc..d2c792e415 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3404,6 +3404,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,
@@ -5888,6 +5892,32 @@ 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)
@@ -5996,11 +6026,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 b7a1cbe2d1..09e0ce12c4 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -360,8 +360,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
def->hostdevs[i]->info->type = type;
}
- if (def->memballoon &&
- def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ if (virDomainDefHasMemballoon(def) &&
def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
def->memballoon->info.type = type;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1d961707cc..949c09aba4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2436,8 +2436,7 @@ 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"));
@@ -2460,8 +2459,7 @@ 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"));
@@ -11947,8 +11945,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 aad6c12552..54abd9170a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7564,8 +7564,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 Thu Jan 17 17:52: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: 155867
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257699jaa;
Thu, 17 Jan 2019 09:53:32 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7K3E8p/FT3+eAfbpLC+m1yZG+17xgGtDCTuGsfjaiSrBzlVR5ZbKhlsrkUkwAGyl7SM39F
X-Received: by 2002:ae9:e804:: with SMTP id a4mr11535057qkg.99.1547747612787;
Thu, 17 Jan 2019 09:53:32 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747612; cv=none;
d=google.com; s=arc-20160816;
b=JPlomTTYsz9Lm2Dni6OYBSdwtNWuMlTuLOKXzRVvrQgNPourxQd5JUgKXgehaSYqPf
PESER5E7MkHpWtjJv+4FVboXnKLg7hiIhs52yhg+phrCeHld2fbFpS/hRaYA2Jh7CdLe
g1uKaBWrUMPC0mn022REPpH08hVrRmrdVL79Z/ai6kwN/KhNdi5SBFnmmo9lkA79EETw
+qCSNXnu9b6Wx9vq837fQ7fsSH/q9bs2ElrXb91yeLSMQZItzbJ2RM5BiXA0VcC4MCLe
S4P1oYgUHr5ESB868ajJ1QCimyGaxKXa4HvrjAeOYximaDf/G7/P2XOu9BVVIFAurovF
7rGQ==
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=3YM1riqBHH8xQ0BD6fXJ8D2m/AuzoQg3zBlBIbHFYvM=;
b=Q7TsFYk51mwnpNKsCxq3Z1OAaj9EUmFyVQ2j8rWEH4fsNmdtGio5lSyC1/wnMb/6J1
KD2o4EmeQ+/ZjkMNXc6CXb3kAg0TVQzIJzioEMsN0IoOY0DitnXo4Jb3F4qG44tKCiSa
tVnX1kYYmWqs5iC3o2lzH1cLOpgrFIwyTKQD70rCmNrtKY9Bo/do3Om3SHA69JdmGa6+
ysgC0PpyHpR4yRmMcVGSpM3Yk9P9C/cOgKHAAnqUoY8fNYDXL4ChzyPcUH0lhKInumw8
7IRgXHSchKRgy9WpqBipe7zOjyjirxehHPBw2mWH0SmEgG0vtDuvnTOEjk3zt3rzTNgX
5L0g==
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
r29si1134638qtr.290.2019.01.17.09.53.32
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:32 -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 71FE9A0E58;
Thu, 17 Jan 2019 17:53:30 +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 3BB84105B21A;
Thu, 17 Jan 2019 17:53:30 +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 D51EA180339E;
Thu, 17 Jan 2019 17:53:29 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrFC0005560 for ;
Thu, 17 Jan 2019 12:53:15 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 31A34600CC; Thu, 17 Jan 2019 17:53:15 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id C68E7600C6;
Thu, 17 Jan 2019 17:53:14 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:39 -0500
Message-Id: <6f5ba43ddda6a8b9827652db1e7fe06bf6efa96b.1547746868.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 12/18] qemu: Support memballoon
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.28]);
Thu, 17 Jan 2019 17:53:31 +0000 (UTC)
Add new model values for virtio transitional devices. Ex:
* "virtio-transitional" maps to qemu "virtio-balloon-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-balloon-pci-non-transitional"
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 2 ++
docs/schemas/domaincommon.rng | 2 ++
src/conf/domain_conf.c | 4 +++-
src/conf/domain_conf.h | 2 ++
src/libxl/libxl_conf.c | 2 ++
src/qemu/qemu_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 13 ++++++++++---
src/qemu/qemu_domain.c | 4 +++-
src/qemu/qemu_domain_address.c | 6 ++++--
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++
.../virtio-non-transitional.x86_64-3.1.0.args | 4 +++-
.../virtio-non-transitional.x86_64-latest.args | 4 +++-
tests/qemuxml2argvdata/virtio-non-transitional.xml | 2 +-
.../virtio-transitional.x86_64-3.1.0.args | 3 ++-
.../virtio-transitional.x86_64-latest.args | 3 ++-
tests/qemuxml2argvdata/virtio-transitional.xml | 2 +-
.../qemuxml2xmloutdata/virtio-non-transitional.xml | 11 +++++++++--
tests/qemuxml2xmloutdata/virtio-transitional.xml | 6 ++++--
19 files changed, 61 insertions(+), 17 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 a2a0757b95..e8e255f361 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7902,6 +7902,8 @@ qemu-kvm -net nic,model=? /dev/null
'virtio' - default with QEMU/KVM
+
'virtio-transitional'
+
'virtio-non-transitional'
'xen' - default with Xen
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index dc570b78b8..a35f802960 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4091,6 +4091,8 @@
virtioxennone
+ virtio-transitional
+ virtio-non-transitional
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 16594a302e..b3baacf345 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -550,7 +550,9 @@ VIR_ENUM_IMPL(virDomainKeyWrapCipherName,
VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
"virtio",
"xen",
- "none")
+ "none",
+ "virtio-transitional",
+ "virtio-non-transitional")
VIR_ENUM_IMPL(virDomainSmbiosMode, VIR_DOMAIN_SMBIOS_LAST,
"none",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cebe8768cd..ce3255113e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1731,6 +1731,8 @@ typedef enum {
VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
+ VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL,
VIR_DOMAIN_MEMBALLOON_MODEL_LAST
} virDomainMemballoonModel;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 73e988a3dc..4102a940b9 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -718,6 +718,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
break;
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
+ case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL:
+ case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported balloon device model '%s'"),
virDomainMemballoonModelTypeToString(model));
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2f54b2c81b..59e96887df 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -534,6 +534,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
/* 335 */
"virtio-9p-pci-transitional",
"virtio-9p-pci-non-transitional",
+ "virtio-balloon-pci-transitional",
+ "virtio-balloon-pci-non-transitional",
);
@@ -1132,6 +1134,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{"virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL},
{"virtio-9p-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL},
{"virtio-9p-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL},
+ {"virtio-balloon-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_TRANSITIONAL},
+ {"virtio-balloon-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index fef94883c9..cd2a5d186c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -518,6 +518,8 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 335 */
QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL, /* -device virtio-9p-pci-transitional */
QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL, /* -device virtio-9p-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BALLOON_TRANSITIONAL, /* -device virtio-balloon-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BALLOON_NON_TRANSITIONAL, /* -device virtio-balloon-pci-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 07fa2b9209..dd4c2507c5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -489,6 +489,12 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL;
ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ has_tmodel = model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BALLOON_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BALLOON_NON_TRANSITIONAL;
+ break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT:
@@ -502,7 +508,6 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
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:
@@ -4163,8 +4168,10 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
if (!virDomainDefHasMemballoon(def))
return 0;
- if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
- def->memballoon->info.type) < 0) {
+ if (qemuBuildVirtioTransitional(&buf, "virtio-balloon", qemuCaps,
+ def->memballoon->info.type,
+ def->memballoon->model, NULL,
+ VIR_DOMAIN_DEVICE_MEMBALLOON) < 0) {
goto error;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d2c792e415..6d54727a31 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5900,7 +5900,9 @@ qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *memballoon,
memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)
return 0;
- if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+ if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL &&
+ memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Memory balloon device type '%s' is not supported by this version of qemu"),
virDomainMemballoonModelTypeToString(memballoon->model));
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 09e0ce12c4..8c5c5f0477 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -851,7 +851,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_MEMBALLOON:
switch ((virDomainMemballoonModel) dev->data.memballoon->model) {
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
+ case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL:
return virtioFlags;
+ case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL:
+ return pciFlags;
case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
case VIR_DOMAIN_MEMBALLOON_MODEL_NONE:
@@ -2284,8 +2287,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
}
/* VirtIO balloon */
- if (def->memballoon &&
- def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ if (virDomainDefHasMemballoon(def) &&
virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) {
if (qemuDomainPCIAddressReserveNextAddr(addrs,
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index 1de12a9828..3461d32151 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -222,6 +222,8 @@
+
+ 30010500446361
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 60c84bee29..71a044cd56 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
@@ -30,6 +30,7 @@ addr=0x1 \
-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 \
-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
+-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,disable-legacy=on,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -41,8 +42,9 @@ bus=pci.1,addr=0x0 \
mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.4,addr=0x0 \
+-device virtio-balloon-pci,disable-legacy=on,id=balloon0,bus=pci.5,addr=0x0 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,disable-legacy=on,rng=objrng0,id=rng0,bus=pci.5,\
+-device virtio-rng-pci,disable-legacy=on,rng=objrng0,id=rng0,bus=pci.6,\
addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 8c571c04f1..dbf7a4ef15 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -30,6 +30,7 @@ addr=0x1 \
-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 \
-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
+-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -41,8 +42,9 @@ bus=pci.1,addr=0x0 \
mac=00:11:22:33:44:55,bus=pci.2,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 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,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 df19c1b540..e307c0491f 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -27,6 +27,6 @@
-
+
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 8fbeb6e937..c35e73ec45 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -37,8 +37,9 @@ id=virtio-disk0,bootindex=1 \
addr=0x2 \
-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 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
-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 eb8da465f6..77332549bf 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -38,8 +38,9 @@ bus=pci.2,addr=0x1 \
mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-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 \
-object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
-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 1ee560212c..b656f69191 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -27,6 +27,6 @@
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 18ef85092a..721dccbaef 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -55,6 +55,11 @@
+
+
+
+
+
@@ -71,10 +76,12 @@
-
+
+
+ /dev/urandom
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index 334cfaa6e4..2402c5f227 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -55,10 +55,12 @@
-
+
+
+ /dev/urandom
-
+
From patchwork Thu Jan 17 17:52: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: 155869
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257796jaa;
Thu, 17 Jan 2019 09:53:37 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7TcahNCWq9g1dGQt9JvUw6yJFxnxs1/mixPgFfO/ASB4X8wjipdcOtdm1m8mIdqlwrNUM8
X-Received: by 2002:a0c:ba24:: with SMTP id w36mr12194624qvf.60.1547747617859;
Thu, 17 Jan 2019 09:53:37 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747617; cv=none;
d=google.com; s=arc-20160816;
b=igRLGj5q/si3gHbrRtrHouEjxNnsIqOi0gBJS1lmDYSfN382nTU9SI0ojiV7Yv6FeZ
j59OCn6rOhyv99dAKtuzJBMX5VhS8xSzE7wge3WcpYcvAAUZ/9Luj6Mf+WKdsKwD2s0V
2WsOC96DRyvXfq5yEtUS54iXXPcCMHDvguu61QTICpHRqmYu1Y2IgesEM5GcH8xwYpn6
iF2ymeBju+6mlzO4XrWOBYBdG4rjJ6fskHmfX7MbyP3voYhUZiU8tlja+/a8bAAfNJsD
T1Pjd10rsKOFVp3di1/ULjLwhkAzPMM1x7JKWBXLvSVcHO776LP/eOveCFh++VMe1gdf
HMRw==
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=3JgGDK6ILz+aKdbaLRyL1fD7tVvAXdFokNYkIb3EN6E=;
b=DS0mevbpUkK5m49uFMc8RAG2h6b/2xTYdBlASoKAYFLDSWn9Gj5Bf0KG6EgYDqUTLU
ceVtewSU6Q7FpwvGb05n4aaLTNI7AIHsbBvAqJotfOl4jg5KWM6+VhNeTHcl/ymPHpyK
rwXVkEZ68XnO16cFaGBuu1sUbGZmTzOWQmBhvHiBhl+K6vDmaQUhf/orjuB66VIKn2Sv
JoO0DpEJxRf8z//BJNxV3ok8knHyqyIDTpqMeCwN19Wuwn26MhoinVIdX0sR6FS2NoqF
Xfmc+NTRxqxlBKm3oV1MJIupmbifXKXbbPwthDlPH6waplIsreHHgXZtUjZbX4D8r60h
T10w==
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
t11si4179225qki.223.2019.01.17.09.53.37
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53: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-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 3810819CF22;
Thu, 17 Jan 2019 17:53: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 F06A760BF1;
Thu, 17 Jan 2019 17:53: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 AC9D118033EC;
Thu, 17 Jan 2019 17:53:35 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrF3d005569 for ;
Thu, 17 Jan 2019 12:53:15 -0500
Received: by smtp.corp.redhat.com (Postfix)
id B9F5A600CC; Thu, 17 Jan 2019 17:53:15 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 5A214600C6;
Thu, 17 Jan 2019 17:53:15 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:40 -0500
Message-Id: <62f988a4d63b87c3c26407f998a74ddb7c40cf1a.1547746868.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 13/18] qemu: Support vsock
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.12
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.29]);
Thu, 17 Jan 2019 17:53:37 +0000 (UTC)
Add model handling for virtio transitional devices. Ex:
...
* "virtio-transitional" maps to qemu "vhost-vsock-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-vsock-pci-non-transitional"
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 +++-
docs/schemas/domaincommon.rng | 6 +++++-
src/conf/domain_conf.c | 4 +++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_capabilities.c | 6 ++++++
src/qemu/qemu_capabilities.h | 4 ++++
src/qemu/qemu_command.c | 17 +++++++++++------
src/qemu/qemu_domain_address.c | 13 ++++++++++++-
.../qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 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 | 1 +
.../virtio-transitional.x86_64-latest.args | 2 ++
tests/qemuxml2argvdata/virtio-transitional.xml | 3 +++
.../virtio-non-transitional.xml | 9 +++++++++
.../qemuxml2xmloutdata/virtio-transitional.xml | 4 ++++
tests/qemuxml2xmltest.c | 6 ++++--
18 files changed, 80 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/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e8e255f361..5c342cfcfb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8606,7 +8606,9 @@ qemu-kvm -net nic,model=? /dev/null
+
+
+
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 d9a0288387..90fba68d9f 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 9f05de5089..b6e762c0a7 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 0d99aa2ded..490b28368a 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 1a6eddf3b7..9fe2b8e8a2 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1270,13 +1270,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 Thu Jan 17 17:52: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: 155873
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257883jaa;
Thu, 17 Jan 2019 09:53:42 -0800 (PST)
X-Google-Smtp-Source: ALg8bN7S5Jk7Er/nMHXFAF5AbDDQvxp97q3ubcpiCDrrGzbdhVT6SihmidTQud3APhOTdzUUIgaj
X-Received: by 2002:a37:4f4e:: with SMTP id
d75mr11782437qkb.257.1547747622548;
Thu, 17 Jan 2019 09:53:42 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747622; cv=none;
d=google.com; s=arc-20160816;
b=rWD7GxLdCeA7rTK5jVrdhhwVkCaqLVEkgWlP42W8QF5kGfZ8iG5R5Zj8njp8L32Go1
aCCg4/GjSfSbvxROZaydqGgAgEfG/MRsw1aFTCCa7XRaPzrO78ay5dhd96fJcYibCMOL
pelnfohOQqKjcnrqeDKTHDWPlA4XwLsc9JQlhHrPZgynXGjjx7LlGXZSHBToKIlYb97P
Fufu+ERtVCWn7ei1fI+7jGuIGMMBsaPfUIzL6UUc4MmIvsRH9OKFaDvkJauqPz7kggD2
PdQ1bVk7zt8MW8uBsnn0nSqeQMpVKf9St7AKIhEYIBUaH17bHGTThmu5QUO8VzEnw7Jm
mghA==
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=XhKYqgyJ5knNksSsuGeWTKS0MUpQTg+nSL8YH2hJrOo=;
b=e/Em30kqo7UOld9V5d9VWw27RaRDmVI63yyDf0eRA4cjL3SzLHbO7sfCcTDOzr6ePT
zHZn546z/BloXlPta1xImPnkgMsunMYUbWaIr8tp9hYgfwT/cstRX4Pyb0dKVBbJqG9g
Cqmd4fHKY3t8/WGUi0RKz/OoLhJD+OP6x1XL5s0Nn3n3Atd4H1JPhgjJnSFzB4Mc/8Un
zDhFLDiaY0p1988wN8fbU5bCb/sypePCh8fbqZM+Lo9Ro7WqP7TBP3aOcQ9BgqbxZe9a
AAm7w70AzJamYMYNlfDf1IyMCfnBlJEZXxF/Av1M6tg1NJlZkc78BL9CeD3g2Laa5g14
EfyQ==
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 p23si839713qtf.16.2019.01.17.09.53.42
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53: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-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 B0DB788E67;
Thu, 17 Jan 2019 17:53:40 +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 745E75ED4D;
Thu, 17 Jan 2019 17:53:40 +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 2581218033A6;
Thu, 17 Jan 2019 17:53:40 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrGiE005589 for ;
Thu, 17 Jan 2019 12:53:16 -0500
Received: by smtp.corp.redhat.com (Postfix)
id DB176600CC; Thu, 17 Jan 2019 17:53:16 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 7AE46600C6;
Thu, 17 Jan 2019 17:53:16 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:42 -0500
Message-Id: <39eff8fd2aef05ce62ce1650b6717c765f6e4472.1547746868.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 15/18] 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.25]);
Thu, 17 Jan 2019 17:53:41 +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_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 12 ++++++++++--
src/qemu/qemu_domain_address.c | 9 +++++++++
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++
.../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 ++-------
10 files changed, 39 insertions(+), 21 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_capabilities.c b/src/qemu/qemu_capabilities.c
index 954ba5a171..f5b9bc6937 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -540,6 +540,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
/* 340 */
"vhost-vsock-pci-non-transitional",
+ "virtio-input-host-pci-transitional",
+ "virtio-input-host-pci-non-transitional",
);
@@ -1142,6 +1144,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{"virtio-balloon-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_NON_TRANSITIONAL},
{"vhost-vsock-pci-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_TRANSITIONAL},
{"vhost-vsock-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_NON_TRANSITIONAL},
+ {"virtio-input-host-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_TRANSITIONAL},
+ {"virtio-input-host-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 99e3b3c5ca..91aae8df5b 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -524,6 +524,8 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 340 */
QEMU_CAPS_DEVICE_VHOST_VSOCK_NON_TRANSITIONAL, /* -device vhost-vsock-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_TRANSITIONAL, /* -device virtio-input-host-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_NON_TRANSITIONAL, /* -device virtio-input-host-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 67e54d42b8..4d14ac9e5d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -501,9 +501,14 @@ qemuBuildVirtioTransitional(virBufferPtr buf,
tmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_TRANSITIONAL;
ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_INPUT:
+ has_tmodel = model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_NON_TRANSITIONAL;
+ break;
case VIR_DOMAIN_DEVICE_LEASE:
- case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
case VIR_DOMAIN_DEVICE_WATCHDOG:
@@ -4286,7 +4291,10 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
goto error;
break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
- if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", dev->info.type) < 0)
+ if (qemuBuildVirtioTransitional(&buf, "virtio-input-host", qemuCaps,
+ dev->info.type,
+ dev->model, NULL,
+ VIR_DOMAIN_DEVICE_INPUT) < 0)
goto error;
break;
case VIR_DOMAIN_INPUT_TYPE_LAST:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 1b476bbc15..70591dce25 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -917,6 +917,15 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_INPUT:
switch ((virDomainInputBus) dev->data.input->bus) {
case VIR_DOMAIN_INPUT_BUS_VIRTIO:
+ switch ((virDomainInputModel) dev->data.input->model) {
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL:
+ return pciFlags;
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO:
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL:
+ case VIR_DOMAIN_INPUT_MODEL_DEFAULT:
+ case VIR_DOMAIN_INPUT_MODEL_LAST:
+ break;
+ }
return virtioFlags;
case VIR_DOMAIN_INPUT_BUS_PS2:
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index b5861b1982..d5bbbc40f7 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -226,6 +226,8 @@
+
+ 30010500446361
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 5952008b28..fc183757b0 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 @@ bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,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,id=input0,\
+evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci,disable-legacy=on,id=balloon0,bus=pci.5,addr=0x0 \
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 490b28368a..9fa9732c2d 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 Thu Jan 17 17:52: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: 155876
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2258096jaa;
Thu, 17 Jan 2019 09:53:52 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4y1abFenj3QoQwuaNsIiobHb6/uSnV5qPprjgkzgr38fkrDL1yBBwjKw/MGl73ANP4cG9/
X-Received: by 2002:a0c:e905:: with SMTP id a5mr11922813qvo.181.1547747632876;
Thu, 17 Jan 2019 09:53:52 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547747632; cv=none;
d=google.com; s=arc-20160816;
b=fpNHwiCWoWepkdLuet4++we2qVa7SvyMIW6w4man+W+W06pXlgzgYnGYJDbisBEsQD
0axA/qCkVQeoqjCrEsG7By9jGYElFlpcyQI2uoWKZEenJ5feZJ6DHZshJGVcHbpdfIj+
DQrGN7CKpGDIK4wKijL0kKmSXwim1u9vVyoKbXryy94J1yshgMZJg2uEPqt2zOswxwxO
z9WkfUNfnIfpgCCeAESMnKGPKCPWvacpC3/0858NUpfwI6fBaG7wPbt1/vJqHi8LsLc8
aBY3ZNlxCq01JpZ0dhZrog57IS2+m1CdGkzfrtzXOY2pP1IcGsQifozbQBscyyicuxou
Iv7Q==
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=IuWZXAAU5e/ojYw3k4F8xdbjH3j3jKH4YtvW78iJm6I=;
b=AVqY7eUGLwqEtx1qPVrvEuVJrK5xTexdI8vXIDzsEWWgq+RhCtU5NnumVGxAWuKKLX
ka0+8LzNbCeBC+3h0cAFNpQ5gqUxgVQ+3rSmRR3ddrPtG49V/uqtxdAX2Xeqh7zlruMq
TPb1h75hy6bBn2lw4IC7Vc4mmucTNnhPTzfw56oP+DdYoVo+h9Du1iWIovaJgSrGyq5f
l95B95usHz0Oa4JZM9oofMB64vFo3mrqezDboxLC629Ae4GmHfEsP4TpEcFAvemQPIq3
38GwLIhs+wgCBFrjo/Z6Pd2P25F77ry7fgCzqQHhbq7srwGvyu1jH0+y3kh0yxp8lIOh
mFZg==
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
k3si6413953qvo.122.2019.01.17.09.53.52
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Jan 2019 09:53:52 -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 41EE0C0C6C28;
Thu, 17 Jan 2019 17:53:50 +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 F1653261AC;
Thu, 17 Jan 2019 17:53:49 +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 A6EBD3F616;
Thu, 17 Jan 2019 17:53:49 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0HHrKJG005615 for ;
Thu, 17 Jan 2019 12:53:20 -0500
Received: by smtp.corp.redhat.com (Postfix)
id C8538600D7; Thu, 17 Jan 2019 17:53:20 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com
[10.10.122.144])
by smtp.corp.redhat.com (Postfix) with ESMTP id 519E7600CC;
Thu, 17 Jan 2019 17:53:16 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Thu, 17 Jan 2019 12:52:43 -0500
Message-Id: <4d8c3b45d1e5a667908ab2596b59ef1881625449.1547746868.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 16/18] qemu: Support scsi 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.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.32]);
Thu, 17 Jan 2019 17:53:52 +0000 (UTC)
Add
* "virtio-transitional" maps to qemu "virtio-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-scsi-non-transitional"
The naming here doesn't match the pre-existing model=virtio-scsi.
The prescence of '-scsi' there seems kind of redundant as we have
type='scsi' already, so I decided to follow the pattern of other
patches and use virtio-transitional etc.
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 ++--
docs/schemas/domaincommon.rng | 2 ++
src/conf/domain_conf.c | 4 +++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 18 +++++++++++++--
src/qemu/qemu_domain.c | 8 ++++++-
src/qemu/qemu_domain_address.c | 2 ++
src/vbox/vbox_common.c | 2 ++
src/vmx/vmx.c | 4 +++-
.../caps_4.0.0.x86_64.xml | 2 ++
.../virtio-non-transitional.x86_64-3.1.0.args | 17 ++++++++------
...virtio-non-transitional.x86_64-latest.args | 17 ++++++++------
.../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 ++++++++-----
tests/qemuxml2xmltest.c | 6 +++--
21 files changed, 111 insertions(+), 48 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Signed-off-by: Cole Robinson
Signed-off-by: Cole Robinson
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 63bdf2c86b..bdf533ba3e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4139,8 +4139,8 @@
scsi
A scsi controller has an optional attribute
model, which is one of 'auto', 'buslogic', 'ibmvscsi',
- 'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi' or
- 'vmpvscsi'.
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'