1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| #nova/compute/api.py def _create_instance(self, context, instance_type, image_href, kernel_id, ramdisk_id, min_count, max_count, display_name, display_description, key_name, key_data, security_groups, availability_zone, user_data, metadata, injected_files, admin_password, access_ip_v4, access_ip_v6, requested_networks, config_drive, block_device_mapping, auto_disk_config, filter_properties, reservation_id=None, legacy_bdm=True, shutdown_terminate=False, check_server_group_quota=False, tags=None, supports_multiattach=False, trusted_certs=None, supports_port_resource_request=False): .............. self._checks_for_create_and_rebuild(context, image_id, boot_meta, instance_type, metadata, injected_files, block_device_mapping.root_bdm(), validate_numa=False)
instance_group = self._get_requested_instance_group(context, filter_properties)
tags = self._create_tag_list_obj(context, tags)
instances_to_build = self._provision_instances( context, instance_type, min_count, max_count, base_options, boot_meta, security_groups, block_device_mapping, shutdown_terminate, instance_group, check_server_group_quota, filter_properties, key_pair, tags, trusted_certs, supports_multiattach, network_metadata) if CONF.cells.enable: # NOTE(danms): CellsV1 can't do the new thing, so we # do the old thing here. We can remove this path once # we stop supporting v1. for instance in instances: instance.create() # NOTE(melwitt): We recheck the quota after creating the objects # to prevent users from allocating more resources than their # allowed quota in the event of a race. This is configurable # because it can be expensive if strict quota limits are not # required in a deployment. if CONF.quota.recheck_quota: try: compute_utils.check_num_instances_quota( context, instance_type, 0, 0, orig_num_req=len(instances)) except exception.TooManyInstances: with excutils.save_and_reraise_exception(): # Need to clean up all the instances we created # along with the build requests, request specs, # and instance mappings. self._cleanup_build_artifacts(instances, instances_to_build)
self.compute_task_api.build_instances(context, instances=instances, image=boot_meta, filter_properties=filter_properties, admin_password=admin_password, injected_files=injected_files, requested_networks=requested_networks, security_groups=security_groups, block_device_mapping=block_device_mapping, legacy_bdm=False)
|