conf, docs, schemas: Add support for interface type vds

This represents an interface connected to a VMWare Distributed Switch,
previously obscured as a dummy interface.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Martin Kletzander 2022-08-17 14:35:17 +02:00
parent db0564b4d3
commit 0225483adc
19 changed files with 142 additions and 9 deletions

View File

@ -5244,15 +5244,8 @@ Dummy network interface
^^^^^^^^^^^^^^^^^^^^^^^
An unconnected network interface sounds pretty pointless, but can show up for
example with VMWare when libvirt does not have any more information to provide.
Two such scenarios are currently known:
1) network interface exists, but is not connected to any existing network
2) the interface is connected to something known as VMWare Distributed Switch
The difference between these two is not (yet?) discoverable by libvirt, so at
least the information gathered from the hypervisor is provided in the
element. :since:`Since 8.7.0`
example with VMWare without any specified network to be connected to.
:since:`Since 8.7.0`
::
@ -5264,6 +5257,27 @@ element. :since:`Since 8.7.0`
</devices>
...
VMWare Distributed Switch
^^^^^^^^^^^^^^^^^^^^^^^^^
Interface can be connected to VMWare Distributed Switch, but since libvirt
cannot provide information about that architecture, the information presented
here is only what can be gathered from the VM configuration. VMs with this
interface type can be created, so that editing of the XML works properly,
however libvirt cannot guarantee that any changes in these parameters will be
valid in the hypervisor. :since:`Since 8.7.0`
::
...
<devices>
<interface type='vds'>
<mac address='52:54:00:22:c9:42'/>
<source switchid='12345678-1234-1234-1234-123456789abc' portid='6' portgroupid='pg-4321' connectionid='12345'/>
</interface>
</devices>
...
Setting the NIC model
^^^^^^^^^^^^^^^^^^^^^

View File

@ -302,6 +302,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
virReportEnumRangeError(virDomainNetType, netType);

View File

@ -574,6 +574,7 @@ VIR_ENUM_IMPL(virDomainNet,
"udp",
"vdpa",
"dummy",
"vds",
);
VIR_ENUM_IMPL(virDomainNetModel,
@ -2497,6 +2498,7 @@ virDomainActualNetDefFree(virDomainActualNetDef *def)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -2621,6 +2623,10 @@ virDomainNetDefFree(virDomainNetDef *def)
virDomainHostdevDefClear(&def->data.hostdev.def);
break;
case VIR_DOMAIN_NET_TYPE_VDS:
g_free(def->data.vds.portgroup_id);
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_DUMMY:
@ -8899,6 +8905,8 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
g_autofree char *vhost_path = NULL;
g_autofree char *tap = NULL;
g_autofree char *vhost = NULL;
g_autofree char *switchid = NULL;
g_autofree char *connectionid = NULL;
const char *prefix = xmlopt ? xmlopt->config.netPrefix : NULL;
if (!(def = virDomainNetDefNew(xmlopt)))
@ -8932,6 +8940,13 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
portid = virXMLPropString(source_node, "portid");
}
if (def->type == VIR_DOMAIN_NET_TYPE_VDS) {
switchid = virXMLPropString(source_node, "switchid");
portid = virXMLPropString(source_node, "portid");
portgroup = virXMLPropString(source_node, "portgroupid");
connectionid = virXMLPropString(source_node, "connectionid");
}
if (def->type == VIR_DOMAIN_NET_TYPE_INTERNAL)
internal = virXMLPropString(source_node, "name");
@ -9313,6 +9328,36 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
}
break;
case VIR_DOMAIN_NET_TYPE_VDS:
if (!switchid) {
virReportError(VIR_ERR_XML_ERROR,
_("Missing source switchid for interface type '%s'"),
virDomainNetTypeToString(def->type));
goto error;
}
if (virUUIDParse(switchid, def->data.vds.switch_id) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse switchid '%s'"), switchid);
goto error;
}
if (virStrToLong_ll(portid, NULL, 0, &def->data.vds.port_id) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse portid '%s'"), portid);
goto error;
}
if (virStrToLong_ll(connectionid, NULL, 0, &def->data.vds.connection_id) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse connectionid '%s'"), connectionid);
goto error;
}
def->data.vds.portgroup_id = g_steal_pointer(&portgroup);
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_DUMMY:
@ -9495,6 +9540,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_VDPA:
break;
case VIR_DOMAIN_NET_TYPE_LAST:
@ -23683,7 +23729,21 @@ virDomainNetDefFormat(virBuffer *buf,
def->data.vdpa.devicepath);
sourceLines++;
}
break;
case VIR_DOMAIN_NET_TYPE_VDS: {
char switchidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(def->data.vds.switch_id, switchidstr);
virBufferEscapeString(buf, "<source switchid='%s'", switchidstr);
virBufferAsprintf(buf, " portid='%lld'", def->data.vds.port_id);
virBufferEscapeString(buf, " portgroupid='%s'", def->data.vds.portgroup_id);
virBufferAsprintf(buf, " connectionid='%lld'", def->data.vds.connection_id);
sourceLines++;
break;
}
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_DUMMY:
@ -28303,6 +28363,7 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -28317,6 +28378,7 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
return NULL;
@ -29314,6 +29376,7 @@ virDomainNetTypeSharesHostView(const virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -29576,6 +29639,7 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unexpected network port type %s"),
virDomainNetTypeToString(virDomainNetGetActualType(iface)));

