Document navigation

Chrony Servers Operations

CheckNetworkReachable

API Request

URLs

GET zstack/v1/zops/check/network

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X GET http://localhost:8080/zstack/v1/zops/check/network?sourceHostnames=172.0.0.1&targetHostnames=test1.com&targetHostnames=test2.com

Request Parameters

Name Type Location Description Optional Value Starting Version
sourceHostnames List query Optional. Specified set of source ip addresses or domain names. 4.7.21
targetHostnames List query Specified set of target ip addresses or domain names. 4.7.21
systemTags List query Optional. The system tags. 4.7.21
userTags List query Optional. The user tags. 4.7.21

API Response

Response Sample

{
  "results": [
    {
      "sourceHostname": "172.0.0.1",
      "targetHostname": "test2.com",
      "status": "Disconnected"
    },
    {}
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
results List See results. 4.7.21

#results

Name Type Description Starting Version
sourceHostname String The source address. 4.7.21
targetHostname String The target address. 4.7.21
status HostConnectedStatus See status. 4.7.21

#status

Name Type Description Starting Version
Connected HostConnectedStatus The networke is connected. 4.7.21
Disconnected HostConnectedStatus The networke is disconnected. 4.7.21
Unknown HostConnectedStatus The network status is unknown. 4.7.21

#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.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
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.7.21

SDK Sample

Java SDK

CheckNetworkReachableAction action = new CheckNetworkReachableAction();
action.sourceHostnames = asList("172.0.0.1");
action.targetHostnames = asList("test1.com","test2.com");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckNetworkReachableAction.Result res = action.call();

Python SDK

action = CheckNetworkReachableAction()
action.sourceHostnames = [172.0.0.1]
action.targetHostnames = [test1.com, test2.com]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

SyncChronyServers

API Request

URLs

PUT zstack/v1/zops/chrony/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "syncChronyServers": {},
  "systemTags": [],
  "userTags": []
}

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 '{"syncChronyServers":{}}'
http://localhost:8080/zstack/v1/zops/chrony/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

SyncChronyServersAction action = new SyncChronyServersAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncChronyServersAction.Result res = action.call();

Python SDK

action = SyncChronyServersAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateChronyServers

API Request

URLs

PUT zstack/v1/zops/chrony/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateChronyServers": {
    "internalHostnames": [
      "172.0.0.1",
      "172.0.0.2"
    ],
    "externalHostnames": [
      "test1.ntp.com"
    ]
  },
  "systemTags": [],
  "userTags": []
}

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 '{"updateChronyServers":{"internalHostnames":["172.0.0.1","172.0.0.2"],"externalHostnames":["test1.ntp.com"]}}'
http://localhost:8080/zstack/v1/zops/chrony/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
internalHostnames List body (contained in the updateChronyServers structure) Optional. Collection of internal chrony servers. 4.7.21
externalHostnames List body (contained in the updateChronyServers structure) Optional. Collection of external chrony servers. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

UpdateChronyServersAction action = new UpdateChronyServersAction();
action.internalHostnames = asList("172.0.0.1","172.0.0.2");
action.externalHostnames = asList("test1.ntp.com");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateChronyServersAction.Result res = action.call();

Python SDK

action = UpdateChronyServersAction()
action.internalHostnames = [172.0.0.1, 172.0.0.2]
action.externalHostnames = [test1.ntp.com]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

GetChronyServers

API Request

URLs

GET zstack/v1/zops/chrony/servers

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X GET http://localhost:8080/zstack/v1/zops/chrony/servers?

Request Parameters

Name Type 位置 Description 可选值 Starting Version
systemTags List query Optional. The system tags. 4.7.21
userTags List query Optional. The user tags. 4.7.21

API Response

Response Sample

{
  "servers": [
    {
      "internal": {
        "hostname": "172.0.0.1",
        "status": "Connected"
      },
      "external": {
        "hostname": "ntp.test.com",
        "status": "Connected"
      }
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
servers List See servers. 4.7.21

#servers

Name Type Description Starting Version
internal ChronyServerInfo See internal. 4.7.21
external ChronyServerInfo See external. 4.7.21

#internal

Name Type Description Starting Version
hostname String Address. 4.7.21
status HostConnectedStatus See status. 4.7.21

#status

Name Type Description Starting Version
Connected HostConnectedStatus The networke is connected. 4.7.21
Disconnected HostConnectedStatus The networke is disconnected. 4.7.21
Unknown HostConnectedStatus The network status is unknown. 4.7.21

#external

Name Type Description Starting Version
hostname String Address. 4.7.21
status HostConnectedStatus See status. 4.7.21

#status

Name Type Description Starting Version
Connected HostConnectedStatus The networke is connected. 4.7.21
Disconnected HostConnectedStatus The networke is disconnected. 4.7.21
Unknown HostConnectedStatus The network status is unknown. 4.7.21

#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.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
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.7.21

SDK Sample

Java SDK

GetChronyServersAction action = new GetChronyServersAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetChronyServersAction.Result res = action.call();

Python SDK

action = GetChronyServersAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()