Skip to main content
Resource Center/Resource Pool/VM Instance Operations
POSTVM Instance OperationsSince 4.0.0SynchronousAuth Required

AttachVmNicToVm

AttachVmNicToVm

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Path Parameters

Request Inputs

Path Parameters

  • vmNicUuidStringRequired

    The NIC UUID.

  • vmInstanceUuidListRequired

    The VM UUID.

Body Fields

  • systemTagsList

    Optional. The system tags。

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryVmInstanceInventoryRequired

    See inventory

    • uuidStringRequired

      The VM UUID.

    • nameStringRequired

      The VM name.

    • descriptionStringRequired

      The detailed description of the VM.

    • zoneUuidStringRequired

      The zone UUID.

    • clusterUuidStringRequired

      The cluster UUID.

    • imageUuidStringRequired

      The image UUID.

    • hostUuidStringRequired

      The host UUID.

    • lastHostUuidStringRequired

      The UUID of the host on which the VM instance was running last time.

    • instanceOfferingUuidStringRequired

      The instance offering UUID.

    • rootVolumeUuidStringRequired

      The root volume UUID.

    • platformStringRequired

      The platform on which the VM instance is running.

    • defaultL3NetworkUuidStringRequired

      The UUID of the default L3 network.

    • typeStringRequired

      The VM instance type.

    • hypervisorTypeStringRequired

      The hypervisor type of the VM instance.

    • memorySizeLongRequired

      The memory size.

    • cpuNumIntegerRequired

      The number of CPU cores of the VM instance.

    • cpuSpeedLongRequired

      The CPU speed.

    • allocatorStrategyStringRequired

      The allocator strategy.

    • createDateTimestampRequired

      The time when the VM instance was created.

    • lastOpDateTimestampRequired

      The time when the VM instance was last modified.

    • stateStringRequired

      The state of the VM instance.

    • vmNicsListRequired

      See vmNics.

      • uuidStringRequired

        The UUID of the NIC.

      • vmInstanceUuidStringRequired

        The VM UUID.

      • l3NetworkUuidStringRequired

        The L3 network UUID.

      • ipStringRequired

        The IP address of the NIC.

      • macStringRequired

        The MAC address of the NIC.

      • hypervisorTypeStringRequired

        The virtualization type.

      • netmaskStringRequired

        The netmask of the NIC.

      • gatewayStringRequired

        The gateway IP address.

      • metaDataStringRequired

        元数据。

      • ipVersionIntegerRequired

        The version of the IP address.

      • deviceIdIntegerRequired

        The device ID.

      • typeStringRequired

        The NIC type.

      • createDateTimestampRequired

        The time when the NIC was added.

      • lastOpDateTimestampRequired

        The time when the NIC was last modified.

      • usedIpsListRequired

        See usedIps

        • uuidStringRequired

          The IP address UUID.

        • ipRangeUuidStringRequired

          The IP range UUID.

        • l3NetworkUuidStringRequired

          The L3 network UUID.

        • ipVersionIntegerRequired

          The IP version.

        • ipStringRequired

          The IP address.

        • netmaskStringRequired

          The netmask.

        • gatewayStringRequired

          The gateway.

        • usedForStringRequired

          已使用用于。

        • ipInLonglongRequired

          No description provided.

        • vmNicUuidStringRequired

          The VM NIC UUID.

        • createDateTimestampRequired

          The time when the IP address was used.

        • lastOpDateTimestampRequired

          The time when the IP address was last modified.

    • allVolumesListRequired

      See allVolumes.

      • uuidStringRequired

        The volume UUID.

      • nameStringRequired

        The volume name.

      • descriptionStringRequired

        The detailed description of the volume.

      • primaryStorageUuidStringRequired

        The primary storage UUID.

      • vmInstanceUuidStringRequired

        The bare metal instance UUID.

      • diskOfferingUuidStringRequired

        The volume offering UUID.

      • rootImageUuidStringRequired

        The root image UUID.

      • installPathStringRequired

        The installation path of the volume in the primary storage.

      • typeStringRequired

        The type of the volume.

      • formatStringRequired

        The format of the volume.

      • sizeLongRequired

        The size of the volume.

      • actualSizeLongRequired

        The actual storage space that the volume takes up.

      • deviceIdIntegerRequired

        设备ID。

      • stateStringRequired

        The state of the volume.

      • statusStringRequired

        The status of the volume.

      • createDateTimestampRequired

        The time when the volume was created.

      • lastOpDateTimestampRequired

        The time when the volume was last modified.

      • isShareableBooleanRequired

        Indicates whether the volume is shareable.

      • volumeQosStringRequired

        The QoS of the volume, for example, 1048576.

Endpoint

POST/zstack/v1/vm-instances/{vmInstanceUuid}/nices/{vmNicUuid}

/zstack/v1/vm-instances/{vmInstanceUuid}/nices/{vmNicUuid}

Operation ID

AttachVmNicToVm

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/vm-instances/{vmInstanceUuid}/nices/{vmNicUuid}' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "afbd67886d773a45af9a20071bcb09bb", "name": "Test-VM", "description": "web server VM", "zoneUuid": "4b9ddab3f5f738f1a0161f5cf5f33f5c", "clusterUuid": "d7061d85666a380cb3dda4cc7f9f16ee", "imageUuid": "179a3412da4a32faa927eae552348907", "hostUuid": "6ee062370eee3df58623fa99be0b2ce0", "lastHostUuid": "09fdbebbaea73df79b744ad0d4bd7088", "instanceOfferingUuid": "6dc0db981e68348e89ac79ed18fa4b24", "rootVolumeUuid": "a876397202ac3d1daf9f4ea67e75e13d", "platform": "Linux", "defaultL3NetworkUuid": "3baaf68d632f3e9aa12be139d58d968e", "type": "UserVm", "hypervisorType": "KVM", "memorySize": 8.589934592E9, "cpuNum": 1.0, "allocatorStrategy": "LastHostPreferredAllocatorStrategy", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM", "state": "Running", "vmNics": [ { "uuid": "b9415d324b50301e923a990bf65352d0", "vmInstanceUuid": "afbd67886d773a45af9a20071bcb09bb", "usedIpUuid": "76a49549cb183d35865276187afb482b", "l3NetworkUuid": "3baaf68d632f3e9aa12be139d58d968e", "ip": "192.168.1.10", "mac": "00:0c:29:bd:99:fc", "hypervisorType": "KVM", "netmask": "255.255.255.0", "gateway": "192.168.1.1", "deviceId": 0.0, "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ], "allVolumes": [ { "uuid": "a876397202ac3d1daf9f4ea67e75e13d", "name": "Root-Volume-For-VM-afbd67886d773a45af9a20071bcb09bb", "primaryStorageUuid": "336625bac9e0326b9a9abc7801ef2c86", "vmInstanceUuid": "afbd67886d773a45af9a20071bcb09bb", "diskOfferingUuid": "475f8e09aae2389ea6945b46601aa683", "rootImageUuid": "179a3412da4a32faa927eae552348907", "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-a876397202ac3d1daf9f4ea67e75e13d/a876397202ac3d1daf9f4ea67e75e13d.qcow2", "type": "Root", "format": "qcow2", "size": 1.073741824E11, "actualSize": 2.147483648E10, "deviceId": 0.0, "state": "Enabled", "status": "Ready", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ] } }

Change History

This API has no change history records yet.

View all change history