From 96ceb124439ed8ba0fe549d71c64eff8c2c8cddc Mon Sep 17 00:00:00 2001
From: Matthias Bolte
Date: Sat, 2 Jan 2010 23:58:24 +0100
Subject: [PATCH] esx: Fix 'vpx' MAC address range and allow arbitrary MAC
addresses
The MAC addresses with 00:50:56 prefix are split into several ranges:
00:50:56:00:00:00 - 00:50:56:3f:ff:ff 'static' range (manually assigned)
00:50:56:80:00:00 - 00:50:56:bf:ff:ff 'vpx' range (assigned by a VI Client)
Erroneously the 'vpx' range was assumed to be larger and to occupy the
remaining addresses of the 00:50:56 prefix that are not part of the 'static'
range.
00:50:56 was used as prefix for generated MAC addresses, this is not possible
anymore, because there are gaps in the allowed ranges. Therefore, change the
prefix to 00:0c:29 which is the prefix for auto generated MAC addresses anyway.
Allow arbitrary MAC addresses to be used and set the checkMACAddress VMX option
to false in case the MAC address doesn't fall into any predefined range.
* docs/drvesx.html.in: update website accordingly
* src/esx/esx_driver.c: set the auto generation prefix to 00:0c:29
* src/esx/esx_vmx.c: fix MAC address range handling and allow arbitrary MAC
addresses
* tests/vmx2xml*, tests/xml2vmx*: add some basic MAC address range tests
---
docs/drvesx.html.in | 74 +++++++++++++++++--
src/esx/esx_driver.c | 2 +-
src/esx/esx_vmx.c | 49 +++++++-----
.../vmx2xml-ethernet-generated.vmx | 8 ++
.../vmx2xml-ethernet-generated.xml | 19 +++++
tests/vmx2xmldata/vmx2xml-ethernet-other.vmx | 8 ++
tests/vmx2xmldata/vmx2xml-ethernet-other.xml | 19 +++++
tests/vmx2xmldata/vmx2xml-ethernet-static.vmx | 7 ++
tests/vmx2xmldata/vmx2xml-ethernet-static.xml | 19 +++++
tests/vmx2xmldata/vmx2xml-ethernet-vpx.vmx | 7 ++
tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml | 19 +++++
tests/vmx2xmltest.c | 5 ++
.../xml2vmx-ethernet-generated.vmx | 13 ++++
.../xml2vmx-ethernet-generated.xml | 14 ++++
tests/xml2vmxdata/xml2vmx-ethernet-other.vmx | 13 ++++
tests/xml2vmxdata/xml2vmx-ethernet-other.xml | 14 ++++
tests/xml2vmxdata/xml2vmx-ethernet-static.vmx | 12 +++
tests/xml2vmxdata/xml2vmx-ethernet-static.xml | 14 ++++
tests/xml2vmxdata/xml2vmx-ethernet-vpx.vmx | 12 +++
tests/xml2vmxdata/xml2vmx-ethernet-vpx.xml | 14 ++++
tests/xml2vmxtest.c | 5 ++
21 files changed, 320 insertions(+), 27 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-generated.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-generated.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-other.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-other.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-static.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-static.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-vpx.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-generated.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-generated.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-other.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-other.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-static.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-static.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-vpx.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-ethernet-vpx.xml
diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index b7909ff1e3..44a144f12a 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -16,8 +16,8 @@
SOAP based
VMware Virtual Infrastructure API (VI API) to communicate with the
- ESX server, like the VMware Virtual Infrastructure Client does. Since
- version 4.0 this API is called
+ ESX server, like the VMware Virtual Infrastructure Client (VI client)
+ does. Since version 4.0 this API is called
VMware vSphere API.
@@ -159,7 +159,7 @@ type://[username@]hostname[:port]/[?extraparameters]
There are several specialties in the domain XML config for ESX domains.
-
There are some restrictions for some values of the domain XML config.
The driver will complain if this restrictions are violated.
@@ -173,12 +173,13 @@ type://[username@]hostname[:port]/[?extraparameters]
Valid MAC address prefixes are 00:0c:29 and
- 00:50:56
+ 00:50:56. Since 0.7.6
+ arbitrary MAC addresses are supported.
Storage is managed in datastores. VMware uses a special path format to
reference files in a datastore. Basically, the datastore name is put
@@ -197,7 +198,68 @@ type://[username@]hostname[:port]/[?extraparameters]
+ VMware has registered two MAC address prefixes for domains:
+ 00:0c:29 and 00:50:56. These prefixes are
+ split into ranges for different purposes.
+
+
+
+
Range
+
Purpose
+
+
+
+ 00:0c:29:00:00:00 - 00:0c:29:ff:ff:ff
+
+
+ An ESX server autogenerates MAC addresses from this range if
+ the VMX file doesn't contain a MAC address when trying to start
+ a domain.
+
+
+
+
+ 00:50:56:00:00:00 - 00:50:56:3f:ff:ff
+
+
+ MAC addresses from this range can by manually assigned by the
+ user in the VI client.
+
+
+
+
+ 00:50:56:80:00:00 - 00:50:56:bf:ff:ff
+
+
+ A VI client autogenerates MAC addresses from this range for
+ newly defined domains.
+
+
+
+
+ The VMX files generated by the ESX driver always contain a MAC address,
+ because libvirt generates a random one if an interface element in the
+ domain XML file lacks a MAC address.
+ Since 0.7.6 the ESX driver sets the prefix
+ for generated MAC addresses to 00:0c:29. Before 0.7.6
+ the 00:50:56 prefix was used. Sometimes this resulted in
+ the generation of out-of-range MAC address that were rejected by the
+ ESX server.
+
+
+ Also since 0.7.6 every MAC address outside
+ this ranges can be used. For such MAC addresses the ESX server-side
+ check is disabled in the VMX file to stop the ESX server from rejecting
+ out-of-predefined-range MAC addresses.
+