From nobody Fri Oct 18 06:23:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1720443208822376.4943056512644; Mon, 8 Jul 2024 05:53:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6E37812BD; Mon, 8 Jul 2024 08:53:27 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7B5D411DF; Mon, 8 Jul 2024 08:52:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A353511D7; Mon, 8 Jul 2024 08:52:57 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B1CCA11D4 for ; Mon, 8 Jul 2024 08:52:56 -0400 (EDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-tMD-SDHdNbSPqWhBOcNzrg-1; Mon, 08 Jul 2024 08:52:54 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42668699453so10280435e9.3 for ; Mon, 08 Jul 2024 05:52:54 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678a23b349sm15929283f8f.36.2024.07.08.05.52.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 05:52:52 -0700 (PDT) Received: from wheatley.pinto-pinecone.ts.net (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 8CC2D1C73F2EE for ; Mon, 08 Jul 2024 14:52:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720443176; h=from:from: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; bh=TIl4ygrbQDR7moCmTOWH/aWcDkz/K0/T+3iTMtQ7Ngg=; b=WkYE4YrQklWk3z7r5rdkJbKh82eYa/zAHPpBLgY2jFJ+voiauSlOcm2aAjsB3jffTZePAI RKWr5aveQgsI4UTmJLDaJbXJUxmgy1FvSBGrEsFALUT2j6R7eIjRf+U4TJ7M39tJ6aLm6c 5UBpcpIMNdWW5X52U0LvPDSNUeTFL0g= X-MC-Unique: tMD-SDHdNbSPqWhBOcNzrg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720443173; x=1721047973; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TIl4ygrbQDR7moCmTOWH/aWcDkz/K0/T+3iTMtQ7Ngg=; b=DOPFrHeT8ab5KorBn1rTRqBjCJfqzGtrPia+AEjhrUL599NvNB2JHCgzYHaon4q72f UqnpDA724bBiokD+Dr3R23k079PD9JTLKcXS1SWyhe10cweNMS0MK90+FlEcM0s0OVXn qfkbrmHW2ZRE4mx6BvArZ1sc+28PuNelMdoG7K/2bg8xuykOdFnH5mQRBtNoeZiyV0+Q UoAiaxVCuA/uvkONAqpe7cUhJmaJn3wphOrPUyPQxkaYAPGPG6J1d2YuR3isEHDB9sxg VCe2azJroDNFa4BIk/6+c87BwcdnRCD8DNuoazRHnISNSSSBAuQsZYURaOZDPiY5cXf3 1lrQ== X-Gm-Message-State: AOJu0YzA3q7fP6267dDnQy9ldD91wsh5Btcx5OKTVa5WfX02uQ9oL8/2 LaHR5c0hHlTf7bkZssgoUhHeWIc15znYbRw0F4wecuQL6xDMBEsyBBZC7fuy4Gl8bU3xD1Gd9To fS3mYq/vVg0I7XeDR3k/MF393ZgbMukt3cowpOg7/GbLhvXfKP+KqEKB6QEUCla283SG0yDFOMs 9jwSnF2DdSXO0Et3i/ROsKh0NQDRcllZ5JjJdSvnc= X-Received: by 2002:a5d:4c41:0:b0:367:8ff5:5870 with SMTP id ffacd0b85a97d-3679dd6673emr9341452f8f.47.1720443173790; Mon, 08 Jul 2024 05:52:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYcOxBQMx9E1yDPzW7gPjMhtC1+zQeTMuwEo4Rd3bD2hnb8/TTV9ju2tcaTliVDVd+X+JrXw== X-Received: by 2002:a5d:4c41:0:b0:367:8ff5:5870 with SMTP id ffacd0b85a97d-3679dd6673emr9341437f8f.47.1720443173329; Mon, 08 Jul 2024 05:52:53 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH] vmx: Do not require all ID data for VMWare Distributed Switch Date: Mon, 8 Jul 2024 14:52:51 +0200 Message-ID: <7fa1180fb609c08e47caab74aa68b67e8f241c55.1720443170.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5M5J3D26RNMIPAHOOA6KV3FNN47F4WBX X-Message-ID-Hash: 5M5J3D26RNMIPAHOOA6KV3FNN47F4WBX X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1720443210025100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Similarly to commit 2482801608b8 we can safely ignore connectionId, portId and portgroupId in both XML and VMX as they are only a blind pass-through between XML and VMX and an ethernet without such parameters was spotted in the wild. On top of that even our documentation says the whole VMWare Distrubuted Switch configuration is a best-effort. Resolves: https://issues.redhat.com/browse/RHEL-46099 Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- src/conf/domain_conf.c | 11 ++++----- src/conf/schemas/domaincommon.rng | 24 ++++++++++++------- src/vmx/vmx.c | 24 ++++++++++++------- ...-portid.vmx =3D> ethernet-vds-no-params.vmx} | 2 -- ...-portid.xml =3D> ethernet-vds-no-params.xml} | 2 +- 5 files changed, 37 insertions(+), 26 deletions(-) rename tests/vmx2xmldata/{ethernet-vds-no-portid.vmx =3D> ethernet-vds-no-= params.vmx} (76%) rename tests/vmx2xmldata/{ethernet-vds-no-portid.xml =3D> ethernet-vds-no-= params.xml} (82%) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6080f4f90a54..bfef89e1beae 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9593,15 +9593,14 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, def->data.vds.switch_id) < 0) return NULL; =20 - if (virXMLPropLongLong(source_node, "portid", 0, VIR_XML_PROP_REQU= IRED, - &def->data.vds.port_id, def->data.vds.port_= id) < 0) + if (virXMLPropLongLong(source_node, "portid", 0, VIR_XML_PROP_NONE, + &def->data.vds.port_id, 0) < 0) return NULL; =20 - if (!(def->data.vds.portgroup_id =3D virXMLPropStringRequired(sour= ce_node, "portgroupid"))) - return NULL; + def->data.vds.portgroup_id =3D virXMLPropString(source_node, "port= groupid"); =20 - if (virXMLPropLongLong(source_node, "connectionid", 0, VIR_XML_PRO= P_REQUIRED, - &def->data.vds.connection_id, def->data.vds= .connection_id) < 0) + if (virXMLPropLongLong(source_node, "connectionid", 0, VIR_XML_PRO= P_NONE, + &def->data.vds.connection_id, 0) < 0) return NULL; =20 break; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index b163e4eece09..2d23fcf12375 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -3684,15 +3684,21 @@ - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index d082a0766010..e5bc2d793c66 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2896,7 +2896,7 @@ virVMXParseEthernet(virConf *conf, int controller, vi= rDomainNetDef **def) if (virVMXGetConfigString(conf, portgroupId_name, &(*def)->data.vds.portgroup_id, - false) < 0 || + true) < 0 || virVMXGetConfigLong(conf, portId_name, &(*def)->data.vds.port_id, @@ -2906,7 +2906,7 @@ virVMXParseEthernet(virConf *conf, int controller, vi= rDomainNetDef **def) connectionId_name, &(*def)->data.vds.connection_id, 0, - false) < 0) + true) < 0) goto cleanup; } else if (connectionType =3D=3D NULL && networkName =3D=3D NULL) { (*def)->type =3D VIR_DOMAIN_NET_TYPE_NULL; @@ -4038,14 +4038,22 @@ virVMXFormatEthernet(virDomainNetDef *def, int cont= roller, uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uui= d[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]= ); =20 - virBufferAsprintf(buffer, "ethernet%d.dvs.portId =3D \"%lld\"\n", - controller, def->data.vds.port_id); + if (def->data.vds.port_id) { + virBufferAsprintf(buffer, "ethernet%d.dvs.portId =3D \"%lld\"\= n", + controller, def->data.vds.port_id); + } + + if (def->data.vds.portgroup_id) { + virBufferAsprintf(buffer, "ethernet%d.dvs.", controller); + virBufferEscapeString(buffer, "portgroupId =3D \"%s\"\n", + def->data.vds.portgroup_id); + } =20 - virBufferAsprintf(buffer, "ethernet%d.dvs.", controller); - virBufferEscapeString(buffer, "portgroupId =3D \"%s\"\n", def->dat= a.vds.portgroup_id); + if (def->data.vds.connection_id) { + virBufferAsprintf(buffer, "ethernet%d.dvs.connectionId =3D \"%= lld\"\n", + controller, def->data.vds.connection_id); + } =20 - virBufferAsprintf(buffer, "ethernet%d.dvs.connectionId =3D \"%lld\= "\n", - controller, def->data.vds.connection_id); break; } =20 diff --git a/tests/vmx2xmldata/ethernet-vds-no-portid.vmx b/tests/vmx2xmlda= ta/ethernet-vds-no-params.vmx similarity index 76% rename from tests/vmx2xmldata/ethernet-vds-no-portid.vmx rename to tests/vmx2xmldata/ethernet-vds-no-params.vmx index 7761accb3abc..90afbdac30cd 100644 --- a/tests/vmx2xmldata/ethernet-vds-no-portid.vmx +++ b/tests/vmx2xmldata/ethernet-vds-no-params.vmx @@ -5,6 +5,4 @@ ethernet0.virtualDev =3D "e1000e" ethernet0.addressType =3D "vpx" ethernet0.generatedAddress =3D "00:50:56:87:65:43" ethernet0.dvs.switchId =3D "50 34 26 b2 94 e9 3b 16-1d 68 87 bf ff 4a 54 4= 0" -ethernet0.dvs.portgroupId =3D "dvportgroup-1285" -ethernet0.dvs.connectionId =3D "408217997" displayName =3D "test" diff --git a/tests/vmx2xmldata/ethernet-vds-no-portid.xml b/tests/vmx2xmlda= ta/ethernet-vds-no-params.xml similarity index 82% rename from tests/vmx2xmldata/ethernet-vds-no-portid.xml rename to tests/vmx2xmldata/ethernet-vds-no-params.xml index 60fd9c99feb9..0011ba471a50 100644 --- a/tests/vmx2xmldata/ethernet-vds-no-portid.xml +++ b/tests/vmx2xmldata/ethernet-vds-no-params.xml @@ -14,7 +14,7 @@ - +