View File

@ -940,6 +940,7 @@ typedef enum {
VIR_DOMAIN_NET_TYPE_UDP,
VIR_DOMAIN_NET_TYPE_VDPA,
VIR_DOMAIN_NET_TYPE_DUMMY,
VIR_DOMAIN_NET_TYPE_VDS,
VIR_DOMAIN_NET_TYPE_LAST
} virDomainNetType;
@ -1133,6 +1134,12 @@ struct _virDomainNetDef {
struct {
virDomainHostdevDef def;
} hostdev;
struct {
unsigned char switch_id[VIR_UUID_BUFLEN];
char *portgroup_id;
long long port_id;
long long connection_id;
} vds;
} data;
/* virtPortProfile is used by network/bridge/direct/hostdev */
virNetDevVPortProfile *virtPortProfile;

View File

@ -296,6 +296,7 @@ bool virNetDevSupportsBandwidth(virDomainNetType type)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}

View File

@ -3440,6 +3440,29 @@
<ref name="interface-options"/>
</group>
<group>
<attribute name="type">
<value>vds</value>
</attribute>
<interleave>
<element name="source">
<attribute name="switchid">
<ref name="UUID"/>
</attribute>
<attribute name="portid">
<data type="long"/>
</attribute>
<attribute name="portgroupid">
<data type="string"/>
</attribute>
<attribute name="connectionid">
<data type="long"/>
</attribute>
</element>
<ref name="interface-options"/>
</interleave>
</group>
</choice>
<optional>
<attribute name="trustGuestRxFilters">

View File

@ -1392,6 +1392,7 @@ libxlMakeNic(virDomainDef *def,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported interface type %s"),

View File

@ -1678,6 +1678,7 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"),
virDomainNetTypeToString(net->type));
return -1;

View File

@ -423,6 +423,7 @@ static int virLXCControllerGetNICIndexes(virLXCController *ctrl)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported net type %s"),
virDomainNetTypeToString(actualType));

View File

@ -3466,6 +3466,7 @@ lxcDomainAttachDeviceNetLive(virLXCDriver *driver,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Network device type is not supported"));
goto cleanup;
@ -3522,6 +3523,7 @@ lxcDomainAttachDeviceNetLive(virLXCDriver *driver,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
/* no-op */
@ -3965,6 +3967,7 @@ lxcDomainDetachDeviceNetLive(virDomainObj *vm,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only bridged veth devices can be detached"));
goto cleanup;

View File

@ -597,6 +597,7 @@ virLXCProcessSetupInterfaces(virLXCDriver *driver,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unsupported network type %s"),
@ -1609,6 +1610,7 @@ virLXCProcessReconnectNotifyNets(virDomainDef *def)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}

View File

@ -3962,6 +3962,7 @@ qemuBuildHostNetProps(virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
/* Should have been handled earlier via PCI/USB hotplug code. */
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -8182,6 +8183,7 @@ qemuBuildInterfaceConnect(virDomainObj *vm,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -8280,6 +8282,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
/* nada */
break;
@ -8319,6 +8322,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
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

View File

@ -9733,6 +9733,7 @@ qemuDomainNetSupportsMTU(virDomainNetType type)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}

View File

@ -1231,6 +1231,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("hotplug of interface type of %s is not implemented yet"),
@ -3387,6 +3388,7 @@ qemuDomainChangeNetFilter(virDomainObj *vm,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("filters not supported on interfaces of type %s"),
virDomainNetTypeToString(virDomainNetGetActualType(newdev)));
@ -3739,6 +3741,7 @@ qemuDomainChangeNet(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("unable to change config on '%s' network type"),
virDomainNetTypeToString(newdev->type));

View File

@ -119,6 +119,7 @@ qemuInterfaceStartDevice(virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
/* these types all require no action */
break;
@ -206,6 +207,7 @@ qemuInterfaceStopDevice(virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
/* these types all require no action */
break;

View File

@ -3262,6 +3262,7 @@ qemuProcessNotifyNets(virDomainDef *def)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -8267,6 +8268,7 @@ void qemuProcessStop(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
/* No special cleanup procedure for these types. */
break;

View File

@ -1761,6 +1761,7 @@ qemuValidateNetSupportsCoalesce(virDomainNetType type)
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}

View File

@ -3973,6 +3973,7 @@ virVMXFormatEthernet(virDomainNetDef *def, int controller,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_VDS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"),
virDomainNetTypeToString(def->type));
return -1;

View File

@ -1070,6 +1070,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDS:
case VIR_DOMAIN_NET_TYPE_LAST:
vshError(ctl, _("No support for %s in command 'attach-interface'"),
type);