vcenter vm hardware ethernet: create

Adds a virtual Ethernet adapter to the virtual machine.

Request:

HTTP request

POST https://{server}/rest/vcenter/vm/{vm}/hardware/ethernet

Path Parameters

Name Type Description
Required
vm string Virtual machine identifier.

Request Body Structure:

{
    "spec"{
        "allow_guest_control"true,
        "backing"{
            "distributed_port""string",
            "network""obj-103",
            "type""STANDARD_PORTGROUP"
        },
        "mac_address""string",
        "mac_type""MANUAL",
        "pci_slot_number"1,
        "start_connected"true,
        "type""E1000",
        "upt_compatibility_enabled"true,
        "wake_on_lan_enabled"true
    }
}
<?xml version="1.0" ?>
<ns0:Create-Input xmlns:ns0="http://vmware.com/vcenter/vm/hardware/ethernet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <spec>
    <pci_slot_number>1</pci_slot_number>
    <mac_address>string</mac_address>
    <upt_compatibility_enabled>true</upt_compatibility_enabled>
    <mac_type>MANUAL</mac_type>
    <allow_guest_control>true</allow_guest_control>
    <type>E1000</type>
    <backing>
      <distributed_port>string</distributed_port>
      <type>STANDARD_PORTGROUP</type>
      <network>obj-103</network>
    </backing>
    <wake_on_lan_enabled>true</wake_on_lan_enabled>
    <start_connected>true</start_connected>
  </spec>
</ns0:Create-Input>

Request Body Parameters:

Name Type Description
bold = required
spec create_spec Specification for the new virtual Ethernet adapter.
spec.type string Ethernet adapter emulation type.

Optional. If unset, defaults to a guest-specific type.

spec.upt_compatibility_enabled boolean Flag indicating whether Universal Pass-Through (UPT) compatibility is enabled on this virtual Ethernet adapter.

Optional. It is only relevant when type has value VMXNET3. If unset, defaults to false.

spec.mac_type string MAC address type.

Optional. If unset, defaults to GENERATED.

spec.mac_address string MAC address.

Optional. It is only relevant when mac_type has value MANUAL. Workaround for PR1459647.

spec.pci_slot_number long Address of the virtual Ethernet adapter on the PCI bus. If the PCI address is invalid, the server will change when it the VM is started or as the device is hot added.

Optional. If unset, the server will choose an available address when the virtual machine is powered on.

spec.wake_on_lan_enabled boolean Flag indicating whether wake-on-LAN is enabled on this virtual Ethernet adapter.

Optional. Defaults to false if unset.

spec.backing backing_spec Physical resource backing for the virtual Ethernet adapter.

Optional. If unset, the system may try to find an appropriate backing. If one is not found, the request will fail.

spec.backing.type string Backing type for the virtual Ethernet adapter.

Defines the valid backing types for a virtual Ethernet adapter. Value is one of:
STANDARD_PORTGROUP: vSphere standard portgroup network backing.
HOST_DEVICE: Legacy host device network backing. Imported VMs may have virtual Ethernet adapters with this type of backing, but this type of backing cannot be used to create or to update a virtual Ethernet adapter.
DISTRIBUTED_PORTGROUP: Distributed virtual switch backing.
OPAQUE_NETWORK: Opaque network backing.

spec.backing.network string Identifier of the network that backs the virtual Ethernet adapter.

Optional. It is only relevant when type has value [STANDARD_PORTGROUP, DISTRIBUTED_PORTGROUP, OPAQUE_NETWORK]. This field is optional and it is only relevant when the value of type is one of STANDARD_PORTGROUP, DISTRIBUTED_PORTGROUP, or OPAQUE_NETWORK.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Network. When operations return a value of this structure as a result, the field will be an identifier for the resource type: Network.

spec.backing.distributed_port string Key of the distributed virtual port that backs the virtual Ethernet adapter. Depending on the type of the Portgroup, the port may be specified using this field. If the portgroup type is early-binding (also known as static), a port is assigned when the Ethernet adapter is configured to use the port. The port may be either automatically or specifically assigned based on the value of this field. If the portgroup type is ephemeral, the port is created and assigned to a virtual machine when it is powered on and the Ethernet adapter is connected. This field cannot be specified as no free ports exist before use.

Optional. It is only relevant when type has value DISTRIBUTED_PORTGROUP. May be used to specify a port when the network specified on the network field is a static or early binding distributed portgroup. If unset, the port will be automatically assigned to the Ethernet adapter based on the policy embodied by the portgroup type.

spec.start_connected boolean Flag indicating whether the virtual device should be connected whenever the virtual machine is powered on.

Optional. Defaults to false if unset.

spec.allow_guest_control boolean Flag indicating whether the guest can connect and disconnect the device.

Optional. Defaults to false if unset.

Response:

HTTP Status Code: 200

Representations:

{
    "value""obj-103"
}
<?xml version="1.0" ?>
<ns0:Create-Result xmlns:ns0="http://vmware.com/vcenter/vm/hardware/ethernet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <value>obj-103</value>
</ns0:Create-Result>

Response Type:

Name Type Description
bold = required
value string Virtual Ethernet adapter identifier.

Errors:

HTTP Status Code Type Description
500 error if the system reported that the Ethernet adapter was created but was unable to confirm the creation because the identifier of the new adapter could not be determined.
404 not_found if the virtual machine or network backing is not found.
400 unable_to_allocate_resource if the virtual machine already has the maximum number of supported Ethernet adapters.
400 invalid_argument if the specified PCI address is out of bounds, HOST_DEVICE is specified as the type, or a backing cannot be found in the case that backing is left unset.
400 resource_busy if the virtual machine is busy performing another operation.
400 resource_inaccessible if the virtual machine's configuration state cannot be accessed.
503 service_unavailable if the system is unable to communicate with a service to complete the request.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user doesn't have the required privileges.
400 unsupported if the guest operating system of the virtual machine is not supported and spec includes unset fields that default to guest-specific values.