summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/utils
diff options
context:
space:
mode:
authormbeierl <mark.beierl@dell.com>2018-05-10 16:16:25 -0400
committerspisarski <s.pisarski@cablelabs.com>2018-06-20 15:45:46 -0600
commit0175feef9f00ea7595e4f7cc13f3b7a9c26e9a02 (patch)
tree875646d39b55059b6d3a8c6af86b162548d3a963 /snaps/openstack/utils
parentb2590d79a80dc12948d028ffee5b911b59daa777 (diff)
Adds Stack Update
Adds function to allow stack update to occur. Includes higher level object calls for stack update. Added blocking parameter to create() and update() Rebase screwed up some changes. Added new test to test_suite_builder.py and updated IntegrationTests.rst accordingly Change-Id: I4558befb3ea8ea7982faff79d1ebb54fbb3d44a7 Signed-off-by: mbeierl <mark.beierl@dell.com>
Diffstat (limited to 'snaps/openstack/utils')
-rw-r--r--snaps/openstack/utils/heat_utils.py18
-rw-r--r--snaps/openstack/utils/nova_utils.py11
2 files changed, 26 insertions, 3 deletions
diff --git a/snaps/openstack/utils/heat_utils.py b/snaps/openstack/utils/heat_utils.py
index a90690b..17de020 100644
--- a/snaps/openstack/utils/heat_utils.py
+++ b/snaps/openstack/utils/heat_utils.py
@@ -144,6 +144,24 @@ def create_stack(heat_cli, stack_settings):
return get_stack_by_id(heat_cli, stack_id=stack['stack']['id'])
+def update_stack(heat_cli, stack, env_vals):
+ """
+ Updates the specified parameters in the stack
+ :param heat_cli: the OpenStack heat client object
+ :param stack_settings: the stack configuration
+ """
+ args = dict()
+
+ args['stack_name'] = stack.name
+ args['existing'] = True
+
+ if env_vals:
+ args['parameters'] = env_vals
+ heat_cli.stacks.update(stack.id, **args)
+ else:
+ logger.warn('Stack not updated, env_vals are None')
+
+
def delete_stack(heat_cli, stack):
"""
Deletes the Heat stack
diff --git a/snaps/openstack/utils/nova_utils.py b/snaps/openstack/utils/nova_utils.py
index 8be9b2a..005b56f 100644
--- a/snaps/openstack/utils/nova_utils.py
+++ b/snaps/openstack/utils/nova_utils.py
@@ -206,9 +206,14 @@ def __map_os_server_obj_to_vm_inst(neutron, keystone, os_server,
network = neutron_utils.get_network(
neutron, keystone, network_name=net_name,
project_name=project_name)
- ports = neutron_utils.get_ports(neutron, network, ips)
- for port in ports:
- out_ports.append(port)
+ if network:
+ ports = neutron_utils.get_ports(neutron, network, ips)
+ for port in ports:
+ out_ports.append(port)
+ else:
+ raise NovaException(
+ 'Unable to locate network in project {} with '
+ 'name {}'.format(project_name, net_name))
volumes = None
if hasattr(os_server, 'os-extended-volumes:volumes_attached'):