- volume_types = os_utils.list_volume_types(self.cinder_client,
- private=False)
- if volume_types:
- LOGGER.debug("Using existing volume type(s)...")
- else:
- LOGGER.debug('Creating volume type...')
- self.volume_type = os_utils.create_volume_type(
- self.cinder_client, self.CINDER_VOLUME_TYPE_NAME)
- if self.volume_type is None:
- raise Exception("Failed to create volume type '%s'" %
- self.CINDER_VOLUME_TYPE_NAME)
- LOGGER.debug("Volume type '%s' is created succesfully.",
- self.CINDER_VOLUME_TYPE_NAME)
-
- LOGGER.debug('Getting or creating image...')
- self.image_exists, self.image_id = os_utils.get_or_create_image(
- self.GLANCE_IMAGE_NAME,
- self.GLANCE_IMAGE_PATH,
- self.GLANCE_IMAGE_FORMAT)
- if self.image_id is None:
- raise Exception("Failed to get or create image '%s'" %
- self.GLANCE_IMAGE_NAME)
-
- LOGGER.debug("Creating network '%s'...", self.RALLY_PRIVATE_NET_NAME)
- self.network_dict = os_utils.create_shared_network_full(
- self.RALLY_PRIVATE_NET_NAME,
- self.RALLY_PRIVATE_SUBNET_NAME,
- self.RALLY_ROUTER_NAME,
- self.RALLY_PRIVATE_SUBNET_CIDR)
- if self.network_dict is None:
- raise Exception("Failed to create shared network '%s'" %
- self.RALLY_PRIVATE_NET_NAME)
+ network_name = self.RALLY_PRIVATE_NET_NAME + self.guid
+ subnet_name = self.RALLY_PRIVATE_SUBNET_NAME + self.guid
+ router_name = self.RALLY_ROUTER_NAME + self.guid
+ self.image_name = self.GLANCE_IMAGE_NAME + self.guid
+ self.flavor_name = self.FLAVOR_NAME + self.guid
+ self.flavor_alt_name = self.FLAVOR_ALT_NAME + self.guid
+ self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds)
+ self.compute_cnt = snaps_utils.get_active_compute_cnt(self.os_creds)
+
+ LOGGER.debug("Creating image '%s'...", self.image_name)
+ image_creator = deploy_utils.create_image(
+ self.os_creds, ImageConfig(
+ name=self.image_name,
+ image_file=self.GLANCE_IMAGE_PATH,
+ img_format=self.GLANCE_IMAGE_FORMAT,
+ image_user=self.GLANCE_IMAGE_USERNAME,
+ public=True,
+ extra_properties=self.GLANCE_IMAGE_EXTRA_PROPERTIES))
+ if image_creator is None:
+ raise Exception("Failed to create image")
+ self.creators.append(image_creator)
+
+ LOGGER.debug("Creating network '%s'...", network_name)
+
+ rally_network_type = getattr(config.CONF, 'rally_network_type', None)
+ rally_physical_network = getattr(
+ config.CONF, 'rally_physical_network', None)
+ rally_segmentation_id = getattr(
+ config.CONF, 'rally_segmentation_id', None)
+
+ network_creator = deploy_utils.create_network(
+ self.os_creds, NetworkConfig(
+ name=network_name,
+ shared=True,
+ network_type=rally_network_type,
+ physical_network=rally_physical_network,
+ segmentation_id=rally_segmentation_id,
+ subnet_settings=[SubnetConfig(
+ name=subnet_name,
+ cidr=self.RALLY_PRIVATE_SUBNET_CIDR)]))
+ if network_creator is None:
+ raise Exception("Failed to create private network")
+ self.priv_net_id = network_creator.get_network().id
+ self.creators.append(network_creator)
+
+ LOGGER.debug("Creating router '%s'...", router_name)
+ router_creator = deploy_utils.create_router(
+ self.os_creds, RouterConfig(
+ name=router_name,
+ external_gateway=self.ext_net_name,
+ internal_subnets=[subnet_name]))
+ if router_creator is None:
+ raise Exception("Failed to create router")
+ self.creators.append(router_creator)
+
+ LOGGER.debug("Creating flavor '%s'...", self.flavor_name)
+ flavor_creator = OpenStackFlavor(
+ self.os_creds, FlavorConfig(
+ name=self.flavor_name, ram=self.FLAVOR_RAM, disk=1, vcpus=1,
+ metadata=self.FLAVOR_EXTRA_SPECS))
+ if flavor_creator is None or flavor_creator.create() is None:
+ raise Exception("Failed to create flavor")
+ self.creators.append(flavor_creator)
+
+ LOGGER.debug("Creating flavor '%s'...", self.flavor_alt_name)
+ flavor_alt_creator = OpenStackFlavor(
+ self.os_creds, FlavorConfig(
+ name=self.flavor_alt_name, ram=self.FLAVOR_RAM_ALT, disk=1,
+ vcpus=1, metadata=self.FLAVOR_EXTRA_SPECS))
+ if flavor_alt_creator is None or flavor_alt_creator.create() is None:
+ raise Exception("Failed to create flavor")
+ self.creators.append(flavor_alt_creator)