diff options
Diffstat (limited to 'snaps/openstack/utils')
-rw-r--r-- | snaps/openstack/utils/deploy_utils.py | 2 | ||||
-rw-r--r-- | snaps/openstack/utils/nova_utils.py | 4 | ||||
-rw-r--r-- | snaps/openstack/utils/settings_utils.py | 21 | ||||
-rw-r--r-- | snaps/openstack/utils/tests/heat_utils_tests.py | 2 | ||||
-rw-r--r-- | snaps/openstack/utils/tests/nova_utils_tests.py | 8 | ||||
-rw-r--r-- | snaps/openstack/utils/tests/settings_utils_tests.py | 15 |
6 files changed, 26 insertions, 26 deletions
diff --git a/snaps/openstack/utils/deploy_utils.py b/snaps/openstack/utils/deploy_utils.py index 8c8431d..8cd6dd3 100644 --- a/snaps/openstack/utils/deploy_utils.py +++ b/snaps/openstack/utils/deploy_utils.py @@ -121,7 +121,7 @@ def create_vm_instance(os_creds, instance_settings, image_settings, """ Creates a VM instance :param os_creds: The OpenStack credentials - :param instance_settings: Instance of VmInstanceSettings + :param instance_settings: Instance of VmInstanceConfig :param image_settings: The object containing image settings :param keypair_creator: The object responsible for creating the keypair associated with this VM instance. (optional) diff --git a/snaps/openstack/utils/nova_utils.py b/snaps/openstack/utils/nova_utils.py index b974f2e..ffc9240 100644 --- a/snaps/openstack/utils/nova_utils.py +++ b/snaps/openstack/utils/nova_utils.py @@ -125,7 +125,7 @@ def get_server(nova, vm_inst_settings=None, server_name=None): """ Returns a VmInst object for the first server instance found. :param nova: the Nova client - :param vm_inst_settings: the VmInstanceSettings object from which to build + :param vm_inst_settings: the VmInstanceConfig object from which to build the query if not None :param server_name: the server with this name to return if vm_inst_settings is not None @@ -146,7 +146,7 @@ def get_server_connection(nova, vm_inst_settings=None, server_name=None): """ Returns a VmInst object for the first server instance found. :param nova: the Nova client - :param vm_inst_settings: the VmInstanceSettings object from which to build + :param vm_inst_settings: the VmInstanceConfig object from which to build the query if not None :param server_name: the server with this name to return if vm_inst_settings is not None diff --git a/snaps/openstack/utils/settings_utils.py b/snaps/openstack/utils/settings_utils.py index ab26d3d..5433570 100644 --- a/snaps/openstack/utils/settings_utils.py +++ b/snaps/openstack/utils/settings_utils.py @@ -19,11 +19,10 @@ from snaps.config.flavor import FlavorConfig from snaps.config.keypair import KeypairConfig from snaps.config.network import SubnetConfig, PortConfig, NetworkConfig from snaps.config.router import RouterConfig +from snaps.config.vm_inst import VmInstanceConfig, FloatingIpConfig from snaps.config.volume import VolumeConfig from snaps.config.volume_type import ( ControlLocation, VolumeTypeEncryptionConfig, VolumeTypeConfig) -from snaps.openstack.create_instance import ( - VmInstanceSettings, FloatingIpSettings) from snaps.openstack.create_security_group import ( SecurityGroupSettings, SecurityGroupRuleSettings) from snaps.openstack.utils import ( @@ -93,7 +92,7 @@ def create_subnet_config(neutron, network): return out -def create_router_settings(neutron, router): +def create_router_config(neutron, router): """ Returns a RouterConfig object :param neutron: the neutron client @@ -202,7 +201,7 @@ def create_flavor_config(flavor): is_public=flavor.is_public) -def create_keypair_settings(heat_cli, stack, keypair, pk_output_key): +def create_keypair_config(heat_cli, stack, keypair, pk_output_key): """ Instantiates a KeypairConfig object from a Keypair domain objects :param heat_cli: the heat client @@ -228,7 +227,7 @@ def create_keypair_settings(heat_cli, stack, keypair, pk_output_key): return KeypairConfig(name=keypair.name) -def create_vm_inst_settings(nova, neutron, server): +def create_vm_inst_config(nova, neutron, server): """ Returns a NetworkConfig object :param nova: the nova client @@ -252,10 +251,10 @@ def create_vm_inst_settings(nova, neutron, server): kwargs['port_settings'] = __create_port_config( neutron, net_tuples) kwargs['security_group_names'] = server.sec_grp_names - kwargs['floating_ip_settings'] = __create_floatingip_settings( + kwargs['floating_ip_settings'] = __create_floatingip_config( neutron, kwargs['port_settings']) - return VmInstanceSettings(**kwargs) + return VmInstanceConfig(**kwargs) def __create_port_config(neutron, networks): @@ -292,13 +291,13 @@ def __create_port_config(neutron, networks): return out -def __create_floatingip_settings(neutron, port_settings): +def __create_floatingip_config(neutron, port_settings): """ - Returns a list of FloatingIPSettings objects as they pertain to an + Returns a list of FloatingIpConfig objects as they pertain to an existing deployed server instance :param neutron: the neutron client :param port_settings: list of SNAPS-OO PortConfig objects - :return: a list of FloatingIPSettings objects or an empty list if no + :return: a list of FloatingIpConfig objects or an empty list if no floating IPs have been created """ base_fip_name = 'fip-' @@ -340,7 +339,7 @@ def __create_floatingip_settings(neutron, port_settings): if subnet: kwargs['subnet_name'] = subnet.name - out.append(FloatingIpSettings(**kwargs)) + out.append(FloatingIpConfig(**kwargs)) fip_ctr += 1 diff --git a/snaps/openstack/utils/tests/heat_utils_tests.py b/snaps/openstack/utils/tests/heat_utils_tests.py index 2f1e7cc..298dc31 100644 --- a/snaps/openstack/utils/tests/heat_utils_tests.py +++ b/snaps/openstack/utils/tests/heat_utils_tests.py @@ -313,7 +313,7 @@ class HeatUtilsCreateComplexStackTests(OSComponentTestCase): servers = heat_utils.get_stack_servers( self.heat_client, nova, self.stack) for server in servers: - vm_settings = settings_utils.create_vm_inst_settings( + vm_settings = settings_utils.create_vm_inst_config( nova, neutron, server) img_settings = settings_utils.determine_image_config( glance, server, diff --git a/snaps/openstack/utils/tests/nova_utils_tests.py b/snaps/openstack/utils/tests/nova_utils_tests.py index 6d4bc3c..c4bc9cb 100644 --- a/snaps/openstack/utils/tests/nova_utils_tests.py +++ b/snaps/openstack/utils/tests/nova_utils_tests.py @@ -21,12 +21,12 @@ import os from snaps import file_utils from snaps.config.flavor import FlavorConfig from snaps.config.network import PortConfig +from snaps.config.vm_inst import VmInstanceConfig from snaps.config.volume import VolumeConfig from snaps.openstack import create_instance from snaps.openstack.create_flavor import OpenStackFlavor from snaps.openstack.create_image import OpenStackImage -from snaps.openstack.create_instance import ( - VmInstanceSettings, OpenStackVmInstance) +from snaps.openstack.create_instance import OpenStackVmInstance from snaps.openstack.create_network import OpenStackNetwork from snaps.openstack.create_volume import OpenStackVolume from snaps.openstack.tests import openstack_tests @@ -265,7 +265,7 @@ class NovaUtilsInstanceTests(OSComponentTestCase): self.port = neutron_utils.create_port( self.neutron, self.os_creds, port_settings) - self.instance_settings = VmInstanceSettings( + self.instance_settings = VmInstanceConfig( name=guid + '-vm_inst', flavor=self.flavor_creator.flavor_settings.name, port_settings=[port_settings]) @@ -385,7 +385,7 @@ class NovaUtilsInstanceVolumeTests(OSComponentTestCase): port_settings = PortConfig( name=guid + '-port', network_name=network_settings.name) - instance_settings = VmInstanceSettings( + instance_settings = VmInstanceConfig( name=guid + '-vm_inst', flavor=self.flavor_creator.flavor_settings.name, port_settings=[port_settings]) diff --git a/snaps/openstack/utils/tests/settings_utils_tests.py b/snaps/openstack/utils/tests/settings_utils_tests.py index b34e68b..d0390e2 100644 --- a/snaps/openstack/utils/tests/settings_utils_tests.py +++ b/snaps/openstack/utils/tests/settings_utils_tests.py @@ -22,6 +22,7 @@ from snaps.config.network import SubnetConfig, NetworkConfig, PortConfig from snaps.config.flavor import FlavorConfig from snaps.config.keypair import KeypairConfig from snaps.config.qos import Consumer +from snaps.config.vm_inst import VmInstanceConfig, FloatingIpConfig from snaps.domain.flavor import Flavor from snaps.domain.volume import ( Volume, VolumeType, VolumeTypeEncryption, QoSSpec) @@ -144,7 +145,7 @@ class SettingsUtilsNetworkingTests(OSComponentTestCase): class SettingsUtilsVmInstTests(OSComponentTestCase): """ - Tests the ability to reverse engineer VmInstanceSettings objects from + Tests the ability to reverse engineer VmInstanceConfig objects from existing VMs/servers deployed to OpenStack """ @@ -238,11 +239,11 @@ class SettingsUtilsVmInstTests(OSComponentTestCase): name=self.port_1_name, network_name=self.pub_net_config.network_settings.name)) - instance_settings = create_instance.VmInstanceSettings( + instance_settings = VmInstanceConfig( name=self.vm_inst_name, flavor=self.flavor_creator.flavor_settings.name, port_settings=ports_settings, - floating_ip_settings=[create_instance.FloatingIpSettings( + floating_ip_settings=[FloatingIpConfig( name=self.floating_ip_name, port_name=self.port_1_name, router_name=self.pub_net_config.router_settings.name)]) @@ -317,16 +318,16 @@ class SettingsUtilsVmInstTests(OSComponentTestCase): # super(self.__class__, self).__clean__() - def test_derive_vm_inst_settings(self): + def test_derive_vm_inst_config(self): """ - Validates the utility function settings_utils#create_vm_inst_settings - returns an acceptable VmInstanceSettings object + Validates the utility function settings_utils#create_vm_inst_config + returns an acceptable VmInstanceConfig object """ self.inst_creator.create(block=True) server = nova_utils.get_server( self.nova, vm_inst_settings=self.inst_creator.instance_settings) - derived_vm_settings = settings_utils.create_vm_inst_settings( + derived_vm_settings = settings_utils.create_vm_inst_config( self.nova, self.neutron, server) self.assertIsNotNone(derived_vm_settings) self.assertIsNotNone(derived_vm_settings.port_settings) |