From nobody Sun Feb 8 11:06:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612365993; cv=none; d=zohomail.com; s=zohoarc; b=ButNV1CGFq1LWBj1QYSHTnh00OsBrQlQWSOgdv1DQmDuWiMTM4OXS6erUiH+nJzmQIgGG9wtHuBgR8Ibu6+FZNrOAKPO2UBpOXDbBUzFBrsKOeiv1EAAGwkwI/U7/DSmvGxx9Ny2u/Axc7uL1yRuJ+Ak9x18A/q3Re5TKGQIAmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612365993; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YY628WqZXPjlIrg2BqC3MrHUVGhUz0ugZ2eeq6eFXjA=; b=WUHixrkjv/D4afv/I3lDrKdkaCAmc1UG3jnOXQhSb5Btk8ObwuRrKLN49Y4iatqFAvjjjcX4L5EKBk9IMNs5GZhgHt/XZfaEe41eKCZxLaVdQ59lJgQxKumVkf67I3bPqOjyINadxSR2WBmpN7fIfK09objgM5pWsAQPJTvbpfM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612365993403515.2420329390144; Wed, 3 Feb 2021 07:26:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-6dYQwQJaNbikPWZQfLQ-Tw-1; Wed, 03 Feb 2021 10:26:29 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76D021015940; Wed, 3 Feb 2021 15:26:22 +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 4C7625C238; Wed, 3 Feb 2021 15:26:22 +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 12A6818089C9; Wed, 3 Feb 2021 15:26:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 113FQ7H2002798 for ; Wed, 3 Feb 2021 10:26:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2F67A5D762; Wed, 3 Feb 2021 15:26:07 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74FE45D6A8 for ; Wed, 3 Feb 2021 15:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612365992; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YY628WqZXPjlIrg2BqC3MrHUVGhUz0ugZ2eeq6eFXjA=; b=h/5hwtQdYWHdGcXSo8btsym8y0569xp5a31snL+Q58/QmPJpVWQHNPFkDe4N+Tk7Nh24c4 KnWcsDTsaEK5M+37h1mSTzVNWkXkOSgP0MSIMTiZ38TkbuqTRguZb+ZoZilEdqGIlK5hKo MdjVC6YsDlE4blT/xfETuzvp2+5wUmM= X-MC-Unique: 6dYQwQJaNbikPWZQfLQ-Tw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/6] conf: implement support for vhostuser disk Date: Wed, 3 Feb 2021 16:25:57 +0100 Message-Id: <4ac9852a6bf19646feb41cf1d191fa0f5f68a754.1612364698.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- Changes in v2: - added comment about snapshots not supported - moved forward declarations to the top of the file - fixed typos - added proper error message to qemuBlockStorageSourceGetBackendProps - added check for blkdeviotune.group_name in virDomainDiskVhostUserVali= date - added into one disk in tests src/conf/domain_conf.c | 87 ++++++++ src/conf/domain_validate.c | 188 ++++++++++++++++++ src/conf/storage_source_conf.c | 3 + src/conf/storage_source_conf.h | 4 + src/libxl/xen_xl.c | 1 + src/qemu/qemu_block.c | 6 + src/qemu/qemu_command.c | 1 + src/qemu/qemu_migration.c | 2 + src/qemu/qemu_snapshot.c | 4 + src/storage_file/storage_source.c | 1 + tests/qemuxml2argvdata/disk-vhostuser.xml | 30 +++ .../disk-vhostuser.x86_64-latest.xml | 48 +++++ tests/qemuxml2xmltest.c | 1 + 13 files changed, 376 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-vhostuser.xml create mode 100644 tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.x= ml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 69b2841924..8dc5aecbf4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1338,6 +1338,19 @@ static virClassPtr virDomainXMLOptionClass; static void virDomainObjDispose(void *obj); static void virDomainXMLOptionDispose(void *obj); =20 + +static void +virDomainChrSourceDefFormat(virBufferPtr buf, + virDomainChrSourceDefPtr def, + unsigned int flags); + + +static int +virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr d= ef, + xmlNodePtr node, + xmlXPathContextPtr ctxt); + + static int virDomainObjOnceInit(void) { if (!VIR_CLASS_NEW(virDomainObj, virClassForObjectLockable())) @@ -5229,6 +5242,12 @@ virDomainDiskDefPostParse(virDomainDiskDefPtr disk, disk->src->nvme->managed =3D VIR_TRISTATE_BOOL_YES; } =20 + /* vhost-user doesn't allow us to snapshot, disable snapshots by defau= lt */ + if (disk->src->type =3D=3D VIR_STORAGE_TYPE_VHOST_USER && + disk->snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT) { + disk->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; + } + if (disk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0) { return -1; @@ -8362,6 +8381,49 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, } =20 =20 +static int +virDomainDiskSourceVHostUserParse(xmlNodePtr node, + virStorageSourcePtr src, + virDomainXMLOptionPtr xmlopt, + xmlXPathContextPtr ctxt) +{ + g_autofree char *type =3D virXMLPropString(node, "type"); + g_autofree char *path =3D virXMLPropString(node, "path"); + + if (!type) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing 'type' attribute for vhostuser disk sour= ce")); + return -1; + } + + if (STRNEQ(type, "unix")) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid 'type' attribute for vhostuser disk sour= ce")); + return -1; + } + + if (!path) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing 'path' attribute for vhostuser disk sour= ce")); + return -1; + } + + if (!(src->vhostuser =3D virDomainChrSourceDefNew(xmlopt))) + return -1; + + src->vhostuser->type =3D virDomainChrTypeFromString(type); + src->vhostuser->data.nix.path =3D g_steal_pointer(&path); + + if (virDomainChrSourceReconnectDefParseXML(&src->vhostuser->data.nix.r= econnect, + node, + ctxt) < 0) { + return -1; + } + + return 0; +} + + static int virDomainDiskSourcePRParse(xmlNodePtr node, xmlXPathContextPtr ctxt, @@ -8513,6 +8575,10 @@ virDomainStorageSourceParse(xmlNodePtr node, if (virDomainDiskSourceNVMeParse(node, ctxt, src) < 0) return -1; break; + case VIR_STORAGE_TYPE_VHOST_USER: + if (virDomainDiskSourceVHostUserParse(node, src, xmlopt, ctxt) < 0) + return -1; + break; case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -23940,6 +24006,23 @@ virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf, } =20 =20 +static void +virDomainChrSourceReconnectDefFormat(virBufferPtr buf, + virDomainChrSourceReconnectDefPtr def= ); + + +static void +virDomainDiskSourceVhostuserFormat(virBufferPtr attrBuf, + virBufferPtr childBuf, + virDomainChrSourceDefPtr vhostuser) +{ + virBufferAddLit(attrBuf, " type=3D'unix'"); + virBufferAsprintf(attrBuf, " path=3D'%s'", vhostuser->data.nix.path); + + virDomainChrSourceReconnectDefFormat(childBuf, &vhostuser->data.nix.re= connect); +} + + static int virDomainDiskSourceFormatPrivateData(virBufferPtr buf, virStorageSourcePtr src, @@ -24053,6 +24136,10 @@ virDomainDiskSourceFormat(virBufferPtr buf, virDomainDiskSourceNVMeFormat(&attrBuf, &childBuf, src->nvme); break; =20 + case VIR_STORAGE_TYPE_VHOST_USER: + virDomainDiskSourceVhostuserFormat(&attrBuf, &childBuf, src->vhost= user); + break; + case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index c56b03ff3a..222a9386f6 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -22,6 +22,7 @@ =20 #include "domain_validate.h" #include "domain_conf.h" +#include "snapshot_conf.h" #include "virconftypes.h" #include "virlog.h" #include "virutil.h" @@ -254,6 +255,188 @@ virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioO= ptionsPtr virtio) } =20 =20 +static int +virDomainDiskVhostUserValidate(const virDomainDiskDef *disk) +{ + if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vhostuser disk supports only virtio bus")); + return -1; + } + + if (disk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("only snapshot=3Dno is supported with vhostuser d= isk")); + return -1; + } + + /* Unsupported driver attributes */ + + if (disk->cachemode !=3D VIR_DOMAIN_DISK_CACHE_DEFAULT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("cache is not supported with vhostuser disk")); + return -1; + } + + if (disk->error_policy || disk->rerror_policy) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("error_policy is not supported with vhostuser dis= k")); + return -1; + } + + if (disk->iomode) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("io is not supported with vhostuser disk")); + return -1; + } + + if (disk->ioeventfd !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ioeventfd is not supported with vhostuser disk")= ); + return -1; + } + + if (disk->copy_on_read) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("copy_on_read is not supported with vhostuser dis= k")); + return -1; + } + + if (disk->discard) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("discard is not supported with vhostuser disk")); + return -1; + } + + if (disk->iothread) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iothread is not supported with vhostuser disk")); + return -1; + } + + if (disk->detect_zeroes) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("detect_zeroes is not supported with vhostuser di= sk")); + return -1; + } + + /* Unsupported driver elements */ + + if (disk->virtio) { + if (disk->virtio->iommu !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu is not supported with vhostuser disk")= ); + return -1; + } + + if (disk->virtio->ats !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ats is not supported with vhostuser disk")); + return -1; + } + + if (disk->virtio->packed !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("packed is not supported with vhostuser disk"= )); + return -1; + } + } + + if (disk->src->metadataCacheMaxSize > 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("metadata_cache is not supported with vhostuser d= isk")); + return -1; + } + + /* Unsupported disk elements */ + + if (disk->blkdeviotune.group_name || + virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iotune is not supported with vhostuser disk")); + return -1; + } + + if (disk->src->backingStore) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("backingStore is not supported with vhostuser dis= k")); + return -1; + } + + if (disk->src->encryption) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("encryption is not supported with vhostuser disk"= )); + return -1; + } + + if (disk->src->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("readonly is not supported with vhostuser disk")); + return -1; + } + + if (disk->src->shared) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("shareable is not supported with vhostuser disk")= ); + return -1; + } + + if (disk->transient) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("transient is not supported with vhostuser disk")= ); + return -1; + } + + if (disk->serial) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("serial is not supported with vhostuser disk")); + return -1; + } + + if (disk->wwn) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("wwn is not supported with vhostuser disk")); + return -1; + } + + if (disk->vendor) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vendor is not supported with vhostuser disk")); + return -1; + } + + if (disk->product) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("product is not supported with vhostuser disk")); + return -1; + } + + if (disk->src->auth) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("auth is not supported with vhostuser disk")); + return -1; + } + + if (disk->geometry.cylinders > 0 || + disk->geometry.heads > 0 || + disk->geometry.sectors > 0 || + disk->geometry.trans !=3D VIR_DOMAIN_DISK_TRANS_DEFAULT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("geometry is not supported with vhostuser disk")); + return -1; + } + + if (disk->blockio.logical_block_size > 0 || + disk->blockio.physical_block_size > 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("blockio is not supported with vhostuser disk")); + return -1; + } + + return 0; +} + + #define VENDOR_LEN 8 #define PRODUCT_LEN 16 =20 @@ -329,6 +512,11 @@ virDomainDiskDefValidate(const virDomainDef *def, } } =20 + if (disk->src->type =3D=3D VIR_STORAGE_TYPE_VHOST_USER && + virDomainDiskVhostUserValidate(disk) < 0) { + return -1; + } + for (next =3D disk->src; next; next =3D next->backingStore) { if (virSecurityDeviceLabelDefValidate(next->seclabels, next->nseclabels, diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 3eaf05fe52..7706bbd8da 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -46,6 +46,7 @@ VIR_ENUM_IMPL(virStorage, "network", "volume", "nvme", + "vhostuser" ); =20 =20 @@ -1035,6 +1036,7 @@ virStorageSourceIsLocalStorage(const virStorageSource= *src) /* While NVMe disks are local, they are not accessible via src->pa= th. * Therefore, we have to return false here. */ case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_NONE: return false; @@ -1215,6 +1217,7 @@ virStorageSourceIsRelative(virStorageSourcePtr src) case VIR_STORAGE_TYPE_NETWORK: case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: return false; diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index e66ccdedef..f42bb1c67d 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -23,6 +23,7 @@ =20 #include "storage_encryption_conf.h" #include "virbitmap.h" +#include "virconftypes.h" #include "virenum.h" #include "virobject.h" #include "virpci.h" @@ -41,6 +42,7 @@ typedef enum { VIR_STORAGE_TYPE_NETWORK, VIR_STORAGE_TYPE_VOLUME, VIR_STORAGE_TYPE_NVME, + VIR_STORAGE_TYPE_VHOST_USER, =20 VIR_STORAGE_TYPE_LAST } virStorageType; @@ -300,6 +302,8 @@ struct _virStorageSource { =20 virStorageSourceNVMeDefPtr nvme; /* type =3D=3D VIR_STORAGE_TYPE_NVME = */ =20 + virDomainChrSourceDefPtr vhostuser; /* type =3D=3D VIR_STORAGE_TYPE_VH= OST_USER */ + virStorageSourceInitiatorDef initiator; =20 virObjectPtr privateData; diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 6dcba43fe0..941832ce4e 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1668,6 +1668,7 @@ xenFormatXLDiskSrc(virStorageSourcePtr src, char **sr= cstr) =20 case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: break; diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 6456100170..4ae736d553 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1173,6 +1173,11 @@ qemuBlockStorageSourceGetBackendProps(virStorageSour= cePtr src, return NULL; break; =20 + case VIR_STORAGE_TYPE_VHOST_USER: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to create blockdev props for vhostuser di= sk type")); + return NULL; + case VIR_STORAGE_TYPE_VOLUME: virReportError(VIR_ERR_INTERNAL_ERROR, _("storage source pool '%s' volume '%s' is not tran= slated"), @@ -2599,6 +2604,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorag= eSourcePtr src, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: return 0; =20 case VIR_STORAGE_TYPE_NONE: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c30e5a6c83..5501f90221 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1087,6 +1087,7 @@ qemuGetDriveSourceString(virStorageSourcePtr src, =20 case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: break; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 0adfdb9351..f44d31c971 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -238,6 +238,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn, case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1479,6 +1480,7 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def, unsafe =3D true; break; =20 + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_DIR: diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 39445738a2..115c2fc91b 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -428,6 +428,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapsh= otDiskDefPtr snapdisk, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -445,6 +446,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapsh= otDiskDefPtr snapdisk, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -518,6 +520,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainObjPtr v= m, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -648,6 +651,7 @@ qemuSnapshotPrepareDiskInternal(virDomainDiskDefPtr dis= k, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index 4b46cc4e84..ffe150a9b0 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -545,6 +545,7 @@ virStorageSourceUpdatePhysicalSize(virStorageSourcePtr = src, /* We shouldn't get VOLUME, but the switch requires all cases */ case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: + case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: return -1; diff --git a/tests/qemuxml2argvdata/disk-vhostuser.xml b/tests/qemuxml2argv= data/disk-vhostuser.xml new file mode 100644 index 0000000000..c96ef9119c --- /dev/null +++ b/tests/qemuxml2argvdata/disk-vhostuser.xml @@ -0,0 +1,30 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + + + + + 1 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml b/te= sts/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml new file mode 100644 index 0000000000..9712dc0b12 --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml @@ -0,0 +1,48 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + + + + + 1 + + hvm + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + +
+ + + + + + + +
+ + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 342d70935f..a00ebd7d76 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -308,6 +308,7 @@ mymain(void) DO_TEST("disk-network-tlsx509-nbd", NONE); DO_TEST("disk-network-tlsx509-vxhs", NONE); DO_TEST("disk-nvme", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_QCOW2_LUKS); + DO_TEST_CAPS_LATEST("disk-vhostuser"); DO_TEST_CAPS_LATEST("disk-scsi"); DO_TEST("disk-virtio-scsi-reservations", QEMU_CAPS_VIRTIO_SCSI, --=20 2.29.2