def _set_up_controller(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-evacuate-find-host': 'fake'} self.controller = evacuate_v2.Controller(ext_mgr) ext_mgr_no_ext = extensions.ExtensionManager() ext_mgr_no_ext.extensions = {} self.controller_no_ext = evacuate_v2.Controller(ext_mgr_no_ext)
def _set_up_controller(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-availability-zone': 'fake'} self.controller = servers_v2.Controller(ext_mgr) ext_mgr_no_az = extensions.ExtensionManager() ext_mgr_no_az.extensions = {} self.no_availability_zone_controller = servers_v2.Controller( ext_mgr_no_az)
def _set_up_controller(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-volume-attachment-update'} self.attachments = volumes.VolumeAttachmentController(ext_mgr) ext_mgr_no_update = extensions.ExtensionManager() ext_mgr_no_update.extensions = {} self.attachments_no_update = volumes.VolumeAttachmentController( ext_mgr_no_update)
def setUp(self): super(ExtendedFloatingIpTestV21, self).setUp() self.stubs.Set(compute.api.API, "get", compute_api_get) self.stubs.Set(network.api.API, "get_floating_ip", network_api_get_floating_ip) self.stubs.Set(network.api.API, "get_floating_ip_by_address", network_api_get_floating_ip_by_address) self.stubs.Set(network.api.API, "get_floating_ips_by_project", network_api_get_floating_ips_by_project) self.stubs.Set(network.api.API, "release_floating_ip", network_api_release) self.stubs.Set(network.api.API, "disassociate_floating_ip", network_api_disassociate) self.stubs.Set(network.api.API, "get_instance_id_by_floating_address", get_instance_by_floating_ip_addr) self.stubs.Set(compute_utils, "get_nw_info_for_instance", stub_nw_info(self.stubs)) fake_network.stub_out_nw_api_get_instance_nw_info(self.stubs) self.stubs.Set(db, 'instance_get', fake_instance_get) self.context = context.get_admin_context() self._create_floating_ips() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.ext_mgr.extensions['os-floating-ips'] = True self.ext_mgr.extensions['os-extended-floating-ips'] = True self.controller = self.floating_ips.FloatingIPController() self.manager = self.floating_ips.\ FloatingIPActionController(self.ext_mgr) self.fake_req = fakes.HTTPRequest.blank('')
def _setup(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-networks': 'fake'} self.controller = networks.NetworkController(self.fake_network_api, ext_mgr) self.neutron_ctrl = networks.NetworkController( neutron.API(skip_policy_check=False))
def _prepare_extension(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {} ext_mgr.extensions['os-hypervisor-status'] = True self.controller = hypervisors_v2.HypervisorsController(ext_mgr) self.controller.servicegroup_api.service_is_up = mock.MagicMock( return_value=True)
def setUp(self): super(ServicesTestV21, self).setUp() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self._set_up_controller() self.stubs.Set(self.controller.host_api, "service_get_all", fake_service_get_all(fake_services_list)) self.stubs.Set(timeutils, "utcnow", fake_utcnow) self.stubs.Set(timeutils, "utcnow_ts", fake_utcnow_ts) self.stubs.Set(db, "service_get_by_host_and_binary", fake_db_service_get_by_host_binary(fake_services_list)) self.stubs.Set(db, "service_update", fake_db_service_update(fake_services_list)) self.req = fakes.HTTPRequest.blank('')
def setUp(self): super(ServicesCellsTestV21, self).setUp() host_api = cells_api.HostAPI() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self._set_up_controller() self.controller.host_api = host_api self.stubs.Set(timeutils, "utcnow", fake_utcnow) self.stubs.Set(timeutils, "utcnow_ts", fake_utcnow_ts) services_list = [] for service in fake_services_list: service = service.copy() service_obj = objects.Service(**service) service_proxy = cells_utils.ServiceProxy(service_obj, 'cell1') services_list.append(service_proxy) self.stubs.Set(host_api.cells_rpcapi, "service_get_all", fake_service_get_all(services_list))
def _set_up_controller(self): self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.controller = servers_v2.Controller(self.ext_mgr) self.no_config_drive_controller = None
def _setup(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-networks': 'fake'} self.controller = networks.NetworkController(self.PassthroughAPI(), ext_mgr)
def _set_up_controller(self): self.context = context.get_admin_context() self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.controller = hypervisors_v2.HypervisorsController(self.ext_mgr)
def _setup(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {} self.controller = quota_classes.QuotaClassSetsController(ext_mgr)
def _set_up_controller(self): self.ext_mgr = extensions_v20.ExtensionManager() self.ext_mgr.extensions = {} self.controller = servers_v20.Controller(self.ext_mgr)
def _set_up_controller(self): self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.no_scheduler_hints_controller = servers_v2.Controller( self.ext_mgr)
def setUp(self): super(ExtendedRescueWithImageTest, self).setUp() ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-rescue-with-image': 'fake'} self.controller = rescue.RescueController(ext_mgr)
def _setup_controller(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {} self.controller = server_groups.ServerGroupController(ext_mgr)
def setUp(self): """Shared implementation for tests below that create instance.""" super(MultiCreateExtensionTestV2, self).setUp() self.flags(verbose=True, enable_instance_password=True) self.instance_cache_num = 0 self.instance_cache_by_id = {} self.instance_cache_by_uuid = {} fakes.stub_out_nw_api(self.stubs) self.ext_mgr = extensions_v20.ExtensionManager() self.ext_mgr.extensions = { 'os-volumes': 'fake', 'os-multiple-create': 'fake', 'os-block-device-mapping-v2-boot': 'fake' } self.controller = servers_v20.Controller(self.ext_mgr) no_mult_ext_mgr = extensions_v20.ExtensionManager() no_mult_ext_mgr.extensions = { 'os-volumes': 'fake', 'os-block-device-mapping-v2-boot': 'fake' } self.no_mult_create_controller = servers_v20.Controller( no_mult_ext_mgr) def instance_create(context, inst): inst_type = flavors.get_flavor_by_flavor_id(3) image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' def_image_ref = 'http://localhost/images/%s' % image_uuid self.instance_cache_num += 1 instance = fake_instance.fake_db_instance( **{ 'id': self.instance_cache_num, 'display_name': inst['display_name'] or 'test', 'uuid': FAKE_UUID, 'instance_type': inst_type, 'access_ip_v4': '1.2.3.4', 'access_ip_v6': 'fead::1234', 'image_ref': inst.get('image_ref', def_image_ref), 'user_id': 'fake', 'project_id': 'fake', 'reservation_id': inst['reservation_id'], "created_at": datetime.datetime(2010, 10, 10, 12, 0, 0), "updated_at": datetime.datetime(2010, 11, 11, 11, 0, 0), "config_drive": None, "progress": 0, "fixed_ips": [], "task_state": "", "vm_state": "", "root_device_name": inst.get('root_device_name', 'vda'), "security_groups": inst['security_groups'], }) self.instance_cache_by_id[instance['id']] = instance self.instance_cache_by_uuid[instance['uuid']] = instance return instance def instance_get(context, instance_id): """Stub for compute/api create() pulling in instance after scheduling """ return self.instance_cache_by_id[instance_id] fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fake.stub_out_image_service(self.stubs) self.stubs.Set(uuid, 'uuid4', fake_gen_uuid) self.stubs.Set(db, 'instance_create', instance_create) self.stubs.Set(db, 'instance_get', instance_get)
def _set_up_controller(self): self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.ext_mgr.extensions['os-extended-hypervisors'] = True self.controller = hypervisors_v2.HypervisorsController(self.ext_mgr)
def _set_up_controller(self): ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-rescue-with-image': 'fake'} return rescue_v2.RescueController(ext_mgr)