Add a new 'vsock' interface type with a <target cid> subelement.
<interface type='vsock'>
<target cid='4'/>
<address type='pci' .../>
</interface>
No model is required.
https://bugzilla.redhat.com/show_bug.cgi?id=1291851
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
docs/formatdomain.html.in | 15 ++++++++++++
docs/schemas/domaincommon.rng | 14 +++++++++++
src/conf/domain_conf.c | 40 ++++++++++++++++++++++++++++----
src/conf/domain_conf.h | 4 ++++
src/conf/netdev_bandwidth_conf.h | 1 +
src/libxl/libxl_conf.c | 1 +
src/lxc/lxc_controller.c | 1 +
src/lxc/lxc_driver.c | 3 +++
src/lxc/lxc_process.c | 1 +
src/qemu/qemu_command.c | 4 ++++
src/qemu/qemu_domain.c | 3 +++
src/qemu/qemu_hotplug.c | 3 +++
src/qemu/qemu_interface.c | 2 ++
src/qemu/qemu_process.c | 1 +
src/uml/uml_conf.c | 5 ++++
src/vmx/vmx.c | 1 +
src/xenconfig/xen_common.c | 1 +
src/xenconfig/xen_sxpr.c | 1 +
tests/qemuxml2argvdata/vhost-vsock.xml | 36 ++++++++++++++++++++++++++++
tests/qemuxml2xmloutdata/vhost-vsock.xml | 1 +
tests/qemuxml2xmltest.c | 2 ++
tools/virsh-domain.c | 1 +
22 files changed, 137 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/vhost-vsock.xml
create mode 120000 tests/qemuxml2xmloutdata/vhost-vsock.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0d0fd3b9f3..05d991a370 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5386,6 +5386,21 @@
</source>
</interface>
</devices>
+...</pre>
+
+ <h5><a id="elementsNICSVsock">Vsock</a></h5>
+
+ <p>A vsock host/guest interface. Attribute <code>cid</code> of the
traget element
+ specifies the CID assigned to the guest.
+ <span class="since">Since 4.4.0</span></p>
+
+<pre>
+...
+<devices>
+ <interface type='vsock'>
+ <target cid='3'/>
+ </interface>
+</devices>
...</pre>
<h5><a id="elementsNICSModel">Setting the NIC
model</a></h5>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 71ac3d079c..c56b615e6e 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2675,6 +2675,20 @@
<ref name="interface-options"/>
</interleave>
</group>
+ <group>
+ <attribute name="type">
+ <value>vsock</value>
+ </attribute>
+ <interleave>
+ <element name="target">
+ <attribute name="cid">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <empty/>
+ </element>
+ <ref name="address"/>
+ </interleave>
+ </group>
</choice>
<optional>
<attribute name="trustGuestRxFilters">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ee5fba40c9..77a233012e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -426,7 +426,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
"internal",
"direct",
"hostdev",
- "udp")
+ "udp",
+ "vsock")
VIR_ENUM_IMPL(virDomainNetBackend, VIR_DOMAIN_NET_BACKEND_TYPE_LAST,
"default",
@@ -2094,6 +2095,10 @@ virDomainNetDefClear(virDomainNetDefPtr def)
virDomainHostdevDefClear(&def->data.hostdev.def);
break;
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
+ def->data.vsock.guest_cid = 0;
+ break;
+
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_LAST:
@@ -10959,6 +10964,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
char *vhostuser_type = NULL;
char *trustGuestRxFilters = NULL;
char *vhost_path = NULL;
+ char *cid = NULL;
virHashTablePtr filterparams = NULL;
virDomainActualNetDefPtr actual = NULL;
xmlNodePtr oldnode = ctxt->node;
@@ -11104,6 +11110,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_FREE(ifname);
}
}
+ if (!cid && def->type == VIR_DOMAIN_NET_TYPE_VSOCK)
+ cid = virXMLPropString(cur, "cid");
} else if ((!ifname_guest || !ifname_guest_actual) &&
virXMLNodeNameEqual(cur, "guest")) {
ifname_guest = virXMLPropString(cur, "dev");
@@ -11190,7 +11198,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
(const char *)macaddr);
goto error;
}
- } else {
+ } else if (def->type != VIR_DOMAIN_NET_TYPE_VSOCK) {
virDomainNetGenerateMAC(xmlopt, &def->mac);
def->mac_generated = true;
}
@@ -11425,6 +11433,21 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
break;
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
+ if (cid == NULL) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("No <target> 'cid' attribute "
+ "specified with <interface
type='vsock'/>"));
+ goto error;
+ }
+ if (virStrToLong_uip(cid, NULL, 10, &def->data.vsock.guest_cid) < 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'cid' attribute must be positive number:
%s"),
+ queues);
+ goto error;
+ }
+ break;
+
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_LAST:
@@ -11703,6 +11726,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
break;
case VIR_DOMAIN_NET_TYPE_LAST:
default:
@@ -11771,6 +11795,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_FREE(vhost_path);
VIR_FREE(localaddr);
VIR_FREE(localport);
+ VIR_FREE(cid);
virHashFree(filterparams);
return def;
@@ -24290,8 +24315,10 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
- virBufferAsprintf(buf, "<mac address='%s'/>\n",
- virMacAddrFormat(&def->mac, macstr));
+ if (def->type != VIR_DOMAIN_NET_TYPE_VSOCK) {
+ virBufferAsprintf(buf, "<mac address='%s'/>\n",
+ virMacAddrFormat(&def->mac, macstr));
+ }
if (publicActual) {
/* when there is a virDomainActualNetDef, and we haven't been
@@ -24403,6 +24430,7 @@ virDomainNetDefFormat(virBufferPtr buf,
break;
case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@@ -24461,6 +24489,8 @@ virDomainNetDefFormat(virBufferPtr buf,
/* Skip auto-generated target names for inactive config. */
virBufferEscapeString(buf, "<target dev='%s'/>\n",
def->ifname);
}
+ if (def->type == VIR_DOMAIN_NET_TYPE_VSOCK)
+ virBufferAsprintf(buf, "<target cid='%u'/>\n",
def->data.vsock.guest_cid);
if (def->ifname_guest || def->ifname_guest_actual) {
virBufferAddLit(buf, "<guest");
@@ -28326,6 +28356,7 @@ virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface)
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
return NULL;
@@ -29165,6 +29196,7 @@ virDomainNetTypeSharesHostView(const virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ea72d4810d..402e5f7753 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -907,6 +907,7 @@ typedef enum {
VIR_DOMAIN_NET_TYPE_DIRECT,
VIR_DOMAIN_NET_TYPE_HOSTDEV,
VIR_DOMAIN_NET_TYPE_UDP,
+ VIR_DOMAIN_NET_TYPE_VSOCK,
VIR_DOMAIN_NET_TYPE_LAST
} virDomainNetType;
@@ -1040,6 +1041,9 @@ struct _virDomainNetDef {
struct {
virDomainHostdevDef def;
} hostdev;
+ struct {
+ unsigned int guest_cid;
+ } vsock;
} data;
/* virtPortProfile is used by network/bridge/direct/hostdev */
virNetDevVPortProfilePtr virtPortProfile;
diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h
index 30f988953c..c1da74f1da 100644
--- a/src/conf/netdev_bandwidth_conf.h
+++ b/src/conf/netdev_bandwidth_conf.h
@@ -55,6 +55,7 @@ static inline bool virNetDevSupportBandwidth(virDomainNetType type)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 452a77f3b8..4e172ff80d 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1280,6 +1280,7 @@ libxlMakeNic(virDomainDefPtr def,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported interface type %s"),
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index d5636b808c..3fe362c8c3 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -395,6 +395,7 @@ static int virLXCControllerGetNICIndexes(virLXCControllerPtr ctrl)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported net type %s"),
virDomainNetTypeToString(ctrl->def->nets[i]->type));
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a2e29a2121..fe50750806 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3949,6 +3949,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Network device type is not supported"));
goto cleanup;
@@ -4003,6 +4004,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
/* no-op */
@@ -4449,6 +4451,7 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only bridged veth devices can be detached"));
goto cleanup;
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index cc6ed12526..1916ee7e9b 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -582,6 +582,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1f03cc70fe..a9c67bbb3b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3657,6 +3657,8 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
/* Should have been handled earlier via PCI/USB hotplug code. */
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
+ /* We only need to build the frontend */
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@@ -8265,6 +8267,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
/* nada */
break;
@@ -8301,6 +8304,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
/* These types don't use a network device on the host, but
* instead use some other type of connection to the emulated
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 650909b739..eb88de83db 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3676,6 +3676,7 @@ qemuDomainNetSupportsCoalesce(virDomainNetType type)
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@@ -5570,6 +5571,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_NET &&
dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
+ dev->data.net->type != VIR_DOMAIN_NET_TYPE_VSOCK &&
!dev->data.net->model) {
if (VIR_STRDUP(dev->data.net->model,
qemuDomainDefaultNetModel(def, qemuCaps)) < 0)
@@ -9311,6 +9313,7 @@ qemuDomainNetSupportsMTU(virDomainNetType type)
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index b35594be5f..3a07d5eae9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1052,6 +1052,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("hotplug of interface type of %s is not implemented
yet"),
@@ -3089,6 +3090,7 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm,
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("filters not supported on interfaces of type %s"),
virDomainNetTypeToString(virDomainNetGetActualType(newdev)));
@@ -3389,6 +3391,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
/* all handled in common code directly below this switch */
break;
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index 5d54a85c53..60bb6b22ef 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -122,6 +122,7 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
/* these types all require no action */
break;
@@ -210,6 +211,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
/* these types all require no action */
break;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 174d932ae7..d73f3764f5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6895,6 +6895,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
/* No special cleanup procedure for these types. */
break;
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 9c548f0e80..3cb360d415 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -258,6 +258,11 @@ umlBuildCommandLineNet(virConnectPtr conn,
_("hostdev networking type not supported"));
goto error;
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("vsock networking type not supported"));
+ goto error;
+
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index e6026edc56..3f44eedb29 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3849,6 +3849,7 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type
'%s'"),
virDomainNetTypeToString(def->type));
return -1;
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 80bc267bbe..cddc5f17c7 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1267,6 +1267,7 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type
'%s'"),
virDomainNetTypeToString(net->type));
goto cleanup;
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index 54dd7fc3ed..6992b59654 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1931,6 +1931,7 @@ xenFormatSxprNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
diff --git a/tests/qemuxml2argvdata/vhost-vsock.xml
b/tests/qemuxml2argvdata/vhost-vsock.xml
new file mode 100644
index 0000000000..a9253227c0
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-vsock.xml
@@ -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'/>
+ <interface type='vsock'>
+ <target cid='4'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/vhost-vsock.xml
b/tests/qemuxml2xmloutdata/vhost-vsock.xml
new file mode 120000
index 0000000000..bb24241fb2
--- /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 7cedc2b999..a2f0cf01bc 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1209,6 +1209,8 @@ mymain(void)
DO_TEST_STATUS("migration-in-params");
DO_TEST_STATUS("migration-out-params");
+ DO_TEST("vhost-vsock", NONE);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index cfbbf5a7bc..365618546e 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -935,6 +935,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ case VIR_DOMAIN_NET_TYPE_VSOCK:
case VIR_DOMAIN_NET_TYPE_LAST:
vshError(ctl, _("No support for %s in command
'attach-interface'"),
type);
--
2.16.1