Change clustering example test create parameter
This patch fix profile and policy create parameter error, fix cluster test return to_dict error. Change-Id: I3ba61df97588a35d11149ed5c2edcc69023b2f53 Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
This commit is contained in:
parent
677d4751ef
commit
9d56efeb39
@ -91,7 +91,7 @@ def cluster_add_nodes(conn):
|
|||||||
|
|
||||||
node_ids = [NODE_ID]
|
node_ids = [NODE_ID]
|
||||||
res = conn.clustering.cluster_add_nodes(CLUSTER_ID, node_ids)
|
res = conn.clustering.cluster_add_nodes(CLUSTER_ID, node_ids)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_del_nodes(conn):
|
def cluster_del_nodes(conn):
|
||||||
@ -99,7 +99,7 @@ def cluster_del_nodes(conn):
|
|||||||
|
|
||||||
node_ids = [NODE_ID]
|
node_ids = [NODE_ID]
|
||||||
res = conn.clustering.cluster_del_nodes(CLUSTER_ID, node_ids)
|
res = conn.clustering.cluster_del_nodes(CLUSTER_ID, node_ids)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_replace_nodes(conn):
|
def cluster_replace_nodes(conn):
|
||||||
@ -111,21 +111,21 @@ def cluster_replace_nodes(conn):
|
|||||||
old_node: new_node
|
old_node: new_node
|
||||||
}
|
}
|
||||||
res = conn.clustering.cluster_replace_nodes(CLUSTER_ID, **spec)
|
res = conn.clustering.cluster_replace_nodes(CLUSTER_ID, **spec)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_scale_out(conn):
|
def cluster_scale_out(conn):
|
||||||
print("Inflate the size of a cluster:")
|
print("Inflate the size of a cluster:")
|
||||||
|
|
||||||
res = conn.clustering.cluster_scale_out(CLUSTER_ID, 1)
|
res = conn.clustering.cluster_scale_out(CLUSTER_ID, 1)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_scale_in(conn):
|
def cluster_scale_in(conn):
|
||||||
print("Shrink the size of a cluster:")
|
print("Shrink the size of a cluster:")
|
||||||
|
|
||||||
res = conn.clustering.cluster_scale_in(CLUSTER_ID, 1)
|
res = conn.clustering.cluster_scale_in(CLUSTER_ID, 1)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_resize(conn):
|
def cluster_resize(conn):
|
||||||
@ -138,7 +138,7 @@ def cluster_resize(conn):
|
|||||||
'number': 2
|
'number': 2
|
||||||
}
|
}
|
||||||
res = conn.clustering.cluster_resize(CLUSTER_ID, **spec)
|
res = conn.clustering.cluster_resize(CLUSTER_ID, **spec)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_attach_policy(conn):
|
def cluster_attach_policy(conn):
|
||||||
@ -147,21 +147,21 @@ def cluster_attach_policy(conn):
|
|||||||
spec = {'enabled': True}
|
spec = {'enabled': True}
|
||||||
res = conn.clustering.cluster_attach_policy(CLUSTER_ID, POLICY_ID,
|
res = conn.clustering.cluster_attach_policy(CLUSTER_ID, POLICY_ID,
|
||||||
**spec)
|
**spec)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def cluster_detach_policy(conn):
|
def cluster_detach_policy(conn):
|
||||||
print("Detach a policy from a cluster:")
|
print("Detach a policy from a cluster:")
|
||||||
|
|
||||||
res = conn.clustering.cluster_detach_policy(CLUSTER_ID, POLICY_ID)
|
res = conn.clustering.cluster_detach_policy(CLUSTER_ID, POLICY_ID)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def check_cluster(conn):
|
def check_cluster(conn):
|
||||||
print("Check cluster:")
|
print("Check cluster:")
|
||||||
|
|
||||||
res = conn.clustering.check_cluster(CLUSTER_ID)
|
res = conn.clustering.check_cluster(CLUSTER_ID)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
def recover_cluster(conn):
|
def recover_cluster(conn):
|
||||||
@ -169,4 +169,4 @@ def recover_cluster(conn):
|
|||||||
|
|
||||||
spec = {'check': True}
|
spec = {'check': True}
|
||||||
res = conn.clustering.recover_cluster(CLUSTER_ID, **spec)
|
res = conn.clustering.recover_cluster(CLUSTER_ID, **spec)
|
||||||
print(res.to_dict())
|
print(res)
|
||||||
|
@ -82,7 +82,7 @@ def check_node(conn):
|
|||||||
print("Check Node:")
|
print("Check Node:")
|
||||||
|
|
||||||
node = conn.clustering.check_node(NODE_ID)
|
node = conn.clustering.check_node(NODE_ID)
|
||||||
print(node.to_dict())
|
print(node)
|
||||||
|
|
||||||
|
|
||||||
def recover_node(conn):
|
def recover_node(conn):
|
||||||
@ -90,4 +90,4 @@ def recover_node(conn):
|
|||||||
|
|
||||||
spec = {'check': True}
|
spec = {'check': True}
|
||||||
node = conn.clustering.recover_node(NODE_ID, **spec)
|
node = conn.clustering.recover_node(NODE_ID, **spec)
|
||||||
print(node.to_dict())
|
print(node)
|
||||||
|
@ -30,17 +30,19 @@ def list_policies(conn):
|
|||||||
|
|
||||||
def create_policy(conn):
|
def create_policy(conn):
|
||||||
print("Create Policy:")
|
print("Create Policy:")
|
||||||
|
attrs = {
|
||||||
spec = {
|
'name': 'dp01',
|
||||||
'policy': 'senlin.policy.deletion',
|
'spec': {
|
||||||
'version': 1.0,
|
'policy': 'senlin.policy.deletion',
|
||||||
'properties': {
|
'version': 1.0,
|
||||||
'criteria': 'oldest_first',
|
'properties': {
|
||||||
'destroy_after_deletion': True,
|
'criteria': 'oldest_first',
|
||||||
|
'destroy_after_deletion': True,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
policy = conn.clustering.create_policy('dp01', spec)
|
policy = conn.clustering.create_policy(attrs)
|
||||||
print(policy.to_dict())
|
print(policy.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ def create_profile(conn):
|
|||||||
spec = {
|
spec = {
|
||||||
'profile': 'os.nova.server',
|
'profile': 'os.nova.server',
|
||||||
'version': 1.0,
|
'version': 1.0,
|
||||||
|
'name': 'os_server',
|
||||||
'properties': {
|
'properties': {
|
||||||
'name': SERVER_NAME,
|
'name': SERVER_NAME,
|
||||||
'flavor': FLAVOR_NAME,
|
'flavor': FLAVOR_NAME,
|
||||||
@ -49,7 +50,7 @@ def create_profile(conn):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = conn.clustering.create_profile('os_server', spec)
|
profile = conn.clustering.create_profile(spec)
|
||||||
print(profile.to_dict())
|
print(profile.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user