From nobody Sun Feb 8 12:20:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1659618455; cv=none; d=zohomail.com; s=zohoarc; b=LuG3cVnUcGKV4GMqPlnS6oLphghyHvxNPf2cay8w6+TuW0bwT+x1ZnPe9OczZBXWK9W0gRd7hhmfvu7A7triDbU4WNcj8vuwr6mowEj8yQjtOcM5ltzFGdyTQx/ogCThfvylGqr8lga21RbcqzhGjOnlkJntK7M4/tlB6oIm9Mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659618455; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pxv039X5QHLDhb5h1tf4/pBjjReQG00Su7BBMgPHcPU=; b=Xm86afrg9Nq2x2SB8+e77KWGN3q5i44suG/Gt3GyDuQVRLg7oBXoVVYxfPSUQxRZHrCAlDSQjoJUk4dJnUHjXdOvbOE1aaAZzCY3R08jUMWvZZeqqvXgOZMrSC75ZFYRH/RRzQORp6RXBdDBPw+um44pKktOaQQLaKXq8RMx/3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1659618455831460.57491684878903; Thu, 4 Aug 2022 06:07:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-WzFNwZyXPm2E3ImM_RMeGg-1; Thu, 04 Aug 2022 09:07:30 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D22793C01C17; Thu, 4 Aug 2022 13:07:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBB80492CA7; Thu, 4 Aug 2022 13:07:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D036F1946A76; Thu, 4 Aug 2022 13:07:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1209E1946A72 for ; Thu, 4 Aug 2022 13:07:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 05F132166B2B; Thu, 4 Aug 2022 13:07:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 024092166B2A for ; Thu, 4 Aug 2022 13:07:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DBE913802120 for ; Thu, 4 Aug 2022 13:07:25 +0000 (UTC) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-eH1c4O2RMrKG5VxRmfCNRg-1; Thu, 04 Aug 2022 09:07:24 -0400 Received: by mail-ed1-f72.google.com with SMTP id i5-20020a05640242c500b0043e50334109so2767389edc.1 for ; Thu, 04 Aug 2022 06:07:24 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id s14-20020a508d0e000000b0043cc7a3ff7fsm658490eds.33.2022.08.04.06.07.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 06:07:22 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 446628A1893E for ; Thu, 4 Aug 2022 15:07:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659618453; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pxv039X5QHLDhb5h1tf4/pBjjReQG00Su7BBMgPHcPU=; b=NN1VjhVnnLxWBxr984828MbE4bUd6hd6CqpH3bvb6fLJbaDfqP8sWGWx5DBwFutBktxa8e XEHs/ShVewbAJ0t3LO0YihXnVa4mxgnfkiRlNWaei3G0VYJGbmXOsXhEjEtKVGIxs2KZvO YUlS/fCItMz0954l8QhHeNU58cUwaTk= X-MC-Unique: WzFNwZyXPm2E3ImM_RMeGg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: eH1c4O2RMrKG5VxRmfCNRg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pxv039X5QHLDhb5h1tf4/pBjjReQG00Su7BBMgPHcPU=; b=pd+Tl9HE8XpWgOxO8f3sl6QpHmJAieJaxRwrxHzvivxGq1tG77kNNYmqZCC7NTMkKZ /55Fj9TzB+CQR9K//1uRS/XFlmDa4pAGP9FA3Iw4Tq3DX5leky+VJ/NYxu3c4lG3xpyh EqHDK8z5kPyeiq6+ddd2Vmp4srbg7TVZa1A9KeZcBiDb84/6U8sYyMd/SkcEHOKVaYTC bMxQaw151mnwAXIuNhv5fpkJwnXLJW0kAhU0HoodW2HH7OTLNheKws8o/IsP+KBB7iz2 Y7q8XYrv0bob0/r0DG9YlHc2x7JdGM7Cpv6gH+76mgevMMqZj/U6/qZnxQotvdO+7Yn0 1Pgw== X-Gm-Message-State: ACgBeo3ebjU8fEk2OSHHYJNfNSx0et9JdmgRPRV92vvlZIOSmXCw62J9 d2N4kJg9YwuEdgXs1OwLwW8r224uIkDMdRVgCvyvuo+gjzvejrDRAdyG8GwzIjLG8X2nRf99uGw 3KYGyZy6LNuo2+4TlxPkc/a914IEcvXtJwqoO5yNbsok4yFmcKoZa5fgfucx0bofG3XVIJW8= X-Received: by 2002:a17:906:cc0d:b0:730:d6f3:277a with SMTP id ml13-20020a170906cc0d00b00730d6f3277amr1045334ejb.579.1659618443503; Thu, 04 Aug 2022 06:07:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR5fK2zPG87/d1MlL5BJ8mCXgnE1i6v5o98xeTvJB3rZQZ+NAPnhI9XsWZEMKF55ygaAVTqebA== X-Received: by 2002:a17:906:cc0d:b0:730:d6f3:277a with SMTP id ml13-20020a170906cc0d00b00730d6f3277amr1045307ejb.579.1659618443186; Thu, 04 Aug 2022 06:07:23 -0700 (PDT) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 3/3] vmx: Add support for dummy network interface Date: Thu, 4 Aug 2022 15:07:18 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659618457266100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Also map it to an ethernet without connectionType and networkName. https://bugzilla.redhat.com/show_bug.cgi?id=3D1988211 Signed-off-by: Martin Kletzander --- 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, vi= rDomainNetDef **def) STRCASEEQ(connectionType, "bridged") || STRCASEEQ(connectionType, "custom")) { if (virVMXGetConfigString(conf, networkName_name, &networkName, - false) < 0) + true) < 0) goto cleanup; } =20 @@ -2837,7 +2837,20 @@ virVMXParseEthernet(virConf *conf, int controller, v= irDomainNetDef **def) } =20 /* Setup virDomainNetDef */ - if (connectionType =3D=3D NULL || STRCASEEQ(connectionType, "bridged")= ) { + if (connectionType =3D=3D NULL && networkName =3D=3D 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 rep= ort + * the closest thing to at least make virt-v2v and others work whe= n they + * read the domain XML. + */ + (*def)->type =3D VIR_DOMAIN_NET_TYPE_DUMMY; + } else if (connectionType =3D=3D NULL || STRCASEEQ(connectionType, "br= idged")) { (*def)->type =3D VIR_DOMAIN_NET_TYPE_BRIDGE; (*def)->data.bridge.brname =3D g_steal_pointer(&networkName); } else if (STRCASEEQ(connectionType, "hostonly")) { @@ -3946,6 +3959,9 @@ virVMXFormatEthernet(virDomainNetDef *def, int contro= ller, controller); break; =20 + 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 contro= ller, 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/vmx2xml= data/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 =3D "8" +virtualHW.version =3D "4" +ethernet0.present =3D "true" +ethernet0.virtualDev =3D "e1000e" +ethernet0.addressType =3D "vpx" +ethernet0.generatedAddress =3D "00:50:56:87:65:43" +displayName =3D "test" diff --git a/tests/vmx2xmldata/ethernet-unmanaged-nodev.xml b/tests/vmx2xml= data/ethernet-unmanaged-nodev.xml new file mode 100644 index 000000000000..a31243033785 --- /dev/null +++ b/tests/vmx2xmldata/ethernet-unmanaged-nodev.xml @@ -0,0 +1,23 @@ + + test + 00000000-0000-0000-0000-000000000000 + 32768 + 32768 + 1 + + hvm + + + destroy + restart + destroy + + + + + + + + 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"); =20 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 =3D "UTF-8" +config.version =3D "8" +virtualHW.version =3D "4" +guestOS =3D "other" +uuid.bios =3D "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName =3D "ethernet-vpx" +memsize =3D "4" +numvcpus =3D "1" +floppy0.present =3D "false" +floppy1.present =3D "false" +ethernet0.present =3D "true" +ethernet0.addressType =3D "vpx" +ethernet0.generatedAddress =3D "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 @@ + + ethernet-vpx + 564d9bef-acd9-b4e0-c8f0-aea8b9103515 + 4096 + + hvm + + + + + + + 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); =20 + 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); --=20 2.35.1