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:
Yuanbin.Chen 2018-05-07 14:29:25 +08:00
parent 677d4751ef
commit 9d56efeb39
4 changed files with 24 additions and 21 deletions

View File

@ -91,7 +91,7 @@ def cluster_add_nodes(conn):
node_ids = [NODE_ID]
res = conn.clustering.cluster_add_nodes(CLUSTER_ID, node_ids)
print(res.to_dict())
print(res)
def cluster_del_nodes(conn):
@ -99,7 +99,7 @@ def cluster_del_nodes(conn):
node_ids = [NODE_ID]
res = conn.clustering.cluster_del_nodes(CLUSTER_ID, node_ids)
print(res.to_dict())
print(res)
def cluster_replace_nodes(conn):
@ -111,21 +111,21 @@ def cluster_replace_nodes(conn):
old_node: new_node
}
res = conn.clustering.cluster_replace_nodes(CLUSTER_ID, **spec)
print(res.to_dict())
print(res)
def cluster_scale_out(conn):
print("Inflate the size of a cluster:")
res = conn.clustering.cluster_scale_out(CLUSTER_ID, 1)
print(res.to_dict())
print(res)
def cluster_scale_in(conn):
print("Shrink the size of a cluster:")
res = conn.clustering.cluster_scale_in(CLUSTER_ID, 1)
print(res.to_dict())
print(res)
def cluster_resize(conn):
@ -138,7 +138,7 @@ def cluster_resize(conn):
'number': 2
}
res = conn.clustering.cluster_resize(CLUSTER_ID, **spec)
print(res.to_dict())
print(res)
def cluster_attach_policy(conn):
@ -147,21 +147,21 @@ def cluster_attach_policy(conn):
spec = {'enabled': True}
res = conn.clustering.cluster_attach_policy(CLUSTER_ID, POLICY_ID,
**spec)
print(res.to_dict())
print(res)
def cluster_detach_policy(conn):
print("Detach a policy from a cluster:")
res = conn.clustering.cluster_detach_policy(CLUSTER_ID, POLICY_ID)
print(res.to_dict())
print(res)
def check_cluster(conn):
print("Check cluster:")
res = conn.clustering.check_cluster(CLUSTER_ID)
print(res.to_dict())
print(res)
def recover_cluster(conn):
@ -169,4 +169,4 @@ def recover_cluster(conn):
spec = {'check': True}
res = conn.clustering.recover_cluster(CLUSTER_ID, **spec)
print(res.to_dict())
print(res)

View File

@ -82,7 +82,7 @@ def check_node(conn):
print("Check Node:")
node = conn.clustering.check_node(NODE_ID)
print(node.to_dict())
print(node)
def recover_node(conn):
@ -90,4 +90,4 @@ def recover_node(conn):
spec = {'check': True}
node = conn.clustering.recover_node(NODE_ID, **spec)
print(node.to_dict())
print(node)

View File

@ -30,8 +30,9 @@ def list_policies(conn):
def create_policy(conn):
print("Create Policy:")
spec = {
attrs = {
'name': 'dp01',
'spec': {
'policy': 'senlin.policy.deletion',
'version': 1.0,
'properties': {
@ -39,8 +40,9 @@ def create_policy(conn):
'destroy_after_deletion': True,
}
}
}
policy = conn.clustering.create_policy('dp01', spec)
policy = conn.clustering.create_policy(attrs)
print(policy.to_dict())

View File

@ -39,6 +39,7 @@ def create_profile(conn):
spec = {
'profile': 'os.nova.server',
'version': 1.0,
'name': 'os_server',
'properties': {
'name': SERVER_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())