Create a System Tag

POST/zstack/v1/system-tags

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "resourceType": "HostVO",
    "resourceUuid": "c31d63c6d40d489e87fa7e1ee5707d47",
    "tag": "reservedMemory::1G"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceType":"HostVO","resourceUuid":"47609e353c6f331f93ac114d06379f8d","tag":"reservedMemory::1G"}}' \
http://localhost:8080/zstack/v1/system-tags

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
resourceTypeStringbody (contained in the params structure)When creating a tag, the user must specify the resource type associated with the tag. 0.6
resourceUuidStringbody (contained in the params structure)User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. 0.6
tagStringbody (contained in the params structure)Tag string 0.6
systemTags (optional)ListbodySystem tags 0.6
userTags (optional)ListbodyUser tags 0.6
  • ZSvirt supports configuring whether to automatically release physical PCI devices allocated from device specifications when a VM is stopped. This can also be deleted or changed for existing VMs. The SystemTags option autoReleaseSpecReleatedPhysicalPciDevice is added.
  • Option format: autoReleaseSpecReleatedPhysicalPciDevice
  • Example: autoReleaseSpecReleatedPhysicalPciDevice
  • ZSvirt supports configuring whether to automatically release virtual PCI devices allocated from device specifications when a VM is stopped. This can also be deleted or changed for existing VMs. The SystemTags option autoReleaseSpecReleatedVirtualPciDevice is added.
    • Option format: autoReleaseSpecReleatedVirtualPciDevice
    • Example: autoReleaseSpecReleatedVirtualPciDevice
  • ZSvirt supports setting cross-cluster HA policies for VMs when creating system tags. The SystemTags option resourceBindings is added.
    • Option format: resourceBindings::Cluster:clusterUuid, where clusterUuid is the UUID of the corresponding cluster.
    • Example: resourceBindings::Cluster:2sdasf231jvznsdak
  • ZSvirt supports adding custom parameters to the boot.ipxe file when creating system tags. The SystemTags option extraBootParams is added.
    • Option format: extraBootParams::{custom parameters}
    • Example: extraBootParams::{acpi=noirq noapic}

API Response

Response Example

{
  "inventory": {
    "inherent": false,
    "uuid": "55d86810cb564ecc934fa79d498b9dc3",
    "resourceType": "HostVO",
    "tag": "reservedMemory::1G",
    "type": "System",
    "createDate": "Apr 24, 2017 7:10:55 PM",
    "lastOpDate": "Apr 24, 2017 7:10:55 PM"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error0.6
inventorySystemTagInventoryFor details, see inventory0.6

error

NameTypeDescriptionStarting Version
odeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001.0.6
descriptionStringA brief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Default is null.0.6
opaqueLinkedHashMapReserved field. Default is null.0.6
causeErrorCodeThe root error. The source error that caused the current error. If there is no root error, this field is null.0.6

inventory

NameTypeDescriptionStarting Version
inherentBooleanInternal system tag0.6
uuidStringThe UUID of the resource. Uniquely identifies the resource.0.6
resourceUuidStringUser-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource.0.6
resourceTypeStringWhen creating a tag, the user must specify the resource type associated with the tag.0.6
tagStringTag string0.6
typeStringReserved field. Do not use.0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6

SDK Examples

Java SDK

CreateSystemTagAction action = new CreateSystemTagAction();
action.resourceType = "HostVO";
action.resourceUuid = "c63dfecc5c3f4f24bdab3eda92036eef";
action.tag = "reservedMemory::1G";
action.sessionId = "494209d421304d1cb9b8aaab7cac3a45";
CreateSystemTagAction.Result res = action.call();

Python SDK

CreateSystemTagAction action = CreateSystemTagAction()
action.resourceType = "HostVO"
action.resourceUuid = "d8f0bf84c4bc41c99ff7129a369515c1"
action.tag = "reservedMemory::1G"
action.sessionId = "f84ee562742b4aaab791842d71f5d472"
CreateSystemTagAction.Result res = action.call()