diff options
author | spisarski <s.pisarski@cablelabs.com> | 2017-10-27 14:06:01 -0600 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2017-10-27 15:55:54 -0600 |
commit | 6b7307374f6cfcad9eec8986aba8fdd8e08c8574 (patch) | |
tree | ebecca41a486b735d116fd2abc997c7b24ff6dff /snaps/openstack/utils/settings_utils.py | |
parent | 08ebe69c1d2e29aa02efd59f58dbbc0be4f9cd37 (diff) |
Return OpenStackVolume and OpenStackVolumeType instances from heat.
Added a methods to OpenStackHeatStack to return any OpenStackVolume
and OpenStackVolumeType objects it was responsible for spawning.
Changes include all of the necessary changes to the heat and
settings utilities and associated tests.
JIRA: SNAPS-199, SNAPS-200
Change-Id: I6da4bce1e90f080e22c96ab1b46eca8b85991ebf
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/utils/settings_utils.py')
-rw-r--r-- | snaps/openstack/utils/settings_utils.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/snaps/openstack/utils/settings_utils.py b/snaps/openstack/utils/settings_utils.py index 7f00075..7169319 100644 --- a/snaps/openstack/utils/settings_utils.py +++ b/snaps/openstack/utils/settings_utils.py @@ -20,6 +20,9 @@ from snaps.openstack.create_instance import ( from snaps.openstack.create_keypairs import KeypairSettings from snaps.openstack.create_network import ( PortSettings, SubnetSettings, NetworkSettings) +from snaps.openstack.create_volume import VolumeSettings +from snaps.openstack.create_volume_type import ( + VolumeTypeSettings, VolumeTypeEncryptionSettings, ControlLocation) from snaps.openstack.utils import ( neutron_utils, nova_utils, heat_utils, glance_utils) @@ -63,6 +66,49 @@ def create_subnet_settings(neutron, network): return out +def create_volume_settings(volume): + """ + Returns a VolumeSettings object + :param volume: a SNAPS-OO Volume object + """ + + return VolumeSettings( + name=volume.name, description=volume.description, + size=volume.size, type_name=volume.type, + availability_zone=volume.availability_zone, + multi_attach=volume.multi_attach) + + +def create_volume_type_settings(volume_type): + """ + Returns a VolumeTypeSettings object + :param volume_type: a SNAPS-OO VolumeType object + """ + + control = None + if volume_type.encryption: + if (volume_type.encryption.control_location + == ControlLocation.front_end.value): + control = ControlLocation.front_end + else: + control = ControlLocation.back_end + + encrypt_settings = VolumeTypeEncryptionSettings( + name=volume_type.encryption.__class__, + provider_class=volume_type.encryption.provider, + control_location=control, + cipher=volume_type.encryption.cipher, + key_size=volume_type.encryption.key_size) + + qos_spec_name = None + if volume_type.qos_spec: + qos_spec_name = volume_type.qos_spec.name + + return VolumeTypeSettings( + name=volume_type.name, encryption=encrypt_settings, + qos_spec_name=qos_spec_name, public=volume_type.public) + + def create_vm_inst_settings(nova, neutron, server): """ Returns a NetworkSettings object |