diff options
author | yunlong ying <ying.yunlong@zte.com.cn> | 2017-02-11 07:49:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@open-o.org> | 2017-02-11 07:49:01 +0000 |
commit | c6fb834ac470606d6ffb41e79b1c8495961dd545 (patch) | |
tree | 3a4b7fd4b6a4aa3d2ceca9d50084f150229e18c2 | |
parent | 6a53a2e1e895acddd0c9ae64f41d809da438e6de (diff) | |
parent | 862b71cc27e1a348ec770fa68118bf940a51c266 (diff) |
Merge "Add vm call of vimdriver"
-rw-r--r-- | lcm/lcm/pub/vimapi/api.py | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/lcm/lcm/pub/vimapi/api.py b/lcm/lcm/pub/vimapi/api.py index 1cdb0273..00a8735e 100644 --- a/lcm/lcm/pub/vimapi/api.py +++ b/lcm/lcm/pub/vimapi/api.py @@ -24,6 +24,8 @@ def call(vim_id, res, method, data=''): raise VimException(ret[1], ret[2]) return json.JSONDecoder().decode(ret[1]) if ret[1] else {} +###################################################################### + def create_image(vim_id, data): return call(vim_id, "images", "POST", data) @@ -36,6 +38,8 @@ def get_image(vim_id, image_id): def list_image(vim_id): return call(vim_id, "images", "GET") +###################################################################### + def create_network(vim_id, data): return call(vim_id, "networks", "POST", data) @@ -47,7 +51,9 @@ def get_network(vim_id, network_id): def list_network(vim_id): return call(vim_id, "networks", "GET") - + +###################################################################### + def create_subnet(vim_id, data): return call(vim_id, "subnets", "POST", data) @@ -60,6 +66,8 @@ def get_subnet(vim_id, subnet_id): def list_subnet(vim_id): return call(vim_id, "subnets", "GET") +###################################################################### + def create_port(vim_id, data): return call(vim_id, "ports", "POST", data) @@ -71,7 +79,9 @@ def get_port(vim_id, port_id): def list_port(vim_id): return call(vim_id, "ports", "GET") - + +###################################################################### + def create_flavor(vim_id, data): return call(vim_id, "flavors", "POST", data) @@ -83,3 +93,31 @@ def get_flavor(vim_id, flavor_id): def list_flavor(vim_id): return call(vim_id, "flavors", "GET") + +###################################################################### + +def create_vm(vim_id, data): + return call(vim_id, "vms", "POST", data) + +def delete_vm(vim_id, vm_id): + return call(vim_id, "vms/%s" % vm_id, "DELETE") + +def get_vm(vim_id, vm_id): + return call(vim_id, "vms/%s" % vm_id, "GET") + +def list_vm(vim_id): + return call(vim_id, "vms", "GET") + +###################################################################### + +def create_volume(vim_id, data): + return call(vim_id, "volumes", "POST", data) + +def delete_volume(vim_id, volume_id): + return call(vim_id, "volumes/%s" % volume_id, "DELETE") + +def get_volume(vim_id, volume_id): + return call(vim_id, "volumes/%s" % volume_id, "GET") + +def list_volume(vim_id): + return call(vim_id, "volumes", "GET") |