mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
esx: Add support for the VMXNET 2 (Enhanced) NIC model
Add a test case and document it.
This commit is contained in:
parent
cad913060c
commit
c6375aa796
@ -307,10 +307,11 @@ ethernet0.checkMACAddress = "false"
|
||||
<dd>
|
||||
AMD PCnet32 network card for older guests.
|
||||
</dd>
|
||||
<dt><code>vmxnet</code>, <code>vmxnet3</code></dt>
|
||||
<dt><code>vmxnet</code>, <code>vmxnet2</code>, <code>vmxnet3</code></dt>
|
||||
<dd>
|
||||
Special VMware VMXnet network card, requires VMware tools inside
|
||||
the guest.
|
||||
the guest. See <a href="http://kb.vmware.com/kb/1001805">VMware KB1001805</a>
|
||||
for details.
|
||||
</dd>
|
||||
<dt><code>e1000</code></dt>
|
||||
<dd>
|
||||
|
@ -265,6 +265,7 @@ def->disks[0]...
|
||||
|
||||
def->nets[0]...
|
||||
->model = <model> <=> ethernet0.virtualDev = "<model>" # 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,13 +1802,14 @@ 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") &&
|
||||
if (virtualDev != NULL) {
|
||||
if (STRCASENEQ(virtualDev, "vlance") &&
|
||||
STRCASENEQ(virtualDev, "vmxnet") &&
|
||||
STRCASENEQ(virtualDev, "vmxnet3") &&
|
||||
STRCASENEQ(virtualDev, "e1000")) {
|
||||
@ -1814,6 +1820,18 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
|
||||
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 */
|
||||
if ((connectionType == NULL ||
|
||||
STRCASEEQ(connectionType, "bridged") ||
|
||||
@ -2744,22 +2762,30 @@ 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;
|
||||
}
|
||||
|
||||
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 */
|
||||
switch (def->type) {
|
||||
|
9
tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.vmx
Normal file
9
tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.vmx
Normal file
@ -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"
|
20
tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml
Normal file
20
tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<domain type='vmware'>
|
||||
<uuid>00000000-0000-0000-0000-000000000000</uuid>
|
||||
<memory>32768</memory>
|
||||
<currentMemory>32768</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686'>hvm</type>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<interface type='bridge'>
|
||||
<mac address='00:50:56:11:22:33'/>
|
||||
<source bridge='VM Network'/>
|
||||
<model type='vmxnet2'/>
|
||||
</interface>
|
||||
</devices>
|
||||
</domain>
|
@ -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);
|
||||
|
14
tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx
Normal file
14
tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx
Normal file
@ -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"
|
15
tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml
Normal file
15
tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<domain type='vmware'>
|
||||
<name>ethernet-vmxnet2</name>
|
||||
<uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
|
||||
<memory>4096</memory>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
</os>
|
||||
<devices>
|
||||
<interface type='bridge'>
|
||||
<mac address='00:50:56:11:22:33'/>
|
||||
<source bridge='VM Network'/>
|
||||
<model type='vmxnet2'/>
|
||||
</interface>
|
||||
</devices>
|
||||
</domain>
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user