[PATCH 0/3] vmx: Fix new ethernet config seen in the wild

Descriptions in second and third patch ought to be enough. Martin Kletzander (3): vmx: Fix indentation conf, docs: Add support for dummy network interface vmx: Add support for dummy network interface 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 | 46 +++++++++++++------ .../vmx2xmldata/ethernet-unmanaged-nodev.vmx | 7 +++ .../vmx2xmldata/ethernet-unmanaged-nodev.xml | 23 ++++++++++ tests/vmx2xmltest.c | 1 + .../xml2vmx-ethernet-unmanaged-nodev.vmx | 13 ++++++ .../xml2vmx-ethernet-unmanaged-nodev.xml | 13 ++++++ tests/xml2vmxtest.c | 2 + tools/virsh-domain.c | 1 + 25 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 tests/vmx2xmldata/ethernet-unmanaged-nodev.vmx create mode 100644 tests/vmx2xmldata/ethernet-unmanaged-nodev.xml create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.xml -- 2.35.1

Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/vmx/vmx.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index f7261f5d2d96..318696fd56d5 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -3925,7 +3925,7 @@ virVMXFormatEthernet(virDomainNetDef *def, int controller, /* def:type, def:ifname -> vmx:connectionType */ switch (def->type) { - case VIR_DOMAIN_NET_TYPE_BRIDGE: + case VIR_DOMAIN_NET_TYPE_BRIDGE: virBufferAsprintf(buffer, "ethernet%d.networkName = \"%s\"\n", controller, def->data.bridge.brname); @@ -3941,22 +3941,22 @@ virVMXFormatEthernet(virDomainNetDef *def, int controller, break; - case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_USER: virBufferAsprintf(buffer, "ethernet%d.connectionType = \"nat\"\n", controller); break; - case VIR_DOMAIN_NET_TYPE_ETHERNET: - case VIR_DOMAIN_NET_TYPE_VHOSTUSER: - case VIR_DOMAIN_NET_TYPE_SERVER: - case VIR_DOMAIN_NET_TYPE_CLIENT: - case VIR_DOMAIN_NET_TYPE_MCAST: - case VIR_DOMAIN_NET_TYPE_NETWORK: - case VIR_DOMAIN_NET_TYPE_INTERNAL: - case VIR_DOMAIN_NET_TYPE_DIRECT: - case VIR_DOMAIN_NET_TYPE_HOSTDEV: - case VIR_DOMAIN_NET_TYPE_UDP: - case VIR_DOMAIN_NET_TYPE_VDPA: + case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + case VIR_DOMAIN_NET_TYPE_SERVER: + case VIR_DOMAIN_NET_TYPE_CLIENT: + case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_NETWORK: + case VIR_DOMAIN_NET_TYPE_INTERNAL: + case VIR_DOMAIN_NET_TYPE_DIRECT: + case VIR_DOMAIN_NET_TYPE_HOSTDEV: + case VIR_DOMAIN_NET_TYPE_UDP: + case VIR_DOMAIN_NET_TYPE_VDPA: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"), virDomainNetTypeToString(def->type)); return -1; -- 2.35.1

Signed-off-by: Martin Kletzander <mkletzan@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

On Thu, Aug 04, 2022 at 03:07:17PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@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> + ...
Calling this 'dummy' is not very desirable naming. Especially since the distributed switch config is handled separately, we're just left with the case of a network interface without any host backend. IMHO this should just be type="none", and would likely be viable for QEMU too. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Tue, Aug 23, 2022 at 11:39:10AM +0100, Daniel P. Berrangé wrote:
On Thu, Aug 04, 2022 at 03:07:17PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@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> + ...
Calling this 'dummy' is not very desirable naming. Especially since the distributed switch config is handled separately, we're just left with the case of a network interface without any host backend.
I'll gladly rename this, I don't like dummy neither, but the only thing I can think of is "unconnected". At first I went with existing type=direct, but without <target dev=/>, only with <target managed='no'/>, but that did not really make sense in my opinion.
IMHO this should just be type="none", and would likely be viable for QEMU too.
Unfortunately type="none" usually (in our XML) means there is none of this type of device (usb, memballoon, etc.), so I don't think that would make sense compared to rest of our XML. I also thought about having this in QEMU, but given how pointless this configuration is (and we just want to be able to express such configuration so that virt-v2v can convert such domains) I am not sure whether there's a point to adding this support to QEMU. And looking at the possibilities of what could be done on QEMU cmdline (without modifying QEMU), we would have to create a network device which is not connected anywhere, but QEMU does not support this, so the only way I found out was adding a hubport that's not connected anywhere, something like: -netdev hubport,id=test0,hubid=0 -device e1000e,netdev=test0 which emits a warning during startup: qemu-system-x86_64: warning: hub 0 is not connected to host network but as mentioned before, I think that's pointless to try to support it. Let me know what you think, I'm fine with any changes if it supports the now "fixed" scenario, but naming should better be fixed before a release. Thanks, Martin
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Tue, Aug 23, 2022 at 01:01:49PM +0200, Martin Kletzander wrote:
On Tue, Aug 23, 2022 at 11:39:10AM +0100, Daniel P. Berrangé wrote:
On Thu, Aug 04, 2022 at 03:07:17PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@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> + ...
Calling this 'dummy' is not very desirable naming. Especially since the distributed switch config is handled separately, we're just left with the case of a network interface without any host backend.
I'll gladly rename this, I don't like dummy neither, but the only thing I can think of is "unconnected". At first I went with existing type=direct, but without <target dev=/>, only with <target managed='no'/>, but that did not really make sense in my opinion.
IMHO this should just be type="none", and would likely be viable for QEMU too.
Unfortunately type="none" usually (in our XML) means there is none of this type of device (usb, memballoon, etc.), so I don't think that would make sense compared to rest of our XML.
Hmm, yes, good point. Some other ideas including yours.. type='unconnected' type='disconnected' type='unplugged' type='null' (as in /dev/null alike)
I also thought about having this in QEMU, but given how pointless this configuration is (and we just want to be able to express such configuration so that virt-v2v can convert such domains) I am not sure whether there's a point to adding this support to QEMU. And looking at the possibilities of what could be done on QEMU cmdline (without modifying QEMU), we would have to create a network device which is not connected anywhere, but QEMU does not support this, so the only way I found out was adding a hubport that's not connected anywhere, something like:
-netdev hubport,id=test0,hubid=0 -device e1000e,netdev=test0
which emits a warning during startup:
qemu-system-x86_64: warning: hub 0 is not connected to host network
but as mentioned before, I think that's pointless to try to support it.
You don't need a hub, it is fine to just have '-device e1000e' with no netdev property, but yes, that too generates a warning qemu-system-x86_64: warning: nic e1000e.0 has no peer The warning is trying to be helpful to detect mistakes of course, but if someone genuinely wants a disconnected NIC it is annoying. Anyway, there's no pressing need to implement QEMU support today, I just wanted to point out it is relevant to more than just vmware.
Let me know what you think, I'm fine with any changes if it supports the now "fixed" scenario, but naming should better be fixed before a release.
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Tue, Aug 23, 2022 at 12:10:14PM +0100, Daniel P. Berrangé wrote:
On Tue, Aug 23, 2022 at 01:01:49PM +0200, Martin Kletzander wrote:
On Tue, Aug 23, 2022 at 11:39:10AM +0100, Daniel P. Berrangé wrote:
On Thu, Aug 04, 2022 at 03:07:17PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@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> + ...
Calling this 'dummy' is not very desirable naming. Especially since the distributed switch config is handled separately, we're just left with the case of a network interface without any host backend.
I'll gladly rename this, I don't like dummy neither, but the only thing I can think of is "unconnected". At first I went with existing type=direct, but without <target dev=/>, only with <target managed='no'/>, but that did not really make sense in my opinion.
IMHO this should just be type="none", and would likely be viable for QEMU too.
Unfortunately type="none" usually (in our XML) means there is none of this type of device (usb, memballoon, etc.), so I don't think that would make sense compared to rest of our XML.
Hmm, yes, good point. Some other ideas including yours..
type='unconnected' type='disconnected' type='unplugged'
These seem to collide with <link state='down'/>, even though it really is what VMWare seems to do on the NIC as well, just that you cannot "plug" it anywhere.
type='null' (as in /dev/null alike)
but together with this they are all better than "dummy", I agree. Any preference before I send a rename patch?
I also thought about having this in QEMU, but given how pointless this configuration is (and we just want to be able to express such configuration so that virt-v2v can convert such domains) I am not sure whether there's a point to adding this support to QEMU. And looking at the possibilities of what could be done on QEMU cmdline (without modifying QEMU), we would have to create a network device which is not connected anywhere, but QEMU does not support this, so the only way I found out was adding a hubport that's not connected anywhere, something like:
-netdev hubport,id=test0,hubid=0 -device e1000e,netdev=test0
which emits a warning during startup:
qemu-system-x86_64: warning: hub 0 is not connected to host network
but as mentioned before, I think that's pointless to try to support it.
You don't need a hub, it is fine to just have '-device e1000e' with no netdev property, but yes, that too generates a warning
qemu-system-x86_64: warning: nic e1000e.0 has no peer
The warning is trying to be helpful to detect mistakes of course, but if someone genuinely wants a disconnected NIC it is annoying.
Anyway, there's no pressing need to implement QEMU support today, I just wanted to point out it is relevant to more than just vmware.
Sure, it might be, and anyone can implement it later on, that's why I only used the VMWare scenario as an "example".
Let me know what you think, I'm fine with any changes if it supports the now "fixed" scenario, but naming should better be fixed before a release.
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Wed, Aug 24, 2022 at 04:09:31PM +0200, Martin Kletzander wrote:
On Tue, Aug 23, 2022 at 12:10:14PM +0100, Daniel P. Berrangé wrote:
On Tue, Aug 23, 2022 at 01:01:49PM +0200, Martin Kletzander wrote:
On Tue, Aug 23, 2022 at 11:39:10AM +0100, Daniel P. Berrangé wrote:
On Thu, Aug 04, 2022 at 03:07:17PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@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> + ...
Calling this 'dummy' is not very desirable naming. Especially since the distributed switch config is handled separately, we're just left with the case of a network interface without any host backend.
I'll gladly rename this, I don't like dummy neither, but the only thing I can think of is "unconnected". At first I went with existing type=direct, but without <target dev=/>, only with <target managed='no'/>, but that did not really make sense in my opinion.
IMHO this should just be type="none", and would likely be viable for QEMU too.
Unfortunately type="none" usually (in our XML) means there is none of this type of device (usb, memballoon, etc.), so I don't think that would make sense compared to rest of our XML.
Hmm, yes, good point. Some other ideas including yours..
type='unconnected' type='disconnected' type='unplugged'
These seem to collide with <link state='down'/>, even though it really is what VMWare seems to do on the NIC as well, just that you cannot "plug" it anywhere.
type='null' (as in /dev/null alike)
but together with this they are all better than "dummy", I agree. Any preference before I send a rename patch?
Perhaps a mild preference for the shorter names 'null' or 'unplugged'. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Wed, Aug 24, 2022 at 03:12:53PM +0100, Daniel P. Berrangé wrote:
On Wed, Aug 24, 2022 at 04:09:31PM +0200, Martin Kletzander wrote:
On Tue, Aug 23, 2022 at 12:10:14PM +0100, Daniel P. Berrangé wrote:
On Tue, Aug 23, 2022 at 01:01:49PM +0200, Martin Kletzander wrote:
On Tue, Aug 23, 2022 at 11:39:10AM +0100, Daniel P. Berrangé wrote:
On Thu, Aug 04, 2022 at 03:07:17PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@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> + ...
Calling this 'dummy' is not very desirable naming. Especially since the distributed switch config is handled separately, we're just left with the case of a network interface without any host backend.
I'll gladly rename this, I don't like dummy neither, but the only thing I can think of is "unconnected". At first I went with existing type=direct, but without <target dev=/>, only with <target managed='no'/>, but that did not really make sense in my opinion.
IMHO this should just be type="none", and would likely be viable for QEMU too.
Unfortunately type="none" usually (in our XML) means there is none of this type of device (usb, memballoon, etc.), so I don't think that would make sense compared to rest of our XML.
Hmm, yes, good point. Some other ideas including yours..
type='unconnected' type='disconnected' type='unplugged'
These seem to collide with <link state='down'/>, even though it really is what VMWare seems to do on the NIC as well, just that you cannot "plug" it anywhere.
type='null' (as in /dev/null alike)
but together with this they are all better than "dummy", I agree. Any preference before I send a rename patch?
Perhaps a mild preference for the shorter names 'null' or 'unplugged'.
OK, thanks, I'll go with 'null' then unless someone else expresses another preference.
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Also map it to an ethernet without connectionType and networkName. https://bugzilla.redhat.com/show_bug.cgi?id=1988211 Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/vmx/vmx.c | 21 ++++++++++++++--- .../vmx2xmldata/ethernet-unmanaged-nodev.vmx | 7 ++++++ .../vmx2xmldata/ethernet-unmanaged-nodev.xml | 23 +++++++++++++++++++ tests/vmx2xmltest.c | 1 + .../xml2vmx-ethernet-unmanaged-nodev.vmx | 13 +++++++++++ .../xml2vmx-ethernet-unmanaged-nodev.xml | 13 +++++++++++ tests/xml2vmxtest.c | 2 ++ 7 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 tests/vmx2xmldata/ethernet-unmanaged-nodev.vmx create mode 100644 tests/vmx2xmldata/ethernet-unmanaged-nodev.xml create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.xml diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 95e2d4ae249c..49eef12e3ea7 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2826,7 +2826,7 @@ virVMXParseEthernet(virConf *conf, int controller, virDomainNetDef **def) STRCASEEQ(connectionType, "bridged") || STRCASEEQ(connectionType, "custom")) { if (virVMXGetConfigString(conf, networkName_name, &networkName, - false) < 0) + true) < 0) goto cleanup; } @@ -2837,7 +2837,20 @@ virVMXParseEthernet(virConf *conf, int controller, virDomainNetDef **def) } /* Setup virDomainNetDef */ - if (connectionType == NULL || STRCASEEQ(connectionType, "bridged")) { + if (connectionType == NULL && networkName == NULL) { + /* + * Having neither a connectionType nor a network name can mean two + * things: + * + * 1) there is no connection of that nic + * 2) the nic is connected to VMWare Distributed Switch + * + * But we do not see any difference between these and hence we report + * the closest thing to at least make virt-v2v and others work when they + * read the domain XML. + */ + (*def)->type = VIR_DOMAIN_NET_TYPE_DUMMY; + } else if (connectionType == NULL || STRCASEEQ(connectionType, "bridged")) { (*def)->type = VIR_DOMAIN_NET_TYPE_BRIDGE; (*def)->data.bridge.brname = g_steal_pointer(&networkName); } else if (STRCASEEQ(connectionType, "hostonly")) { @@ -3946,6 +3959,9 @@ virVMXFormatEthernet(virDomainNetDef *def, int controller, controller); break; + case VIR_DOMAIN_NET_TYPE_DUMMY: + break; + case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_SERVER: @@ -3957,7 +3973,6 @@ 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/tests/vmx2xmldata/ethernet-unmanaged-nodev.vmx b/tests/vmx2xmldata/ethernet-unmanaged-nodev.vmx new file mode 100644 index 000000000000..6e08536337f7 --- /dev/null +++ b/tests/vmx2xmldata/ethernet-unmanaged-nodev.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +ethernet0.present = "true" +ethernet0.virtualDev = "e1000e" +ethernet0.addressType = "vpx" +ethernet0.generatedAddress = "00:50:56:87:65:43" +displayName = "test" diff --git a/tests/vmx2xmldata/ethernet-unmanaged-nodev.xml b/tests/vmx2xmldata/ethernet-unmanaged-nodev.xml new file mode 100644 index 000000000000..a31243033785 --- /dev/null +++ b/tests/vmx2xmldata/ethernet-unmanaged-nodev.xml @@ -0,0 +1,23 @@ +<domain type='vmware'> + <name>test</name> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory unit='KiB'>32768</memory> + <currentMemory unit='KiB'>32768</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <interface type='dummy'> + <mac address='00:50:56:87:65:43' type='generated'/> + <model type='e1000e'/> + </interface> + <video> + <model type='vmvga' vram='4096' primary='yes'/> + </video> + </devices> +</domain> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index dbd771017bf3..e08079512b53 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -236,6 +236,7 @@ mymain(void) DO_TEST("ethernet-static"); DO_TEST("ethernet-vpx"); DO_TEST("ethernet-other"); + DO_TEST("ethernet-unmanaged-nodev"); DO_TEST("serial-file"); DO_TEST("serial-device"); diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.vmx b/tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.vmx new file mode 100644 index 000000000000..41ba2967c08f --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.vmx @@ -0,0 +1,13 @@ +.encoding = "UTF-8" +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "ethernet-vpx" +memsize = "4" +numvcpus = "1" +floppy0.present = "false" +floppy1.present = "false" +ethernet0.present = "true" +ethernet0.addressType = "vpx" +ethernet0.generatedAddress = "00:50:56:87:65:43" diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.xml b/tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.xml new file mode 100644 index 000000000000..a071b2f21513 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.xml @@ -0,0 +1,13 @@ +<domain type='vmware'> + <name>ethernet-vpx</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <interface type='dummy'> + <mac address='00:50:56:87:65:43'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 1a7f2e4f3390..0ea213d5d5cd 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -225,6 +225,8 @@ mymain(void) DO_TEST("ethernet-other", "ethernet-other", 4); DO_TEST("ethernet-mac-type", "ethernet-mac-type", 4); + DO_TEST("ethernet-unmanaged-nodev", "ethernet-unmanaged-nodev", 4); + DO_TEST("serial-file", "serial-file", 4); DO_TEST("serial-device", "serial-device", 4); DO_TEST("serial-pipe", "serial-pipe", 4); -- 2.35.1

On a Thursday in 2022, Martin Kletzander wrote:
Descriptions in second and third patch ought to be enough.
for everyone.
Martin Kletzander (3): vmx: Fix indentation conf, docs: Add support for dummy network interface vmx: Add support for dummy network interface
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 | 46 +++++++++++++------ .../vmx2xmldata/ethernet-unmanaged-nodev.vmx | 7 +++ .../vmx2xmldata/ethernet-unmanaged-nodev.xml | 23 ++++++++++ tests/vmx2xmltest.c | 1 + .../xml2vmx-ethernet-unmanaged-nodev.vmx | 13 ++++++ .../xml2vmx-ethernet-unmanaged-nodev.xml | 13 ++++++ tests/xml2vmxtest.c | 2 + tools/virsh-domain.c | 1 + 25 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 tests/vmx2xmldata/ethernet-unmanaged-nodev.vmx create mode 100644 tests/vmx2xmldata/ethernet-unmanaged-nodev.xml create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-unmanaged-nodev.xml
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (3)
-
Daniel P. Berrangé
-
Ján Tomko
-
Martin Kletzander