diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in index 422a7f0a31971632b7f84075bad217abafbba8dd..d4549046e70cf88b0f7f2aee402308fb12fa706f 100644 --- a/docs/drvesx.html.in +++ b/docs/drvesx.html.in @@ -307,10 +307,11 @@ ethernet0.checkMACAddress = "false"
AMD PCnet32 network card for older guests.
-
vmxnet, vmxnet3
+
vmxnet, vmxnet2, vmxnet3
Special VMware VMXnet network card, requires VMware tools inside - the guest. + the guest. See VMware KB1001805 + for details.
e1000
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c index c2e9be6c20f062fbb9e9856ad27d742b2984208c..52c97e555a5a7579e78b1b40b2e0acac0c6913e1 100644 --- a/src/esx/esx_vmx.c +++ b/src/esx/esx_vmx.c @@ -265,6 +265,7 @@ def->disks[0]... def->nets[0]... ->model = <=> ethernet0.virtualDev = "" # default depends on guestOS value + ethernet0.features = "15" # if present and virtualDev is "vmxnet" => vmxnet2 (enhanced) ethernet0.addressType = "generated" # default to "generated" @@ -1705,6 +1706,9 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) char virtualDev_name[48] = ""; char *virtualDev = NULL; + char features_name[48] = ""; + long long features = 0; + char vnet_name[48] = ""; char *vnet = NULL; @@ -1737,6 +1741,7 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) ESX_BUILD_VMX_NAME(generatedAddress); ESX_BUILD_VMX_NAME(address); ESX_BUILD_VMX_NAME(virtualDev); + ESX_BUILD_VMX_NAME(features); ESX_BUILD_VMX_NAME(networkName); ESX_BUILD_VMX_NAME(vnet); @@ -1797,21 +1802,34 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) goto failure; } - /* vmx:virtualDev -> def:model */ - if (esxUtil_GetConfigString(conf, virtualDev_name, &virtualDev, 1) < 0) { + /* vmx:virtualDev, vmx:features -> def:model */ + if (esxUtil_GetConfigString(conf, virtualDev_name, &virtualDev, 1) < 0 || + esxUtil_GetConfigLong(conf, features_name, &features, 0, 1) < 0) { goto failure; } - if (virtualDev != NULL && - STRCASENEQ(virtualDev, "vlance") && - STRCASENEQ(virtualDev, "vmxnet") && - STRCASENEQ(virtualDev, "vmxnet3") && - STRCASENEQ(virtualDev, "e1000")) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " - "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name, - virtualDev); - goto failure; + if (virtualDev != NULL) { + if (STRCASENEQ(virtualDev, "vlance") && + STRCASENEQ(virtualDev, "vmxnet") && + STRCASENEQ(virtualDev, "vmxnet3") && + STRCASENEQ(virtualDev, "e1000")) { + ESX_ERROR(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " + "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name, + virtualDev); + goto failure; + } + + if (STRCASEEQ(virtualDev, "vmxnet") && features == 15) { + VIR_FREE(virtualDev); + + virtualDev = strdup("vmxnet2"); + + if (virtualDev == NULL) { + virReportOOMError(); + goto failure; + } + } } /* vmx:networkName -> def:data.bridge.brname */ @@ -2744,21 +2762,29 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller, virBufferVSprintf(buffer, "ethernet%d.present = \"true\"\n", controller); - /* def:model -> vmx:virtualDev */ + /* def:model -> vmx:virtualDev, vmx:features */ if (def->model != NULL) { if (STRCASENEQ(def->model, "vlance") && STRCASENEQ(def->model, "vmxnet") && + STRCASENEQ(def->model, "vmxnet2") && STRCASENEQ(def->model, "vmxnet3") && STRCASENEQ(def->model, "e1000")) { ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Expecting domain XML entry 'devices/interfase/model' " - "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' " - "but found '%s'"), def->model); + "to be 'vlance' or 'vmxnet' or 'vmxnet2' or 'vmxnet3' " + "or 'e1000' but found '%s'"), def->model); return -1; } - virBufferVSprintf(buffer, "ethernet%d.virtualDev = \"%s\"\n", - controller, def->model); + if (STRCASEEQ(def->model, "vmxnet2")) { + virBufferVSprintf(buffer, "ethernet%d.virtualDev = \"vmxnet\"\n", + controller); + virBufferVSprintf(buffer, "ethernet%d.features = \"15\"\n", + controller); + } else { + virBufferVSprintf(buffer, "ethernet%d.virtualDev = \"%s\"\n", + controller, def->model); + } } /* def:type, def:ifname -> vmx:connectionType */ diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.vmx b/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.vmx new file mode 100644 index 0000000000000000000000000000000000000000..1c3f0633650dba1315a909364f04b4e146b4af13 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.vmx @@ -0,0 +1,9 @@ +config.version = "8" +virtualHW.version = "4" +ethernet0.present = "true" +ethernet0.virtualDev = "vmxnet" +ethernet0.features = "15" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml b/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml new file mode 100644 index 0000000000000000000000000000000000000000..090f7ceca9fc14ed3893d354177f45f23038c868 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml @@ -0,0 +1,20 @@ + + 00000000-0000-0000-0000-000000000000 + 32768 + 32768 + 1 + + hvm + + + destroy + restart + destroy + + + + + + + + diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index f3b3b5e9828d7ece6bdbf905d7ef7130f0c117cc..b26a7036f807ab4605bc1649065117e1596fb04b 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -145,6 +145,7 @@ mymain(int argc, char **argv) DO_TEST("floppy-device", "floppy-device", esxVI_APIVersion_25); DO_TEST("ethernet-e1000", "ethernet-e1000", esxVI_APIVersion_25); + DO_TEST("ethernet-vmxnet2", "ethernet-vmxnet2", esxVI_APIVersion_25); DO_TEST("ethernet-custom", "ethernet-custom", esxVI_APIVersion_25); DO_TEST("ethernet-bridged", "ethernet-bridged", esxVI_APIVersion_25); diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx b/tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx new file mode 100644 index 0000000000000000000000000000000000000000..50709e223f2bda66dcaff6860f8b7b95c74577eb --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx @@ -0,0 +1,14 @@ +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-vmxnet2" +memsize = "4" +numvcpus = "1" +ethernet0.present = "true" +ethernet0.virtualDev = "vmxnet" +ethernet0.features = "15" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml b/tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml new file mode 100644 index 0000000000000000000000000000000000000000..7d6d0e581284ca14ecdaae3c1a1032735621a130 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml @@ -0,0 +1,15 @@ + + ethernet-vmxnet2 + 564d9bef-acd9-b4e0-c8f0-aea8b9103515 + 4096 + + hvm + + + + + + + + + diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index f9c4730279df938dc46d35c87862ee137df9a296..40386eb2b18e3f568b19c68b33861cb33151c28e 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -190,6 +190,7 @@ mymain(int argc, char **argv) DO_TEST("floppy-device", "floppy-device", esxVI_APIVersion_25); DO_TEST("ethernet-e1000", "ethernet-e1000", esxVI_APIVersion_25); + DO_TEST("ethernet-vmxnet2", "ethernet-vmxnet2", esxVI_APIVersion_25); DO_TEST("ethernet-custom", "ethernet-custom", esxVI_APIVersion_25); DO_TEST("ethernet-bridged", "ethernet-bridged", esxVI_APIVersion_25);