Document navigation

ChangeVmNicState

API Request

URLs
PUT zstack/v1/vm-instances/nics/{vmNicUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeVmNicState": {
    "state": "disable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeVmNicState":{"state":"disable"}}' http://localhost:8080/zstack/v1/vm-instances/nics/17d47a3b35813bb5a90f9643200a0f40/actions
Request Parameters
Name Type Location Description Valid Value Starting Version
vmNicUuid String url The VM NIC UUID. 4.6.0
state String body The VM NIC state. 4.6.0
systemTags List body Optional. The system tags. 4.6.0
userTags List body Optional. The user tags. 4.6.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "11d9330dd53b3140a933afff53484a4c",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "9959e99dec6032a1b6ddc7557f33db64",
    "clusterUuid": "d1675e2a3a07326989def39ea008fc1d",
    "imageUuid": "2392ef4f86e63aaaa2b5614f6795e262",
    "hostUuid": "b1e0e26f93503ff1a36d1e52d722b9ab",
    "lastHostUuid": "799326ef34543e4d988893b236c846ce",
    "instanceOfferingUuid": "7acf02facef6324b8f5b945d920afd75",
    "rootVolumeUuid": "561bc94863f43272afb18628ff29e137",
    "platform": "Linux",
    "defaultL3NetworkUuid": "f011105734bb39189bb8105fdc081d58",
    "type": "UserVm",
    "hypervisorType": "KVM",
    "memorySize": 8589934592,
    "cpuNum": 1,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "836ece7a894337b782404822f6c200bd",
        "vmInstanceUuid": "11d9330dd53b3140a933afff53484a4c",
        "usedIpUuid": "52876b0aca4936719b11959c2e53d9dc",
        "l3NetworkUuid": "f011105734bb39189bb8105fdc081d58",
        "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,
        "state": "disable",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "561bc94863f43272afb18628ff29e137",
        "name": "Root-Volume-For-VM-11d9330dd53b3140a933afff53484a4c",
        "primaryStorageUuid": "75cfe252d83c3b498f8a6b00d7f03eb6",
        "vmInstanceUuid": "11d9330dd53b3140a933afff53484a4c",
        "diskOfferingUuid": "798091e2b84f30da8652329933d3bada",
        "rootImageUuid": "2392ef4f86e63aaaa2b5614f6795e262",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-561bc94863f43272afb18628ff29e137/561bc94863f43272afb18628ff29e137.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 107374182400,
        "actualSize": 21474836480,
        "deviceId": 0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean 4.6.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.6.0
inventory VmInstanceInventory See inventory. 4.6.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.6.0
description String The brief description of the error. 4.6.0
details String The details about the error. 4.6.0
elaboration String The reserved field. Default value: null. 4.6.0
opaque LinkedHashMap The reserved field. Default value: null. 4.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.6.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.6.0
name String The resource name. 4.6.0
description String Optional. The detailed description of the resource. 4.6.0
zoneUuid String The zone UUID. 4.6.0
clusterUuid String The cluster UUID. 4.6.0
imageUuid String The image UUID. 4.6.0
hostUuid String The host UUID. 4.6.0
lastHostUuid String 4.6.0
instanceOfferingUuid String The instance offering UUID. 4.6.0
rootVolumeUuid String The root volume UUID. 4.6.0
platform String 4.6.0
architecture String 4.6.0
defaultL3NetworkUuid String 4.6.0
type String 4.6.0
hypervisorType String 4.6.0
memorySize Long 4.6.0
cpuNum Integer 4.6.0
cpuSpeed Long 4.6.0
allocatorStrategy String 4.6.0
createDate Timestamp The creation date. 4.6.0
lastOpDate Timestamp The last operation date. 4.6.0
state String 4.6.0
guestOsType String 4.6.0
vmNics List See vmNics 4.6.0
allVolumes List See allVolumes 4.6.0
vmCdRoms List See vmCdRoms 4.6.0
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 4.6.0
vmInstanceUuid String The VM instance UUID. 4.6.0
l3NetworkUuid String The L3 network UUID. 4.6.0
ip String 4.6.0
mac String 4.6.0
hypervisorType String 4.6.0
netmask String 4.6.0
gateway String 4.6.0
metaData String 4.6.0
ipVersion Integer 4.6.0
driverType String 4.6.0
internalName String 4.6.0
deviceId Integer 4.6.0
type String 4.6.0
state String The NIC state. 4.6.0
createDate Timestamp The creation date. 4.6.0
lastOpDate Timestamp The last operation date. 4.6.0
usedIps List See usedIps 4.6.0
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 4.6.0
ipRangeUuid String The IP range UUID. 4.6.0
l3NetworkUuid String The L3 network UUID. 4.6.0
ipVersion Integer 4.6.0
ip String 4.6.0
netmask String 4.6.0
gateway String 4.6.0
usedFor String 4.6.0
ipInLong long 4.6.0
vmNicUuid String The VM NIC UUID. 4.6.0
createDate Timestamp The creation date. 4.6.0
lastOpDate Timestamp The last operation date. 4.6.0
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 4.6.0
name String The resource name. 4.6.0
description String Optional. The detailed description of the resource. 4.6.0
primaryStorageUuid String The primary storage UUID. 4.6.0
vmInstanceUuid String The VM instance UUID. 4.6.0
diskOfferingUuid String The disk offering UUID. 4.6.0
rootImageUuid String 4.6.0
installPath String 4.6.0
type String 4.6.0
format String 4.6.0
size Long 4.6.0
actualSize Long 4.6.0
deviceId Integer 4.6.0
state String 4.6.0
status String 4.6.0
createDate Timestamp The creation date. 4.6.0
lastOpDate Timestamp The last operation date. 4.6.0
isShareable Boolean 4.6.0
volumeQos String 4.6.0
lastDetachDate Timestamp 4.6.0
lastVmInstanceUuid String 4.6.0
#vmCdRoms
Name Type Description Starting Version
uuid String The resource UUID. 4.6.0
vmInstanceUuid String The VM instance UUID. 4.6.0
deviceId Integer 4.6.0
isoUuid String 4.6.0
isoInstallPath String 4.6.0
name String The resource name. 4.6.0
description String Optional. The detailed description of the resource. 4.6.0
createDate Timestamp The creation date. 4.6.0
lastOpDate Timestamp The last operation date. 4.6.0

SDK Sample

Java SDK
ChangeVmNicStateAction action = new ChangeVmNicStateAction();
action.vmNicUuid = "17d47a3b35813bb5a90f9643200a0f40";
action.state = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVmNicStateAction.Result res = action.call();
Python SDK
ChangeVmNicStateAction action = ChangeVmNicStateAction()
action.vmNicUuid = "17d47a3b35813bb5a90f9643200a0f40"
action.state = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeVmNicStateAction.Result res = action.call()
API Reference | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center