Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
docs/formatdomain.rst | 24 ++++++++++++++++++++++++
src/ch/ch_monitor.c | 1 +
src/conf/domain_conf.c | 10 ++++++++++
src/conf/domain_conf.h | 1 +
src/conf/netdev_bandwidth_conf.c | 1 +
src/conf/schemas/domaincommon.rng | 7 +++++++
src/libxl/libxl_conf.c | 1 +
src/libxl/xen_common.c | 1 +
src/lxc/lxc_controller.c | 1 +
src/lxc/lxc_driver.c | 3 +++
src/lxc/lxc_process.c | 4 +++-
src/qemu/qemu_command.c | 4 ++++
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_hotplug.c | 3 +++
src/qemu/qemu_interface.c | 2 ++
src/qemu/qemu_process.c | 2 ++
src/qemu/qemu_validate.c | 1 +
src/vmx/vmx.c | 1 +
tools/virsh-domain.c | 1 +
19 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index adfdd7b7a5ac..ed0d9c19593b 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -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
^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index fe3c1237c4d1..67ca4a7a0dcd 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -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);
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 50338b636563..7764b1054d6f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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)));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 724265b6b528..7b81acf5db3b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -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;
diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
index 4d9f855916d7..58d166901a8c 100644
--- a/src/conf/netdev_bandwidth_conf.c
+++ b/src/conf/netdev_bandwidth_conf.c
@@ -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;
}
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index c4f293a4c35e..5d530f957b0d 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -3433,6 +3433,13 @@
</interleave>
</group>
+ <group>
+ <attribute name="type">
+ <value>dummy</value>
+ </attribute>
+ <ref name="interface-options"/>
+ </group>
+
</choice>
<optional>
<attribute name="trustGuestRxFilters">
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index aa3d7925ec8f..92e4e0ee605f 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -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"),
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index b97ba0a199c1..d90ec674e5f6 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -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;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index a71a662ebda7..c63f4b14eaf8 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -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));
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 6b2f721178ac..6bd2cdd205d4 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -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;
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index f9854ac1389d..fab23fa2b11f 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -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;
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3f65b8adc794..ff7d432ccd2a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 69e0c9e217c0..bc44687958f8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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;
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5eb370c3dfd4..2c2c270eb946 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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));
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index cf8117d9961a..fa34ecd5130f 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -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;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d29da6324234..dc3055a04b46 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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;
}
@@ -8340,6 +8341,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;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 41349829defd..8d26b43f731c 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -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;
}
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 318696fd56d5..95e2d4ae249c 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -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;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1f995a462adb..451f51d633d8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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);
--
2.35.1