mirror of https://gitee.com/openkylin/libvirt.git
conf: introduce <vsock> element
Add a new 'vsock' element for the vsock device. The 'model' attribute is optional. A <source cid> subelement should be used to specify the guest cid, or <source auto='yes'/> should be used. https://bugzilla.redhat.com/show_bug.cgi?id=1291851 Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c20bb30e8d
commit
d4abb7b45d
|
@ -8169,6 +8169,26 @@ qemu-kvm -net nic,model=? /dev/null
|
|||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a id="vsock">Vsock</a></h3>
|
||||
|
||||
<p>A vsock host/guest interface. The <code>model</code> attribute
|
||||
defaults to <code>virtio</code>.
|
||||
The optional attribute <code>cid</code> of the source element
|
||||
specifies the CID assigned to the guest. If the attribute
|
||||
<code>auto</code> is set to <code>yes</code>, libvirt
|
||||
will assign a free CID automatically on domain startup.
|
||||
<span class="since">Since 4.4.0</span></p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<devices>
|
||||
<vsock model='virtio'>
|
||||
<source auto='no' cid='3'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
...</pre>
|
||||
|
||||
|
||||
<h3><a id="seclabel">Security label</a></h3>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -4149,6 +4149,34 @@
|
|||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="vsock">
|
||||
<element name="vsock">
|
||||
<optional>
|
||||
<attribute name="model">
|
||||
<value>virtio</value>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="source">
|
||||
<optional>
|
||||
<attribute name="auto">
|
||||
<ref name="virYesNo"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="cid">
|
||||
<ref name="unsignedInt"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="address"/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
<define name="iommu">
|
||||
<element name="iommu">
|
||||
<attribute name="model">
|
||||
|
@ -4696,6 +4724,9 @@
|
|||
<optional>
|
||||
<ref name="iommu"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="vsock"/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
|
|
@ -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, "</devices>\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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<domain type='qemu'>
|
||||
<name>test</name>
|
||||
<uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
<bootmenu enable='yes'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='none'/>
|
||||
<vsock>
|
||||
<source auto='yes'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1,36 @@
|
|||
<domain type='qemu'>
|
||||
<name>test</name>
|
||||
<uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-0.13'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
<bootmenu enable='yes'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='none'/>
|
||||
<vsock model='virtio'>
|
||||
<source auto='no' cid='4'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1,36 @@
|
|||
<domain type='qemu'>
|
||||
<name>test</name>
|
||||
<uuid>bba65c0e-c049-934f-b6aa-4e2c0582acdf</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
<bootmenu enable='yes'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='none'/>
|
||||
<vsock model='virtio'>
|
||||
<source auto='yes'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
|
@ -0,0 +1 @@
|
|||
../qemuxml2argvdata/vhost-vsock.xml
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue