diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9f6e8ee7327cb5216f547c418a7bda2a6bb3976d..b5a6e33bfe07dea497e87f25480db9aa2cf3cbcc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8169,6 +8169,26 @@ qemu-kvm -net nic,model=? /dev/null
+
+
+ A vsock host/guest interface. The model
attribute
+ defaults to virtio
.
+ The optional attribute cid
of the source element
+ specifies the CID assigned to the guest. If the attribute
+ auto
is set to yes
, libvirt
+ will assign a free CID automatically on domain startup.
+ Since 4.4.0
+
+
+...
+<devices>
+ <vsock model='virtio'>
+ <source auto='no' cid='3'/>
+ </vsock>
+</devices>
+...
+
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2cb9bfea98bea10eb66e75fe50a5560f9e9b382c..703a1bb6f8e0b3dc271788cf932e7351f4b8aa35 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4149,6 +4149,34 @@
+
+
+
+
+ virtio
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4696,6 +4724,9 @@
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 21a49bd5ac77982f62823f8ec89c33ca70f3e571..544f63a2a93cb9a66c8a0e8d8ecc2383dc75eaa0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -256,7 +256,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"tpm",
"panic",
"memory",
- "iommu")
+ "iommu",
+ "vsock")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",
@@ -870,6 +871,10 @@ VIR_ENUM_IMPL(virDomainTPMBackend, VIR_DOMAIN_TPM_TYPE_LAST,
VIR_ENUM_IMPL(virDomainIOMMUModel, VIR_DOMAIN_IOMMU_MODEL_LAST,
"intel")
+VIR_ENUM_IMPL(virDomainVsockModel, VIR_DOMAIN_VSOCK_MODEL_LAST,
+ "default",
+ "virtio")
+
VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST,
"default",
"unmap",
@@ -2778,6 +2783,9 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
case VIR_DOMAIN_DEVICE_IOMMU:
VIR_FREE(def->data.iommu);
break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ virDomainVsockDefFree(def->data.vsock);
+ break;
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_NONE:
break;
@@ -3642,6 +3650,8 @@ virDomainDeviceGetInfo(virDomainDeviceDefPtr device)
return &device->data.panic->info;
case VIR_DOMAIN_DEVICE_MEMORY:
return &device->data.memory->info;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ return &device->data.vsock->info;
/* The following devices do not contain virDomainDeviceInfo */
case VIR_DOMAIN_DEVICE_LEASE:
@@ -3839,6 +3849,13 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
return rc;
}
+ device.type = VIR_DOMAIN_DEVICE_VSOCK;
+ if (def->vsock) {
+ device.data.vsock = def->vsock;
+ if ((rc = cb(def, &device, &def->vsock->info, opaque)) != 0)
+ return rc;
+ }
+
/* Coverity is not very happy with this - all dead_error_condition */
#if !STATIC_ANALYSIS
/* This switch statement is here to trigger compiler warning when adding
@@ -3873,6 +3890,7 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
case VIR_DOMAIN_DEVICE_RNG:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
break;
}
#endif
@@ -4551,6 +4569,20 @@ virDomainCheckVirtioOptions(virDomainVirtioOptionsPtr virtio)
}
+static int
+virDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
+{
+ if (vsock->auto_cid == VIR_TRISTATE_BOOL_ABSENT) {
+ if (vsock->guest_cid != 0)
+ vsock->auto_cid = VIR_TRISTATE_BOOL_NO;
+ else
+ vsock->auto_cid = VIR_TRISTATE_BOOL_YES;
+ }
+
+ return 0;
+}
+
+
static int
virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
const virDomainDef *def,
@@ -4665,6 +4697,10 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
return -1;
}
+ if (dev->type == VIR_DOMAIN_DEVICE_VSOCK &&
+ virDomainVsockDefPostParse(dev->data.vsock) < 0)
+ return -1;
+
return 0;
}
@@ -5619,6 +5655,19 @@ virDomainMemoryDefValidate(const virDomainMemoryDef *mem)
}
+static int
+virDomainVsockDefValidate(const virDomainVsockDef *vsock)
+{
+ if (vsock->guest_cid > 0 && vsock->guest_cid <= 2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("guest CIDs must be >= 3"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
const virDomainDef *def)
@@ -5654,6 +5703,9 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_MEMORY:
return virDomainMemoryDefValidate(dev->data.memory);
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ return virDomainVsockDefValidate(dev->data.vsock);
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
@@ -15904,6 +15956,70 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
}
+static virDomainVsockDefPtr
+virDomainVsockDefParseXML(virDomainXMLOptionPtr xmlopt,
+ xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
+ unsigned int flags)
+{
+ virDomainVsockDefPtr vsock = NULL, ret = NULL;
+ xmlNodePtr save = ctxt->node;
+ xmlNodePtr source;
+ char *tmp = NULL;
+ int val;
+
+ ctxt->node = node;
+
+ if (!(vsock = virDomainVsockDefNew(xmlopt)))
+ goto cleanup;
+
+ if ((tmp = virXMLPropString(node, "model"))) {
+ if ((val = virDomainVsockModelTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, _("unknown vsock model: %s"), tmp);
+ goto cleanup;
+ }
+ vsock->model = val;
+ }
+
+ source = virXPathNode("./source", ctxt);
+
+ VIR_FREE(tmp);
+ if (source) {
+ if ((tmp = virXMLPropString(source, "cid"))) {
+ if (virStrToLong_uip(tmp, NULL, 10, &vsock->guest_cid) < 0 ||
+ vsock->guest_cid == 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'cid' attribute must be a positive number: %s"),
+ tmp);
+ goto cleanup;
+ }
+ }
+
+ VIR_FREE(tmp);
+ if ((tmp = virXMLPropString(source, "auto"))) {
+ val = virTristateBoolTypeFromString(tmp);
+ if (val <= 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'auto' attribute can be 'yes' or 'no': %s"),
+ tmp);
+ goto cleanup;
+ }
+ vsock->auto_cid = val;
+ }
+ }
+
+ if (virDomainDeviceInfoParseXML(xmlopt, node, &vsock->info, flags) < 0)
+ goto cleanup;
+
+ VIR_STEAL_PTR(ret, vsock);
+
+ cleanup:
+ ctxt->node = save;
+ VIR_FREE(vsock);
+ VIR_FREE(tmp);
+ return ret;
+}
+
virDomainDeviceDefPtr
virDomainDeviceDefParse(const char *xmlStr,
const virDomainDef *def,
@@ -16059,6 +16175,11 @@ virDomainDeviceDefParse(const char *xmlStr,
if (!(dev->data.iommu = virDomainIOMMUDefParseXML(node, ctxt)))
goto error;
break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ if (!(dev->data.vsock = virDomainVsockDefParseXML(xmlopt, node, ctxt,
+ flags)))
+ goto error;
+ break;
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_LAST:
break;
@@ -20482,6 +20603,22 @@ virDomainDefParseXML(xmlDocPtr xml,
}
VIR_FREE(nodes);
+ if ((n = virXPathNodeSet("./devices/vsock", ctxt, &nodes)) < 0)
+ goto error;
+
+ if (n > 1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("only a single vsock device is supported"));
+ goto error;
+ }
+
+ if (n > 0) {
+ if (!(def->vsock = virDomainVsockDefParseXML(xmlopt, nodes[0],
+ ctxt, flags)))
+ goto error;
+ }
+ VIR_FREE(nodes);
+
/* analysis of the user namespace mapping */
if ((n = virXPathNodeSet("./idmap/uid", ctxt, &nodes)) < 0)
goto error;
@@ -22057,6 +22194,26 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src,
}
+static bool
+virDomainVsockDefCheckABIStability(virDomainVsockDefPtr src,
+ virDomainVsockDefPtr dst)
+{
+ if (src->model != dst->model) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target domain vsock device model '%s' "
+ "does not match source '%s'"),
+ virDomainVsockModelTypeToString(dst->model),
+ virDomainVsockModelTypeToString(src->model));
+ return false;
+ }
+
+ if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
+ return false;
+
+ return true;
+}
+
+
static bool
virDomainDefVcpuCheckAbiStability(virDomainDefPtr src,
virDomainDefPtr dst)
@@ -22521,6 +22678,17 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
!virDomainIOMMUDefCheckABIStability(src->iommu, dst->iommu))
goto error;
+ if (!!src->vsock != !!dst->vsock) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target domain vsock device count "
+ "does not match source"));
+ goto error;
+ }
+
+ if (src->vsock &&
+ !virDomainVsockDefCheckABIStability(src->vsock, dst->vsock))
+ goto error;
+
if (xmlopt && xmlopt->abi.domain &&
!xmlopt->abi.domain(src, dst))
goto error;
@@ -22558,6 +22726,7 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
break;
}
#endif
@@ -26815,6 +26984,46 @@ virDomainMemtuneFormat(virBufferPtr buf,
}
+static int
+virDomainVsockDefFormat(virBufferPtr buf,
+ virDomainVsockDefPtr vsock)
+{
+ virBuffer childBuf = VIR_BUFFER_INITIALIZER;
+ virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
+ virBuffer sourceAttrBuf = VIR_BUFFER_INITIALIZER;
+ int ret = -1;
+
+ if (vsock->model) {
+ virBufferAsprintf(&attrBuf, " model='%s'",
+ virDomainVsockModelTypeToString(vsock->model));
+ }
+
+ virBufferSetChildIndent(&childBuf, buf);
+
+ if (vsock->auto_cid != VIR_TRISTATE_BOOL_ABSENT) {
+ virBufferAsprintf(&sourceAttrBuf, " auto='%s'",
+ virTristateBoolTypeToString(vsock->auto_cid));
+ }
+ if (vsock->guest_cid != 0)
+ virBufferAsprintf(&sourceAttrBuf, " cid='%u'", vsock->guest_cid);
+ if (virXMLFormatElement(&childBuf, "source", &sourceAttrBuf, NULL) < 0)
+ goto cleanup;
+
+ virDomainDeviceInfoFormat(&childBuf, &vsock->info, 0);
+
+ if (virXMLFormatElement(buf, "vsock", &attrBuf, &childBuf) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ virBufferFreeAndReset(&childBuf);
+ virBufferFreeAndReset(&attrBuf);
+ virBufferFreeAndReset(&sourceAttrBuf);
+ return ret;
+}
+
+
/* This internal version appends to an existing buffer
* (possibly with auto-indent), rather than flattening
* to string.
@@ -27556,6 +27765,10 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virDomainIOMMUDefFormat(buf, def->iommu) < 0)
goto error;
+ if (def->vsock &&
+ virDomainVsockDefFormat(buf, def->vsock) < 0)
+ goto error;
+
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "\n");
@@ -28676,6 +28889,9 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
case VIR_DOMAIN_DEVICE_SHMEM:
rc = virDomainShmemDefFormat(&buf, src->data.shmem, flags);
break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ rc = virDomainVsockDefFormat(&buf, src->data.vsock);
+ break;
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_SMARTCARD:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7877bcc9b1213750524b9f2a6ddd8b753237e4cb..6cc8f8a29b9de0e13f5f35d3fc8ca45c0a6b99c4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -189,6 +189,7 @@ typedef enum {
VIR_DOMAIN_DEVICE_PANIC,
VIR_DOMAIN_DEVICE_MEMORY,
VIR_DOMAIN_DEVICE_IOMMU,
+ VIR_DOMAIN_DEVICE_VSOCK,
VIR_DOMAIN_DEVICE_LAST
} virDomainDeviceType;
@@ -221,6 +222,7 @@ struct _virDomainDeviceDef {
virDomainPanicDefPtr panic;
virDomainMemoryDefPtr memory;
virDomainIOMMUDefPtr iommu;
+ virDomainVsockDefPtr vsock;
} data;
};
@@ -2314,8 +2316,21 @@ struct _virDomainIOMMUDef {
virTristateSwitch iotlb;
};
+typedef enum {
+ VIR_DOMAIN_VSOCK_MODEL_DEFAULT,
+ VIR_DOMAIN_VSOCK_MODEL_VIRTIO,
+
+ VIR_DOMAIN_VSOCK_MODEL_LAST
+} virDomainVsockModel;
+
struct _virDomainVsockDef {
virObjectPtr privateData;
+
+ virDomainVsockModel model;
+ unsigned int guest_cid;
+ virTristateBool auto_cid;
+
+ virDomainDeviceInfo info;
};
struct _virDomainVirtioOptions {
@@ -2468,6 +2483,7 @@ struct _virDomainDef {
virSysinfoDefPtr sysinfo;
virDomainRedirFilterDefPtr redirfilter;
virDomainIOMMUDefPtr iommu;
+ virDomainVsockDefPtr vsock;
void *namespaceData;
virDomainXMLNamespace ns;
@@ -3378,6 +3394,7 @@ VIR_ENUM_DECL(virDomainMemoryBackingModel)
VIR_ENUM_DECL(virDomainMemorySource)
VIR_ENUM_DECL(virDomainMemoryAllocation)
VIR_ENUM_DECL(virDomainIOMMUModel)
+VIR_ENUM_DECL(virDomainVsockModel)
VIR_ENUM_DECL(virDomainShmemModel)
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0b99698046e4052b1b34ac15488e29790fc74cb3..c4e91896c590266c5bd0e6efbae66fb8c077e540 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5313,6 +5313,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_LAST:
break;
@@ -5792,6 +5793,16 @@ qemuDomainDevicePanicDefPostParse(virDomainPanicDefPtr panic,
}
+static int
+qemuDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
+{
+ if (vsock->model == VIR_DOMAIN_VSOCK_MODEL_DEFAULT)
+ vsock->model = VIR_DOMAIN_VSOCK_MODEL_VIRTIO;
+
+ return 0;
+}
+
+
static int
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
@@ -5838,6 +5849,10 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
ret = qemuDomainChrDefPostParse(dev->data.chr, def, driver, parseFlags);
break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ ret = qemuDomainVsockDefPostParse(dev->data.vsock);
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index b7c82cb6f104ed821efacadcd24da91260386ed3..e9f460d77a1bdc4fc9a148a30821cb0863a29bbf 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -859,6 +859,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
}
break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ return virtioFlags;
+
/* These devices don't ever connect with PCI */
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_TPM:
@@ -2152,6 +2155,14 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
/* Nada - none are PCI based (yet) */
}
+ if (def->vsock &&
+ virDeviceInfoPCIAddressWanted(&def->vsock->info)) {
+
+ if (qemuDomainPCIAddressReserveNextAddr(addrs,
+ &def->vsock->info) < 0)
+ goto error;
+ }
+
return 0;
error:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5e6f8fe6dd2404078e4ce35d0e74c69c9d22bc56..3aa694de123ee4c1471ffe692bc7bdb223b80bdb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7702,6 +7702,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("live attach of device '%s' is not supported"),
@@ -7803,6 +7804,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("live detach of device '%s' is not supported"),
@@ -7939,6 +7941,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("live update of device '%s' is not supported"),
@@ -8125,6 +8128,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("persistent attach of device '%s' is not supported"),
@@ -8308,6 +8312,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("persistent detach of device '%s' is not supported"),
@@ -8406,6 +8411,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("persistent update of device '%s' is not supported"),
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 4f7d57906c7894cc75778b78afe0e5f41c8a71d2..b4bbe62c756110a1c2ad8926dd4c0c44857e637c 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4627,6 +4627,7 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("don't know how to remove a %s device"),
diff --git a/tests/qemuxml2argvdata/vhost-vsock-auto.xml b/tests/qemuxml2argvdata/vhost-vsock-auto.xml
new file mode 100644
index 0000000000000000000000000000000000000000..44b3b15f02477ddf14fcb66c2cef4b61ff5ae9f4
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-vsock-auto.xml
@@ -0,0 +1,35 @@
+
+ test
+ bba65c0e-c049-934f-b6aa-4e2c0582acdf
+ 1048576
+ 1048576
+ 1
+
+ hvm
+
+
+
+
+ destroy
+ restart
+ restart
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/vhost-vsock.xml b/tests/qemuxml2argvdata/vhost-vsock.xml
new file mode 100644
index 0000000000000000000000000000000000000000..636abbb16085a7b2441fc3dcaca6752253cc26a9
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-vsock.xml
@@ -0,0 +1,36 @@
+
+ test
+ bba65c0e-c049-934f-b6aa-4e2c0582acdf
+ 1048576
+ 1048576
+ 1
+
+ hvm
+
+
+
+
+ destroy
+ restart
+ restart
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/vhost-vsock-auto.xml b/tests/qemuxml2xmloutdata/vhost-vsock-auto.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0e0e4a46b4800cc4519c3cad5e5190a35a3bf410
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/vhost-vsock-auto.xml
@@ -0,0 +1,36 @@
+
+ test
+ bba65c0e-c049-934f-b6aa-4e2c0582acdf
+ 1048576
+ 1048576
+ 1
+
+ hvm
+
+
+
+
+ destroy
+ restart
+ restart
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/vhost-vsock.xml b/tests/qemuxml2xmloutdata/vhost-vsock.xml
new file mode 120000
index 0000000000000000000000000000000000000000..bb24241fb274ad887455d277e2f636a5139507c2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/vhost-vsock.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/vhost-vsock.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index bd7433dce455375100c2c485f14db8389c56c10b..5671114de059f295d3529f8ffc5ac5cf40c996d1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1212,6 +1212,9 @@ mymain(void)
DO_TEST_STATUS("migration-out-params");
DO_TEST_STATUS("migration-out-nbd-tls");
+ DO_TEST("vhost-vsock", NONE);
+ DO_TEST("vhost-vsock-auto", NONE);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);