conf, docs: Add support for dummy network 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-04 10:26:40 +02:00
parent e3f9dbc31e
commit bac6b266fb
19 changed files with 68 additions and 1 deletions

View File

@ -5240,6 +5240,30 @@ which the UDP socket packets will originate from the QEMU host. :since:`Since
</devices>
...
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`
::
...
<devices>
<interface type='dummy'>
<mac address='52:54:00:22:c9:42'/>
</interface>
</devices>
...
Setting the NIC model
^^^^^^^^^^^^^^^^^^^^^

View File

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

View File

@ -573,6 +573,7 @@ VIR_ENUM_IMPL(virDomainNet,
"hostdev",
"udp",
"vdpa",
"dummy",
);
VIR_ENUM_IMPL(virDomainNetModel,
@ -2495,6 +2496,7 @@ virDomainActualNetDefFree(virDomainActualNetDef *def)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -2621,6 +2623,7 @@ virDomainNetDefFree(virDomainNetDef *def)
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -9312,6 +9315,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -9490,6 +9494,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_VDPA:
break;
case VIR_DOMAIN_NET_TYPE_LAST:
@ -23681,6 +23686,7 @@ virDomainNetDefFormat(virBuffer *buf,
break;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -28296,6 +28302,7 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -28309,6 +28316,7 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
return NULL;
@ -29305,6 +29313,7 @@ virDomainNetTypeSharesHostView(const virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -29568,6 +29577,7 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unexpected network port type %s"),
virDomainNetTypeToString(virDomainNetGetActualType(iface)));

View File

@ -939,6 +939,7 @@ typedef enum {
VIR_DOMAIN_NET_TYPE_HOSTDEV,
VIR_DOMAIN_NET_TYPE_UDP,
VIR_DOMAIN_NET_TYPE_VDPA,
VIR_DOMAIN_NET_TYPE_DUMMY,
VIR_DOMAIN_NET_TYPE_LAST
} virDomainNetType;

View File

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

View File

@ -3433,6 +3433,13 @@
</interleave>
</group>
<group>
<attribute name="type">
<value>dummy</value>
</attribute>
<ref name="interface-options"/>
</group>
</choice>
<optional>
<attribute name="trustGuestRxFilters">

View File

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

View File

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

View File

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

View File

@ -3465,6 +3465,7 @@ lxcDomainAttachDeviceNetLive(virLXCDriver *driver,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Network device type is not supported"));
goto cleanup;
@ -3520,6 +3521,7 @@ lxcDomainAttachDeviceNetLive(virLXCDriver *driver,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
default:
/* no-op */
@ -3962,6 +3964,7 @@ lxcDomainDetachDeviceNetLive(virDomainObj *vm,
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only bridged veth devices can be detached"));
goto cleanup;

View File

@ -594,9 +594,10 @@ virLXCProcessSetupInterfaces(virLXCDriver *driver,
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_LAST:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unsupported network type %s"),
virDomainNetTypeToString(type));
@ -1607,6 +1608,7 @@ virLXCProcessReconnectNotifyNets(virDomainDef *def)
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}

View File

@ -4351,6 +4351,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_LAST:
break;
}
@ -8834,6 +8835,7 @@ qemuBuildInterfaceConnect(virDomainObj *vm,
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
@ -8931,6 +8933,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_UDP:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
/* nada */
break;
@ -8969,6 +8972,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
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

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

View File

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

View File

@ -118,6 +118,7 @@ qemuInterfaceStartDevice(virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
/* these types all require no action */
break;
@ -204,6 +205,7 @@ qemuInterfaceStopDevice(virDomainNetDef *net)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_VDPA:
case VIR_DOMAIN_NET_TYPE_DUMMY:
case VIR_DOMAIN_NET_TYPE_LAST:
/* these types all require no action */
break;

View File

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

View File

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

View File

@ -3957,6 +3957,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_DUMMY:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"),
virDomainNetTypeToString(def->type));
return -1;

View File

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