summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/create_instance.py
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2017-12-18 10:02:02 -0700
committerspisarski <s.pisarski@cablelabs.com>2017-12-18 10:02:02 -0700
commitdc6699282623b5cb3e0df80f8687b8e1333e88bd (patch)
tree241209570229ca6f8d93b34b4fe2c908c43f56aa /snaps/openstack/create_instance.py
parent2f32a84057a7562524cda9f224b13ba0a394d7ce (diff)
Refactored VmInst domain class for Ports.
Removed network dict and replaced with a list of Port domain objects. The old network member was directly copied into the VmInst object from neutron meaning that Neutron implementation details were leaking through. This refactor not only makes VmInst objects easier to use, it also ensures that future Neutron API changes will not break the library. JIRA: SNAPS-251 Change-Id: I3e5e811e433bf7670ecd80405186ac2ac0739def Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/create_instance.py')
-rw-r--r--snaps/openstack/create_instance.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/snaps/openstack/create_instance.py b/snaps/openstack/create_instance.py
index 0105ef0..8e3eb01 100644
--- a/snaps/openstack/create_instance.py
+++ b/snaps/openstack/create_instance.py
@@ -104,7 +104,8 @@ class OpenStackVmInstance(OpenStackComputeObject):
within the project
"""
server = nova_utils.get_server(
- self._nova, vm_inst_settings=self.instance_settings)
+ self._nova, self.__neutron,
+ vm_inst_settings=self.instance_settings)
if server:
if server.name == self.instance_settings.name:
self.__vm = server
@@ -166,7 +167,7 @@ class OpenStackVmInstance(OpenStackComputeObject):
if volume and self.vm_active(block=True):
timeout = 30
vm = nova_utils.attach_volume(
- self._nova, self.__vm, volume, timeout)
+ self._nova, self.__neutron, self.__vm, volume, timeout)
if vm:
self.__vm = vm
@@ -266,7 +267,7 @@ class OpenStackVmInstance(OpenStackComputeObject):
if volume:
try:
vm = nova_utils.detach_volume(
- self._nova, self.__vm, volume, 30)
+ self._nova, self.__neutron, self.__vm, volume, 30)
if vm:
self.__vm = vm
else:
@@ -416,7 +417,8 @@ class OpenStackVmInstance(OpenStackComputeObject):
Returns the latest version of this server object from OpenStack
:return: Server object
"""
- return nova_utils.get_server_object_by_id(self._nova, self.__vm.id)
+ return nova_utils.get_server_object_by_id(
+ self._nova, self.__neutron, self.__vm.id)
def get_console_output(self):
"""
@@ -607,7 +609,7 @@ class OpenStackVmInstance(OpenStackComputeObject):
STATUS_ACTIVE, block, self.instance_settings.vm_boot_timeout,
poll_interval):
self.__vm = nova_utils.get_server_object_by_id(
- self._nova, self.__vm.id)
+ self._nova, self.__neutron, self.__vm.id)
return True
return False