From nobody Sun Apr 28 04:32:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1595262768; cv=none; d=zohomail.com; s=zohoarc; b=VHCTHg4Qk85VHNkqdD7W9oW1wTEiHj5mNpXh5eqDYCuW8281bmicsBaxzvho8iWJB5kzI/CVoH+a1ODYWBh32GrEvwOGj2mnVom/2sNpi/+hn+iZ2EwSg1qWqrmZB2PosdXR6s6GGFRQJWMbSVofdz5eg0+/25z8g0vcTsDANm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595262768; h=Content-Type:Content-Transfer-Encoding:Cc: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=bNG6ecI8jD2injToOEXSj2iN13PJHyCJFjwHXfX5yeU=; b=diLPlxlOfR/EQJnaTry6uU0kSozpiTNVBsToqJ35Jqi6fGHkcFqOkjX/y/x8gSj75M7tTnH5szvMKRcI9MNVpGE2EZ2K75hmzt8NFO/ZAyO3+mCdyvDjwN+HoigqHONHPhduVjuTHrplHls1sk+RDnPqgRtVn0RmmeYlrTyETEc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1595262768716252.70393764085838; Mon, 20 Jul 2020 09:32:48 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-Ha8pTo13MUCxr0BdFnitaQ-1; Mon, 20 Jul 2020 12:32:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 258FF1096; Mon, 20 Jul 2020 16:32:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02C7B797FC; Mon, 20 Jul 2020 16:32:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C5BA19A158; Mon, 20 Jul 2020 16:32:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06KGWNV5010452 for ; Mon, 20 Jul 2020 12:32:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id B2BB95C298; Mon, 20 Jul 2020 16:32:23 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC7F65C1D4; Mon, 20 Jul 2020 16:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595262767; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=bNG6ecI8jD2injToOEXSj2iN13PJHyCJFjwHXfX5yeU=; b=I1yID0vcEdl/Ejmv6so93DRd4tQGjy+7Dq+AeD0flsyLXTNH+/6BKWLY+svqUb9vz1fnv5 zUnQoefjM/pYXfRZVNGH136IHOTKl01lu3FvRgdo9ab1uSui/PTNlNSXPdAz8mwWdhxbIH TaoejX0PRcpw2F2X9VviVStDsKzFUM0= X-MC-Unique: Ha8pTo13MUCxr0BdFnitaQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] vmx: fix logic handling mac address type Date: Mon, 20 Jul 2020 17:32:15 +0100 Message-Id: <20200720163217.1796949-2-berrange@redhat.com> In-Reply-To: <20200720163217.1796949-1-berrange@redhat.com> References: <20200720163217.1796949-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Michal Privoznik , Bastien Orivel X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) With the current formatter, the XML snippets: result in ethernet1.present =3D "true" ethernet1.networkName =3D "br1" ethernet1.connectionType =3D "bridged" ethernet1.addressType =3D "static" ethernet1.address =3D "00:0c:29:dd:ee:fe" ethernet1.checkMACAddress =3D "false" ethernet2.present =3D "true" ethernet2.networkName =3D "br2" ethernet2.connectionType =3D "bridged" ethernet2.addressType =3D "static" ethernet2.address =3D "aa:bb:cc:dd:ee:fd" ethernet2.checkMACAddress =3D "false" which is flawed, as both type=3D'static' and type=3D'generated' in the XML turn into 'static' in the VMX config. The existence of the 'static' attribute is further overriding whether the checkMACAddress config option is set as a side effect. Both these pieces of flawed logic were introduced in commit 454e5961abf40c14f8b6d7ee216229e68fd170bf Author: Bastien Orivel Date: Mon Jul 13 16:28:53 2020 +0200 Add a type attribute on the mac address element which intentionally added the 'checkMACAddress' side effect based on the 'type' attribute. With this change, we're reverting the handling of checkMACAddress to match what existed historically. The 'type' attribute now directly maps to the addressType attribute, so the above config becomes: ethernet1.present =3D "true" ethernet1.networkName =3D "br1" ethernet1.connectionType =3D "bridged" ethernet1.addressType =3D "static" ethernet1.address =3D "00:0c:29:dd:ee:fe" ethernet2.present =3D "true" ethernet2.networkName =3D "br2" ethernet2.connectionType =3D "bridged" ethernet2.addressType =3D "generated" ethernet2.generatedAddress =3D "aa:bb:cc:dd:ee:fd" ethernet2.generatedAddressOffset =3D "0" Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/vmx/vmx.c | 55 +++++++++++++------ .../xml2vmxdata/xml2vmx-ethernet-mac-type.vmx | 7 +-- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 97ec84446a..f0a45089cc 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -3732,7 +3732,9 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int cont= roller, virBufferPtr buffer, int virtualHW_version) { char mac_string[VIR_MAC_STRING_BUFLEN]; - const bool staticMac =3D def->mac_type =3D=3D VIR_DOMAIN_NET_MAC_TYPE_= STATIC; + virDomainNetMacType mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_DEFAULT; + virTristateBool mac_check =3D VIR_TRISTATE_BOOL_ABSENT; + bool mac_vpx =3D false; unsigned int prefix, suffix; =20 /* @@ -3830,31 +3832,48 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int co= ntroller, prefix =3D (def->mac.addr[0] << 16) | (def->mac.addr[1] << 8) | def->m= ac.addr[2]; suffix =3D (def->mac.addr[3] << 16) | (def->mac.addr[4] << 8) | def->m= ac.addr[5]; =20 - if (prefix =3D=3D 0x000c29 && !staticMac) { - virBufferAsprintf(buffer, "ethernet%d.addressType =3D \"generated\= "\n", - controller); - virBufferAsprintf(buffer, "ethernet%d.generatedAddress =3D \"%s\"\= n", - controller, mac_string); - virBufferAsprintf(buffer, "ethernet%d.generatedAddressOffset =3D \= "0\"\n", - controller); - } else if (prefix =3D=3D 0x005056 && suffix <=3D 0x3fffff && !staticMa= c) { - virBufferAsprintf(buffer, "ethernet%d.addressType =3D \"static\"\n= ", - controller); - virBufferAsprintf(buffer, "ethernet%d.address =3D \"%s\"\n", - controller, mac_string); - } else if (prefix =3D=3D 0x005056 && suffix >=3D 0x800000 && suffix <= =3D 0xbfffff && !staticMac) { - virBufferAsprintf(buffer, "ethernet%d.addressType =3D \"vpx\"\n", - controller); + /* + * Historically we've not stored all the MAC related properties + * explicitly in the XML, so we must figure out some defaults + * based on the address ranges. + */ + if (prefix =3D=3D 0x000c29) { + mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_GENERATED; + } else if (prefix =3D=3D 0x005056 && suffix <=3D 0x3fffff) { + mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_STATIC; + } else if (prefix =3D=3D 0x005056 && suffix >=3D 0x800000 && suffix <= =3D 0xbfffff) { + mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_GENERATED; + mac_vpx =3D true; + } else { + mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_STATIC; + mac_check =3D VIR_TRISTATE_BOOL_NO; + } + + /* If explicit MAC type is set, ignore the above defaults */ + if (def->mac_type !=3D VIR_DOMAIN_NET_MAC_TYPE_DEFAULT) { + mac_type =3D def->mac_type; + if (mac_type =3D=3D VIR_DOMAIN_NET_MAC_TYPE_GENERATED) + mac_check =3D VIR_TRISTATE_BOOL_ABSENT; + } + + if (mac_type =3D=3D VIR_DOMAIN_NET_MAC_TYPE_GENERATED) { + virBufferAsprintf(buffer, "ethernet%d.addressType =3D \"%s\"\n", + controller, mac_vpx ? "vpx" : "generated"); virBufferAsprintf(buffer, "ethernet%d.generatedAddress =3D \"%s\"\= n", controller, mac_string); + if (!mac_vpx) + virBufferAsprintf(buffer, "ethernet%d.generatedAddressOffset = =3D \"0\"\n", + controller); } else { virBufferAsprintf(buffer, "ethernet%d.addressType =3D \"static\"\n= ", controller); virBufferAsprintf(buffer, "ethernet%d.address =3D \"%s\"\n", controller, mac_string); - virBufferAsprintf(buffer, "ethernet%d.checkMACAddress =3D \"false\= "\n", - controller); } + if (mac_check !=3D VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(buffer, "ethernet%d.checkMACAddress =3D \"%s\"\n= ", + controller, + mac_check =3D=3D VIR_TRISTATE_BOOL_YES ? "true" = : "false"); =20 return 0; } diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-mac-type.vmx b/tests/xml2vm= xdata/xml2vmx-ethernet-mac-type.vmx index 212b3f192c..061aed3010 100644 --- a/tests/xml2vmxdata/xml2vmx-ethernet-mac-type.vmx +++ b/tests/xml2vmxdata/xml2vmx-ethernet-mac-type.vmx @@ -20,10 +20,9 @@ ethernet1.networkName =3D "br1" ethernet1.connectionType =3D "bridged" ethernet1.addressType =3D "static" ethernet1.address =3D "00:0c:29:dd:ee:fe" -ethernet1.checkMACAddress =3D "false" ethernet2.present =3D "true" ethernet2.networkName =3D "br2" ethernet2.connectionType =3D "bridged" -ethernet2.addressType =3D "static" -ethernet2.address =3D "aa:bb:cc:dd:ee:fd" -ethernet2.checkMACAddress =3D "false" +ethernet2.addressType =3D "generated" +ethernet2.generatedAddress =3D "aa:bb:cc:dd:ee:fd" +ethernet2.generatedAddressOffset =3D "0" --=20 2.24.1 From nobody Sun Apr 28 04:32:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1595262756; cv=none; d=zohomail.com; s=zohoarc; b=SWfzohjAkFOBfG1dbwZmoFLGeu2j9tk5viiocbf1oaY9sqRGlQ1nsbdhzt9MI3dNWHNyZ904THojnTzgbwyNRXkCw3TPVMButieQehFi5PGsOr+Tug9JPkFIy2Ypoagmv1Fk6EaHoDbwzP2CF3+JOxwBs/xvGVq4xk3pLDAXJgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595262756; h=Content-Type:Content-Transfer-Encoding:Cc: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=dHxr3kh0rTv7nCaoAPf7v8az2MnZNlUB4lcnHY5t7cY=; b=anraXLihdv2NW26Ip0s2JAqqn1xt9MojaJ/JrBC5VpTB31zt+i51viV+UX4V+orllDISHz677IFgVr2cny72wYfls2kZAZH1NjCOe3xVU3f5tIQNar3egEYyVfQwWr4t79nZg8Jzkv0VNfvL/qAOG6RZ6vqSpsgZ+d+9A/yeWwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1595262756702777.9983858678711; Mon, 20 Jul 2020 09:32:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-337-aCJvZVE8NGGmUTYlXXJ-1Q-1; Mon, 20 Jul 2020 12:32:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F4348017FB; Mon, 20 Jul 2020 16:32:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D26A274F48; Mon, 20 Jul 2020 16:32:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 83CA79A155; Mon, 20 Jul 2020 16:32:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06KGWPRr010465 for ; Mon, 20 Jul 2020 12:32:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 10D9A5FC3C; Mon, 20 Jul 2020 16:32:25 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067665C1D4; Mon, 20 Jul 2020 16:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595262755; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=dHxr3kh0rTv7nCaoAPf7v8az2MnZNlUB4lcnHY5t7cY=; b=AVL7j5sksHXsGTr/+tlE+FN4S+jaov6iynR+MShUF1Ee+Z9MndvDMxpTYmt7jhqikSxsxL cdduQrwVaojCL0Ucg5JU6k/hFA+vFin/bBgNVwcsP92qF0rBdM81MUZL9+l6phOs385jol Kz5mlGOSLsLpOhQg+rssTMGz46AH6Sc= X-MC-Unique: aCJvZVE8NGGmUTYlXXJ-1Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] vmx: support outputing the type attribute for MAC addresses Date: Mon, 20 Jul 2020 17:32:16 +0100 Message-Id: <20200720163217.1796949-3-berrange@redhat.com> In-Reply-To: <20200720163217.1796949-1-berrange@redhat.com> References: <20200720163217.1796949-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Michal Privoznik , Bastien Orivel X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) When support for MAC addresses having a type=3D'static|generated' attribute was added in: commit 454e5961abf40c14f8b6d7ee216229e68fd170bf Author: Bastien Orivel Date: Mon Jul 13 16:28:53 2020 +0200 Add a type attribute on the mac address element the VMX -> XML parser was not updated. As a result while we accept the 'type' attribute on input, we never show it again on 'output', so we loose information during the roundtrip. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/vmx/vmx.c | 11 +++++++++- .../vmx2xml-case-insensitive-1.xml | 2 +- .../vmx2xml-case-insensitive-2.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml | 4 ++-- .../vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml | 2 +- .../vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml | 20 +++++++++---------- .../vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml | 2 +- .../vmx2xmldata/vmx2xml-ethernet-bridged.xml | 2 +- tests/vmx2xmldata/vmx2xml-ethernet-custom.xml | 2 +- tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml | 2 +- .../vmx2xml-ethernet-generated.xml | 2 +- tests/vmx2xmldata/vmx2xml-ethernet-nat.xml | 2 +- tests/vmx2xmldata/vmx2xml-ethernet-other.xml | 2 +- tests/vmx2xmldata/vmx2xml-ethernet-static.xml | 2 +- .../vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml | 2 +- tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml | 2 +- .../vmx2xml-fusion-in-the-wild-1.xml | 4 ++-- .../vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml | 2 +- .../vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml | 2 +- .../vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml | 4 ++-- .../vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml | 2 +- .../vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml | 2 +- .../vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml | 2 +- 28 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index f0a45089cc..72f6a7d8dd 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2535,6 +2535,9 @@ virVMXParseEthernet(virConfPtr conf, int controller, = virDomainNetDefPtr *def) char generatedAddress_name[48] =3D ""; char *generatedAddress =3D NULL; =20 + char checkMACAddress_name[48] =3D ""; + char *checkMACAddress =3D NULL; + char address_name[48] =3D ""; char *address =3D NULL; =20 @@ -2564,6 +2567,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, = virDomainNetDefPtr *def) VMX_BUILD_NAME(connectionType); VMX_BUILD_NAME(addressType); VMX_BUILD_NAME(generatedAddress); + VMX_BUILD_NAME(checkMACAddress); VMX_BUILD_NAME(address); VMX_BUILD_NAME(virtualDev); VMX_BUILD_NAME(features); @@ -2598,7 +2602,9 @@ virVMXParseEthernet(virConfPtr conf, int controller, = virDomainNetDefPtr *def) true) < 0 || virVMXGetConfigString(conf, generatedAddress_name, &generatedAddre= ss, true) < 0 || - virVMXGetConfigString(conf, address_name, &address, true) < 0) { + virVMXGetConfigString(conf, address_name, &address, true) < 0 || + virVMXGetConfigString(conf, checkMACAddress_name, &checkMACAddress, + true) < 0) { goto cleanup; } =20 @@ -2613,6 +2619,8 @@ virVMXParseEthernet(virConfPtr conf, int controller, = virDomainNetDefPtr *def) goto cleanup; } } + if (addressType !=3D NULL) + (*def)->mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_GENERATED; } else if (STRCASEEQ(addressType, "static")) { if (address !=3D NULL) { if (virMacAddrParse(address, &(*def)->mac) < 0) { @@ -2622,6 +2630,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, = virDomainNetDefPtr *def) goto cleanup; } } + (*def)->mac_type =3D VIR_DOMAIN_NET_MAC_TYPE_STATIC; } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expecting VMX entry '%s' to be 'generated' or 's= tatic' or " diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml b/tests/vmx2x= mldata/vmx2xml-case-insensitive-1.xml index fd38cfd67f..7cb6413941 100644 --- a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml @@ -22,7 +22,7 @@ - +