From 841b5699185442f2cc6f87a776fd707045be5587 Mon Sep 17 00:00:00 2001 From: spisarski Date: Fri, 14 Jul 2017 13:28:37 -0600 Subject: Last task necessary to stop users from easily obtaining OS objects. Changed external interfaces still exposing OpenStack created APIs to either return SNAPS-OO domain objects or objects contained on the OpenStack generated objects as to not leak implementation details that would eventually break the library when new API versions are released. JIRA: SNAPS-125 Change-Id: Iab6d6d298c4c5da68daed4b1b252313a1595a295 Signed-off-by: spisarski --- snaps/openstack/create_instance.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'snaps/openstack/create_instance.py') diff --git a/snaps/openstack/create_instance.py b/snaps/openstack/create_instance.py index 9aaf127..189ea57 100644 --- a/snaps/openstack/create_instance.py +++ b/snaps/openstack/create_instance.py @@ -334,12 +334,12 @@ class OpenStackVmInstance: """ return self.__vm - def get_os_vm_server_obj(self): + def get_console_output(self): """ - Returns the OpenStack server object - :return: the server object + Returns the vm console object for parsing logs + :return: the console output object """ - return nova_utils.get_latest_server_os_object(self.__nova, self.__vm) + return nova_utils.get_server_console_output(self.__nova, self.__vm) def get_port_ip(self, port_name, subnet_name=None): """ @@ -394,6 +394,13 @@ class OpenStackVmInstance: logger.warning('Cannot find port with name - ' + port_name) return None + def get_vm_info(self): + """ + Returns a dictionary of a VMs info as returned by OpenStack + :return: a dict() + """ + return nova_utils.get_server_info(self.__nova, self.__vm) + def config_nics(self): """ Responsible for configuring NICs on RPM systems where the instance has @@ -554,18 +561,17 @@ class OpenStackVmInstance: if not self.__vm: return False - instance = nova_utils.get_latest_server_os_object( - self.__nova, self.__vm) - if not instance: + status = nova_utils.get_server_status(self.__nova, self.__vm) + if not status: logger.warning('Cannot find instance with id - ' + self.__vm.id) return False - if instance.status == 'ERROR': + if status == 'ERROR': raise Exception('Instance had an error during deployment') logger.debug( 'Instance status [%s] is - %s', self.instance_settings.name, - instance.status) - return instance.status == expected_status_code + status) + return status == expected_status_code def vm_ssh_active(self, block=False, poll_interval=POLL_INTERVAL): """ -- cgit 1.2.3-korg