예제 #1
0
    def test_updates_object_state(self):
        src_obj = {'id': 'src_uuid'}
        dst_uuid = 'dst_uuid'

        o = observers.MemoizingMigrationObserver()
        n = notifiers.MigrationStateNotifier()
        n.add_observer(o)

        type_vm = objects.MigrationObjectType.VM
        n.success(type_vm, src_obj, dst_uuid,
                  message=objects.MigrationState.SUCCESS)

        obj = o.get_object(type_vm, src_obj)
        if obj is None:
            self.fail("Observer must have object stored")

        self.assertEqual(src_obj['id'], obj.uuid)
        self.assertEqual(dst_uuid, obj.dst_uuid)
        self.assertEqual(objects.MigrationState.SUCCESS, obj.state)
        self.assertEqual(objects.MigrationState.SUCCESS, obj.message)

        n.fail(type_vm, src_obj, message=objects.MigrationState.FAILURE)
        self.assertEqual(src_obj['id'], obj.uuid)
        self.assertEqual(dst_uuid, obj.dst_uuid)
        self.assertEqual(objects.MigrationState.FAILURE, obj.state)
        self.assertEqual(objects.MigrationState.FAILURE, obj.message)

        n.skip(type_vm, src_obj, message=objects.MigrationState.SKIPPED)
        self.assertEqual(src_obj['id'], obj.uuid)
        self.assertEqual(dst_uuid, obj.dst_uuid)
        self.assertEqual(objects.MigrationState.SKIPPED, obj.state)
        self.assertEqual(objects.MigrationState.SKIPPED, obj.message)
예제 #2
0
 def __init__(self, config, cloud):
     super(KeystoneIdentity, self).__init__()
     self.config = config
     self.cloud = cloud
     self.filter_tenant_id = None
     self.mysql_connector = cloud.mysql_connector('keystone')
     self.templater = Templater()
     self.generator = GeneratorPassword()
     self.defaults = {}
     self.tenant_name_map = mapper.Mapper('tenant_map')
     self.state_notifier = notifiers.MigrationStateNotifier()
     for observer in cloud.migration_observers:
         self.state_notifier.add_observer(observer)
예제 #3
0
    def __init__(self, init):
        super(MigrateVolumes, self).__init__(init)
        self.src_cinder_backend = plugins.get_cinder_backend(self.src_cloud)
        self.dst_cinder_backend = plugins.get_cinder_backend(self.dst_cloud)
        self.migration_status = notifiers.MigrationStateNotifier()

        for observer in self.init['migration_observers']:
            self.migration_status.add_observer(observer)

        if self._is_nfs_shared():
            self.migrate_func = self.reuse_source_volume
        else:
            self.migrate_func = self.migrate_volume
예제 #4
0
 def __init__(self, config, cloud):
     super(NovaCompute, self).__init__()
     self.config = config
     self.cloud = cloud
     self.filter_tenant_id = None
     self.identity = cloud.resources['identity']
     self.mysql_connector = cloud.mysql_connector('nova')
     # List of instance IDs which failed to create
     self.processing_instances = []
     self.failed_instances = []
     self.tenant_name_map = mapper.Mapper('tenant_map')
     self.instance_info_caches = instance_info_caches.InstanceInfoCaches(
         self.get_db_connection())
     self.attr_override = override.AttributeOverrides.from_filename(
         config.migrate.override_rules, 'servers')
     self.state_notifier = notifiers.MigrationStateNotifier()
     for observer in cloud.migration_observers:
         self.state_notifier.add_observer(observer)
예제 #5
0
    def __init__(self, config, cloud):
        self.config = config
        self.ssh_host = config.cloud.ssh_host
        self.cloud = cloud
        self.identity_client = cloud.resources['identity']
        self.filter_tenant_id = None
        self.filter_image = []
        # get mysql settings
        self.mysql_connector = cloud.mysql_connector('glance')
        self.runner = remote_runner.RemoteRunner(self.ssh_host,
                                                 self.config.cloud.ssh_user)
        self._image_filter = None
        self.tenant_name_map = mapper.Mapper('tenant_map')
        self.state_notifier = notifiers.MigrationStateNotifier()
        for o in cloud.migration_observers:
            self.state_notifier.add_observer(o)

        super(GlanceImage, self).__init__(config)
예제 #6
0
    def test_keeps_all_appended_messages(self):
        obj = {'id': 'some_uuid', 'name': 'name'}
        num_messages = 10

        o = observers.MemoizingMigrationObserver()
        n = notifiers.MigrationStateNotifier()
        n.add_observer(o)

        type_vm = objects.MigrationObjectType.VM
        for i in xrange(num_messages):
            n.append_message(type_vm, obj, '{:d}'.format(i))

        obj = o.get_object(type_vm, obj)
        if obj is None:
            self.fail("Observer must have object stored")

        for i in xrange(num_messages):
            self.assertIn(str(i), obj.message)
 def __init__(self, init, cloud=None):
     super(AttachVolumesCompute, self).__init__(init, cloud)
     self.state_notifier = notifiers.MigrationStateNotifier()
     for observer in self.init['migration_observers']:
         self.state_notifier.add_observer(observer)
예제 #8
0
    def __init__(self, init, cloud=None):
        super(TransportEphemeral, self).__init__(init, cloud)
        self.migration_status = notifiers.MigrationStateNotifier()

        for observer in self.init['migration_observers']:
            self.migration_status.add_observer(observer)
예제 #9
0
 def __init__(self, init, cloud=None):
     super(TransportInstance, self).__init__(init, cloud)
     self.state_notifier = notifiers.MigrationStateNotifier()
     for observer in self.init['migration_observers']:
         self.state_notifier.add_observer(observer)