VM Related Interfaces

Create Reboot Virtual Machine Scheduler

POST/zstack/v1/vm-instances/{vmUuid}/schedulers/rebooting

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "schedulerName": "vm-scheduler",
    "schedulerDescription": "for test restart vm scheduler",
    "type": "simple",
    "interval": 5.0,
    "repeatCount": 10.0,
    "startTime": 0.0
  },
  "systemTags": [],
  "userTags": []
}

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

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fa354b2ef2b34f109f268d264eee4d87" \
-X POST http://localhost:8080/zstack/v1/vm-instances/08eaedbeb14841c5bb8564663319fed9/\
schedulers/rebooting?

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
vmUuidStringurlVirtual Machine UUID 0.6
schedulerNameStringbody(contained in the params structure)Scheduler name 1.6
schedulerDescription (Optional)Stringbody(contained in the params structure)Scheduler description 1.6
typeStringbody(contained in the params structure)Scheduler type, simple or cronsimplecron1.6
interval (Optional)Integerbody(contained in the params structure)Scheduler interval in seconds 1.6
repeatCount (Optional)Integerbody(contained in the params structure)Repeat count for the scheduler, only applies to simple type scheduler 1.6
startTime (Optional)Longbody(contained in the params structure)Scheduler start time, must follow unix timestamp format, 0 means start immediately 1.6
cron (Optional)Stringbody(contained in the params structure)Cron expression, must follow Java Quartz cron format standard 1.6
resourceUuid (Optional)Stringbody(contained in the params structure)User can specify the UUID used for creating the Scheduler 0.6
systemTags (Optional)ListbodySystem Tag 0.6
userTags (Optional)ListbodyUser Tag 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "2664ccec6e584e529ab6671d88f87763",
    "targetResourceUuid": "308a32f93a7842ce94bdab3220f75aeb",
    "schedulerName": "Test",
    "schedulerType": "simple",
    "repeatCount": 10.0,
    "startTime": "May 11, 2017 1:22:27 PM",
    "createDate": "May 11, 2017 1:22:27 PM",
    "lastOpDate": "May 11, 2017 1:22:27 PM",
    "jobClassName": "CreateVolumeSnapshotJob",
    "state": "Enabled"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation is successful. For details, see error1.6
inventorySchedulerInventoryFor details, see inventory1.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The source error that caused the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifying the resource0.6
targetResourceUuidString 0.6
schedulerNameString 0.6
schedulerJobString 0.6
schedulerTypeString 0.6
schedulerIntervalInteger 0.6
repeatCountInteger 0.6
cronSchedulerString 0.6
startTimeTimestamp 0.6
stopTimeTimestamp 0.6
createDateTimestampCreate date0.6
lastOpDateTimestampLast update date0.6
stateString 0.6

SDK Examples

Java SDK

CreateRebootVmInstanceSchedulerAction action = new CreateRebootVmInstanceSchedulerAction();
action.vmUuid = "65f8b54efe254b8e8e5b427bfdadd1e6";
action.schedulerName = "vm-scheduler";
action.schedulerDescription = "for test restart vm scheduler";
action.type = "simple";
action.interval = 5.0;
action.repeatCount = 10.0;
action.startTime = 0.0;
action.sessionId = "3cedf9bd8bbf424f860057259adfcdcf";
CreateRebootVmInstanceSchedulerAction.Result res = action.call();

Python SDK

CreateRebootVmInstanceSchedulerAction action = CreateRebootVmInstanceSchedulerAction()
action.vmUuid = "1b0f699afaba45e1865f00bbaf026c6a"
action.schedulerName = "vm-scheduler"
action.schedulerDescription = "for test restart vm scheduler"
action.type = "simple"
action.interval = 5.0
action.repeatCount = 10.0
action.startTime = 0.0
action.sessionId = "22758ee34b2b4822a3253a8a56cee6cf"
CreateRebootVmInstanceSchedulerAction.Result res = action.call()