This topic describes how to delete a specified tenant replica by using obshell-sdk-python. You can delete multiple tenant replicas at a time.
Note
We recommend that you first read obshell-sdk-python quick start to learn how to use obshell-sdk-python.
Considerations
Make sure that obshell is running.
Make sure that the tenant exists and is in the NORMAL state.
The node corresponding to the client in the request must be in an initialized cluster.
Sample code
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance, with the node address set to '10.10.10.1' and the port set to 2886.
client = ClientSet("10.10.10.1", 2886, PassswordAuth("****"))
# Delete the replica of the tenant on zone3.
client.v1.delete_tenant_replica_sync("t1", ["zone3"])
from obshell import ClientSet
from obshell.auth import PasswordAuth
from obshell.model import ZoneParam
# Create a client instance, with the node address set to '10.10.10.1' and the port set to 2886.
client = ClientSet("10.10.10.1", 2886, PasswordAuth("****"))
# Delete the replica of the tenant on zone3.
dag = client.v1.delete_tenant_replica("t1", ["zone3"])
# Wait for the task to complete.
client.v1.wait_dag_succeed(dag.generic_id)
References
For more information about the API for deleting a tenant replica, see Delete a tenant replica.
For more information about how to call the API method by using obshell-sdk-go, see Delete a tenant replica.