Beispiel #1
0
 def __init__(self, *args, **kwargs):
     self.service = importutils.import_module(self.driver_name)
     self.az = CONF.storage_availability_zone
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_rpcapi = volume_rpcapi.VolumeAPI()
     super(BackupManager, self).__init__(*args, **kwargs)
     self.is_initialized = False
 def __init__(self, service_name=None, *args, **kwargs):
     self.service = importutils.import_module(self.driver_name)
     self.az = CONF.storage_availability_zone
     self.volume_managers = {}
     self._setup_volume_drivers()
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     super(BackupManager, self).__init__(service_name='backup',
                                         *args, **kwargs)
Beispiel #3
0
 def __init__(self, manager, db, driver, image_volume_cache=None):
     super(CreateVolumeFromSpecTask, self).__init__(addons=[ACTION])
     self.manager = manager
     self.db = db
     self.driver = driver
     self.image_volume_cache = image_volume_cache
     self.message = message_api.API()
     self.backup_api = backup_api.API()
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
Beispiel #4
0
 def __init__(self, ext_mgr=None):
     self.ext_mgr = ext_mgr
     super(ServiceController, self).__init__()
     self.volume_api = volume.API()
     self.rpc_apis = {
         constants.SCHEDULER_BINARY: scheduler_rpcapi.SchedulerAPI(),
         constants.VOLUME_BINARY: volume_rpcapi.VolumeAPI(),
         constants.BACKUP_BINARY: backup_rpcapi.BackupAPI(),
     }
Beispiel #5
0
 def __init__(self, service_name=None, *args, **kwargs):
     self.service = importutils.import_module(self.driver_name)
     self.az = CONF.storage_availability_zone
     self.volume_managers = {}
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_rpcapi = volume_rpcapi.VolumeAPI()
     super(BackupManager, self).__init__(service_name='backup',
                                         *args, **kwargs)
     self.additional_endpoints.append(_BackupV1Proxy(self))
Beispiel #6
0
    def _test_backup_api(self,
                         method,
                         rpc_method,
                         server=None,
                         fanout=False,
                         **kwargs):
        rpcapi = backup_rpcapi.BackupAPI()
        expected_retval = 'foo' if rpc_method == 'call' else None

        target = {
            "server": server,
            "fanout": fanout,
            "version": kwargs.pop('version', rpcapi.RPC_API_VERSION)
        }

        expected_msg = copy.deepcopy(kwargs)

        self.fake_args = None
        self.fake_kwargs = None

        def _fake_prepare_method(*args, **kwds):
            for kwd in kwds:
                self.assertEqual(target[kwd], kwds[kwd])
            return rpcapi.client

        def _fake_rpc_method(*args, **kwargs):
            self.fake_args = args
            self.fake_kwargs = kwargs
            if expected_retval:
                return expected_retval

        with mock.patch.object(rpcapi.client, "prepare") as mock_prepared:
            mock_prepared.side_effect = _fake_prepare_method

            with mock.patch.object(rpcapi.client, rpc_method) as mock_method:
                mock_method.side_effect = _fake_rpc_method
                retval = getattr(rpcapi, method)(self.context, **kwargs)
                self.assertEqual(expected_retval, retval)
                expected_args = [self.context, method, expected_msg]
                for arg, expected_arg in zip(self.fake_args, expected_args):
                    self.assertEqual(expected_arg, arg)

                for kwarg, value in self.fake_kwargs.items():
                    if isinstance(value, objects.Backup):
                        expected_back = expected_msg[kwarg].obj_to_primitive()
                        backup = value.obj_to_primitive()
                        self.assertEqual(expected_back, backup)
                    else:
                        self.assertEqual(expected_msg[kwarg], value)
Beispiel #7
0
 def __init__(self, *args, **kwargs):
     self.service = importutils.import_module(self.driver_name)
     self.az = CONF.storage_availability_zone
     self.volume_managers = {}
     # TODO(xyang): If backup_use_same_host is True, we'll find
     # the volume backend on the backup node. This allows us
     # to use a temp snapshot to backup an in-use volume if the
     # driver supports it. This code should go away when we add
     # support for backing up in-use volume using a temp snapshot
     # on a remote node.
     if CONF.backup_use_same_host:
         self._setup_volume_drivers()
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_rpcapi = volume_rpcapi.VolumeAPI()
     super(BackupManager, self).__init__(*args, **kwargs)
Beispiel #8
0
 def __init__(self, *args, **kwargs):
     self.az = CONF.storage_availability_zone
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_rpcapi = volume_rpcapi.VolumeAPI()
     super(BackupManager, self).__init__(*args, **kwargs)
     self.is_initialized = False
     self._set_tpool_size(CONF.backup_native_threads_pool_size)
     self._process_number = kwargs.get('process_number', 1)
     self.driver_name = CONF.backup_driver
     if self.driver_name in MAPPING:
         new_name = MAPPING[self.driver_name]
         LOG.warning(
             'Backup driver path %s is deprecated, update your '
             'configuration to the new path %s', self.driver_name, new_name)
         self.driver_name = new_name
     self.service = importutils.import_class(self.driver_name)
Beispiel #9
0
 def __init__(self,
              scheduler_driver=None,
              service_name=None,
              *args,
              **kwargs):
     if not scheduler_driver:
         scheduler_driver = CONF.scheduler_driver
     self.driver = importutils.import_object(scheduler_driver)
     super(SchedulerManager, self).__init__(*args, **kwargs)
     self._startup_delay = True
     self.backup_api = backup_rpcapi.BackupAPI()
     self.volume_api = volume_rpcapi.VolumeAPI()
     self.sch_api = scheduler_rpcapi.SchedulerAPI()
     self.message_api = mess_api.API()
     self.rpc_api_version = versionutils.convert_version_to_int(
         self.RPC_API_VERSION)
Beispiel #10
0
 def __init__(self, db=None):
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_api = cinder.volume.API()
     super(API, self).__init__(db)
Beispiel #11
0
 def reset(self):
     super(BackupManager, self).reset()
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_rpcapi = volume_rpcapi.VolumeAPI()
Beispiel #12
0
 def __init__(self, *args, **kwargs):
     self.az = CONF.storage_availability_zone
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.volume_rpcapi = volume_rpcapi.VolumeAPI()
     super(BackupManager, self).__init__(*args, **kwargs)
     self.is_initialized = False
Beispiel #13
0
 def __init__(self):
     self.backup_rpcapi = backup_rpcapi.BackupAPI()
     self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI()
     self.volume_api = cinder.volume.API()
     super().__init__()