X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO-VIM-openstack%2Fosm_rovim_openstack%2Fvimconn_openstack.py;h=221fc24190806376c6803c2aa7d8fa9c6dc93e76;hb=8875f910d2d188ee3ada1e249b718b7663296a10;hp=54d0e88ad8f9799484e3613f4cbb3fbb9272f333;hpb=aca8cb5e63ebd11cc69373323d8df62b5d8cbfe2;p=osm%2FRO.git diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index 54d0e88a..221fc241 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -3376,6 +3376,12 @@ class vimconnector(vimconn.VimConnector): if "start" in action_dict: if action_dict["start"] == "rebuild": server.rebuild() + vm_state = self.__wait_for_vm(vm_id, "ACTIVE") + if not vm_state: + raise nvExceptions.BadRequest( + 409, + message="Cannot 'REBUILD' vm_state is in ERROR", + ) else: if server.status == "PAUSED": server.unpause() @@ -3383,6 +3389,12 @@ class vimconnector(vimconn.VimConnector): server.resume() elif server.status == "SHUTOFF": server.start() + vm_state = self.__wait_for_vm(vm_id, "ACTIVE") + if not vm_state: + raise nvExceptions.BadRequest( + 409, + message="Cannot 'START' vm_state is in ERROR", + ) else: self.logger.debug( "ERROR : Instance is not in SHUTOFF/PAUSE/SUSPEND state" @@ -3399,6 +3411,12 @@ class vimconnector(vimconn.VimConnector): self.logger.debug("server status %s", server.status) if server.status == "ACTIVE": server.stop() + vm_state = self.__wait_for_vm(vm_id, "SHUTOFF") + if not vm_state: + raise nvExceptions.BadRequest( + 409, + message="Cannot 'STOP' vm_state is in ERROR", + ) else: self.logger.debug("ERROR: VM is not in Active state") raise vimconn.VimConnException(