This topic describes how to delete a zone and its nodes from a cluster by using the obshell-sdk-python.
Note
Before you proceed, make sure that you have read the Quick Start topic to learn how to use the obshell-sdk-python.
Considerations
Before you scale down the cluster, make sure that the following conditions are met:
The client node that sends the request must be in the cluster to be scaled down and must not be in the zone to be deleted.
The obshell process is running.
The zone to be deleted has no units.
Sample code
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance. The node address is '10.10.10.1', and the port is 2886.
# The root@sys password of the cluster is '****'.
client = ClientSet("10.10.10.1", 2886, PasswordAuth("****"))
# Delete the zone3.
client.v1.delete_zone_sync("zone3")
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance. The node address is '10.10.10.1', and the port is 2886.
# The root@sys password of the cluster is '****'.
client = ClientSet("10.10.10.1", 2886, PasswordAuth("****"))
# Delete the zone3.
dag = client.v1.delete_zone("zone3")
# Wait for the task to complete.
if dag is not None:
client.v1.wait_dag_succeed(dag.generic_id)
References
For more information about the API for deleting a zone, see Delete a zone.
For more information about how to request the API by using the obshell-sdk-go, see Delete a zone.