diff options
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/pub/utils/restcall.py | 16 | ||||
-rw-r--r-- | vio/vio/pub/vim/drivers/vimsdk/heat.py | 4 | ||||
-rw-r--r-- | vio/vio/pub/vim/vimapi/heat/OperateStack.py | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/vio/vio/pub/utils/restcall.py b/vio/vio/pub/utils/restcall.py index 12986be..33f10cd 100644 --- a/vio/vio/pub/utils/restcall.py +++ b/vio/vio/pub/utils/restcall.py @@ -222,6 +222,22 @@ class AAIClient(object): content=json.dumps(body), headers=self.default_headers) + def add_vservers(self, content): + for server in content['servers']: + resource = ("/vservers/vserver/%s" % server['id']) + body = { + 'vserver-name': server['name'], + 'vserver-name2': server['name'], + "vserver-id": server['id'], + "vserver-selflink": server['link'], + "prov-status": server['status'] + } + logger.debug("Add server to cloud region: %s" % body) + call_req(self.base_url, self.username, self.password, + rest_no_auth, resource, "PUT", + content=json.dumps(body), + headers=self.default_headers) + def add_flavors(self, content): for flavor in content['flavors']: resource = ("/cloud-infrastructure/cloud-regions/cloud-region/" diff --git a/vio/vio/pub/vim/drivers/vimsdk/heat.py b/vio/vio/pub/vim/drivers/vimsdk/heat.py index 0dad830..efb88d4 100644 --- a/vio/vio/pub/vim/drivers/vimsdk/heat.py +++ b/vio/vio/pub/vim/drivers/vimsdk/heat.py @@ -48,6 +48,10 @@ class HeatClient(base.DriverBase): ignore_missing) @sdk.translate_exception + def stack_resources(self, stack_id): + return self.conn.orchestration.resources(stack_id) + + @sdk.translate_exception def wait_for_stack(self, stack_id, status, failures=None, interval=2, timeout=None): if failures is None: diff --git a/vio/vio/pub/vim/vimapi/heat/OperateStack.py b/vio/vio/pub/vim/vimapi/heat/OperateStack.py index 60b39fa..1824aa4 100644 --- a/vio/vio/pub/vim/vimapi/heat/OperateStack.py +++ b/vio/vio/pub/vim/vimapi/heat/OperateStack.py @@ -53,3 +53,7 @@ class OperateStack(baseclient): def delete_vim_stack(self, stack_id): stack = self.heat(self.param).stack_delete(stack_id) return stack + + def get_stack_resources(self, stack_id): + resources = self.heat(self.param).stack_resources(stack_id) + return [res for res in resources] |