Пример #1
0
class StorageDriverClient(object):
    """
    Client to access storagedriverclient
    """

    foc_status = {
        '': 0,
        'ok_standalone': 10,
        'ok_sync': 10,
        'catch_up': 20,
        'degraded': 30
    }
    empty_statistics = staticmethod(lambda: Statistics())
    empty_info = staticmethod(lambda: VolumeInfo())
    stat_counters = [
        'backend_data_read', 'backend_data_written', 'backend_read_operations',
        'backend_write_operations', 'cluster_cache_hits',
        'cluster_cache_misses', 'data_read', 'data_written',
        'metadata_store_hits', 'metadata_store_misses', 'read_operations',
        'sco_cache_hits', 'sco_cache_misses', 'write_operations'
    ]
    extra_keys = ['4k_read_operations', '4k_write_operations']
    stat_sums = {
        'operations': ['write_operations', 'read_operations'],
        '4k_operations': ['4k_read_operations', '4k_write_operations'],
        'cache_hits': ['sco_cache_hits', 'cluster_cache_hits'],
        'cache_misses': ['sco_cache_misses'],
        'data_transferred': ['data_written', 'data_read']
    }
    stat_keys = stat_counters + extra_keys + stat_sums.keys()

    def __init__(self):
        """
        Dummy init method
        """
        pass

    @staticmethod
    def load(vpool):
        """
        Initializes the wrapper given a vpool name for which it finds the corresponding Storage Driver
        Loads and returns the client
        """

        key = '{0}_{1}'.format(
            vpool.guid, '_'.join(guid for guid in vpool.storagedrivers_guids))
        if key not in client_vpool_cache:
            cluster_contacts = []
            for storagedriver in vpool.storagedrivers[:3]:
                cluster_contacts.append(
                    ClusterContact(str(storagedriver.cluster_ip),
                                   storagedriver.ports[1]))
            client = SRClient(str(vpool.guid), cluster_contacts)
            client_vpool_cache[key] = client
        return client_vpool_cache[key]
Пример #2
0
 def __init__(self):
     """
     Init method
     """
     self.empty_statistics = lambda: Statistics()
     self.empty_info = lambda: VolumeInfo()
     self.stat_counters = [
         'backend_data_read', 'backend_data_written',
         'backend_read_operations', 'backend_write_operations',
         'cluster_cache_hits', 'cluster_cache_misses', 'data_read',
         'data_written', 'metadata_store_hits', 'metadata_store_misses',
         'read_operations', 'sco_cache_hits', 'sco_cache_misses',
         'write_operations'
     ]
     self.stat_sums = {
         'operations': ['write_operations', 'read_operations'],
         'cache_hits': ['sco_cache_hits', 'cluster_cache_hits'],
         'data_transferred': ['data_written', 'data_read']
     }
     self.stat_keys = self.stat_counters + self.stat_sums.keys()
Пример #3
0
class StorageDriverClient(object):
    """
    Client to access storagedriver client
    """
    storagerouterclient.Logger.setupLogging(
        LogHandler.load_path('storagerouterclient'))
    # noinspection PyArgumentList
    storagerouterclient.Logger.enableLogging()

    VOLDRV_DTL_SYNC = 'Synchronous'
    VOLDRV_DTL_ASYNC = 'Asynchronous'
    VOLDRV_DTL_MANUAL_MODE = 'Manual'
    VOLDRV_DTL_AUTOMATIC_MODE = 'Automatic'
    VOLDRV_DTL_TRANSPORT_TCP = 'TCP'
    VOLDRV_DTL_TRANSPORT_RSOCKET = 'RSocket'

    FRAMEWORK_DTL_SYNC = 'sync'
    FRAMEWORK_DTL_ASYNC = 'a_sync'
    FRAMEWORK_DTL_NO_SYNC = 'no_sync'
    FRAMEWORK_DTL_TRANSPORT_TCP = 'tcp'
    FRAMEWORK_DTL_TRANSPORT_RSOCKET = 'rdma'

    VDISK_DTL_MODE_MAP = {
        FRAMEWORK_DTL_SYNC: DTLMode.SYNCHRONOUS,
        FRAMEWORK_DTL_ASYNC: DTLMode.ASYNCHRONOUS,
        FRAMEWORK_DTL_NO_SYNC: None
    }
    VPOOL_DTL_MODE_MAP = {
        FRAMEWORK_DTL_SYNC: VOLDRV_DTL_SYNC,
        FRAMEWORK_DTL_ASYNC: VOLDRV_DTL_ASYNC,
        FRAMEWORK_DTL_NO_SYNC: None
    }
    VPOOL_DTL_TRANSPORT_MAP = {
        FRAMEWORK_DTL_TRANSPORT_TCP: VOLDRV_DTL_TRANSPORT_TCP,
        FRAMEWORK_DTL_TRANSPORT_RSOCKET: VOLDRV_DTL_TRANSPORT_RSOCKET
    }
    REVERSE_DTL_MODE_MAP = {
        VOLDRV_DTL_SYNC: FRAMEWORK_DTL_SYNC,
        VOLDRV_DTL_ASYNC: FRAMEWORK_DTL_ASYNC,
        DTLMode.SYNCHRONOUS: FRAMEWORK_DTL_SYNC,
        DTLMode.ASYNCHRONOUS: FRAMEWORK_DTL_ASYNC
    }
    REVERSE_DTL_TRANSPORT_MAP = {
        VOLDRV_DTL_TRANSPORT_TCP: FRAMEWORK_DTL_TRANSPORT_TCP,
        VOLDRV_DTL_TRANSPORT_RSOCKET: FRAMEWORK_DTL_TRANSPORT_RSOCKET
    }
    CLUSTER_SIZES = [4, 8, 16, 32, 64]
    TLOG_MULTIPLIER_MAP = {4: 16, 8: 8, 16: 4, 32: 2, 64: 1, 128: 1}

    DTL_STATUS = {
        '': 0,
        'ok_sync': 10,
        'ok_standalone': 20,
        'catch_up': 30,
        'checkup_required': 30,
        'degraded': 40
    }
    EMPTY_STATISTICS = staticmethod(lambda: Statistics())
    EMPTY_INFO = staticmethod(lambda: VolumeInfo())
    STAT_SUMS = {
        'operations': ['write_operations', 'read_operations'],
        'cache_hits': ['sco_cache_hits', 'cluster_cache_hits'],
        'cache_misses': ['sco_cache_misses'],
        '4k_operations': ['4k_read_operations', '4k_write_operations'],
        '4k_unaligned_operations':
        ['4k_unaligned_read_operations', '4k_unaligned_write_operations'],
        'data_transferred': ['data_written', 'data_read']
    }

    def __init__(self):
        """
        Dummy init method
        """
        pass

    @staticmethod
    def load(vpool, excluded_storagedrivers=None):
        """
        Initializes the wrapper for a given vpool
        :param vpool: vPool for which the StorageRouterClient needs to be loaded
        :type vpool: vPool
        :param excluded_storagedrivers: A list of storagedrivers that cannot be used as a client
        :type excluded_storagedrivers: list or None
        """
        if excluded_storagedrivers is None:
            excluded_storagedrivers = []
        key = vpool.identifier
        if key not in client_vpool_cache:
            cluster_contacts = []
            for storagedriver in vpool.storagedrivers[:3]:
                if storagedriver not in excluded_storagedrivers:
                    cluster_contacts.append(
                        ClusterContact(str(storagedriver.cluster_ip),
                                       storagedriver.ports['xmlrpc']))
            client = StorageRouterClient(str(vpool.guid), cluster_contacts)
            client_vpool_cache[key] = client
        return client_vpool_cache[key]
Пример #4
0
class StorageDriverClient(object):
    """
    Client to access storagedriver client
    """
    storagerouterclient.Logger.setupLogging(
        LogHandler.load_path('storagerouterclient'))
    # noinspection PyArgumentList
    storagerouterclient.Logger.enableLogging()

    VOLDRV_DTL_SYNC = 'Synchronous'
    VOLDRV_DTL_ASYNC = 'Asynchronous'
    VOLDRV_NO_CACHE = 'NoCache'
    VOLDRV_CACHE_ON_READ = 'CacheOnRead'
    VOLDRV_CONTENT_BASED = 'ContentBased'
    VOLDRV_CACHE_ON_WRITE = 'CacheOnWrite'
    VOLDRV_LOCATION_BASED = 'LocationBased'
    VOLDRV_DTL_MANUAL_MODE = 'Manual'
    VOLDRV_DTL_AUTOMATIC_MODE = 'Automatic'
    VOLDRV_DTL_TRANSPORT_TCP = 'TCP'
    VOLDRV_DTL_TRANSPORT_RSOCKET = 'RSocket'

    FRAMEWORK_DTL_SYNC = 'sync'
    FRAMEWORK_DTL_ASYNC = 'a_sync'
    FRAMEWORK_DTL_NO_SYNC = 'no_sync'
    FRAMEWORK_NO_CACHE = 'none'
    FRAMEWORK_CACHE_ON_READ = 'on_read'
    FRAMEWORK_CONTENT_BASED = 'dedupe'
    FRAMEWORK_CACHE_ON_WRITE = 'on_write'
    FRAMEWORK_LOCATION_BASED = 'non_dedupe'
    FRAMEWORK_DTL_TRANSPORT_TCP = 'tcp'
    FRAMEWORK_DTL_TRANSPORT_RSOCKET = 'rdma'

    METADATA_CACHE_PAGE_SIZE = 256 * 24
    DEFAULT_METADATA_CACHE_SIZE = 8192 * METADATA_CACHE_PAGE_SIZE

    VDISK_CACHE_MAP = {
        FRAMEWORK_NO_CACHE: ReadCacheBehaviour.NO_CACHE,
        FRAMEWORK_CACHE_ON_READ: ReadCacheBehaviour.CACHE_ON_READ,
        FRAMEWORK_CACHE_ON_WRITE: ReadCacheBehaviour.CACHE_ON_WRITE
    }
    VPOOL_CACHE_MAP = {
        FRAMEWORK_NO_CACHE: VOLDRV_NO_CACHE,
        FRAMEWORK_CACHE_ON_READ: VOLDRV_CACHE_ON_READ,
        FRAMEWORK_CACHE_ON_WRITE: VOLDRV_CACHE_ON_WRITE
    }
    VDISK_DEDUPE_MAP = {
        FRAMEWORK_CONTENT_BASED: ReadCacheMode.CONTENT_BASED,
        FRAMEWORK_LOCATION_BASED: ReadCacheMode.LOCATION_BASED
    }
    VPOOL_DEDUPE_MAP = {
        FRAMEWORK_CONTENT_BASED: VOLDRV_CONTENT_BASED,
        FRAMEWORK_LOCATION_BASED: VOLDRV_LOCATION_BASED
    }
    VDISK_DTL_MODE_MAP = {
        FRAMEWORK_DTL_SYNC: DTLMode.SYNCHRONOUS,
        FRAMEWORK_DTL_ASYNC: DTLMode.ASYNCHRONOUS,
        FRAMEWORK_DTL_NO_SYNC: None
    }
    VPOOL_DTL_MODE_MAP = {
        FRAMEWORK_DTL_SYNC: VOLDRV_DTL_SYNC,
        FRAMEWORK_DTL_ASYNC: VOLDRV_DTL_ASYNC,
        FRAMEWORK_DTL_NO_SYNC: None
    }
    VPOOL_DTL_TRANSPORT_MAP = {
        FRAMEWORK_DTL_TRANSPORT_TCP: VOLDRV_DTL_TRANSPORT_TCP,
        FRAMEWORK_DTL_TRANSPORT_RSOCKET: VOLDRV_DTL_TRANSPORT_RSOCKET
    }
    REVERSE_CACHE_MAP = {
        VOLDRV_NO_CACHE: FRAMEWORK_NO_CACHE,
        VOLDRV_CACHE_ON_READ: FRAMEWORK_CACHE_ON_READ,
        VOLDRV_CACHE_ON_WRITE: FRAMEWORK_CACHE_ON_WRITE,
        ReadCacheBehaviour.NO_CACHE: FRAMEWORK_NO_CACHE,
        ReadCacheBehaviour.CACHE_ON_READ: FRAMEWORK_CACHE_ON_READ,
        ReadCacheBehaviour.CACHE_ON_WRITE: FRAMEWORK_CACHE_ON_WRITE
    }
    REVERSE_DEDUPE_MAP = {
        VOLDRV_CONTENT_BASED: FRAMEWORK_CONTENT_BASED,
        VOLDRV_LOCATION_BASED: FRAMEWORK_LOCATION_BASED,
        ReadCacheMode.CONTENT_BASED: FRAMEWORK_CONTENT_BASED,
        ReadCacheMode.LOCATION_BASED: FRAMEWORK_LOCATION_BASED
    }
    REVERSE_DTL_MODE_MAP = {
        VOLDRV_DTL_SYNC: FRAMEWORK_DTL_SYNC,
        VOLDRV_DTL_ASYNC: FRAMEWORK_DTL_ASYNC,
        DTLMode.SYNCHRONOUS: FRAMEWORK_DTL_SYNC,
        DTLMode.ASYNCHRONOUS: FRAMEWORK_DTL_ASYNC
    }
    REVERSE_DTL_TRANSPORT_MAP = {
        VOLDRV_DTL_TRANSPORT_TCP: FRAMEWORK_DTL_TRANSPORT_TCP,
        VOLDRV_DTL_TRANSPORT_RSOCKET: FRAMEWORK_DTL_TRANSPORT_RSOCKET
    }
    CLUSTER_SIZES = [4, 8, 16, 32, 64]
    TLOG_MULTIPLIER_MAP = {4: 16, 8: 8, 16: 4, 32: 2, 64: 1, 128: 1}

    DTL_STATUS = {
        '': 0,
        'ok_standalone': 10,
        'ok_sync': 10,
        'catch_up': 20,
        'degraded': 30
    }
    EMPTY_STATISTICS = staticmethod(lambda: Statistics())
    EMPTY_INFO = staticmethod(lambda: VolumeInfo())
    STAT_SUMS = {
        'operations': ['write_operations', 'read_operations'],
        'cache_hits': ['sco_cache_hits', 'cluster_cache_hits'],
        'cache_misses': ['sco_cache_misses'],
        '4k_operations': ['4k_read_operations', '4k_write_operations'],
        'data_transferred': ['data_written', 'data_read']
    }
    STAT_KEYS = [
        'backend_data_read', 'backend_data_written', 'backend_read_operations',
        'backend_write_operations', 'cluster_cache_hits',
        'cluster_cache_misses', 'data_read', 'data_written',
        'metadata_store_hits', 'metadata_store_misses', 'read_operations',
        'sco_cache_hits', 'sco_cache_misses', 'write_operations',
        '4k_read_operations', '4k_write_operations', 'stored'
    ]
    STAT_KEYS.extend(STAT_SUMS.keys())

    def __init__(self):
        """
        Dummy init method
        """
        pass

    @staticmethod
    def load(vpool):
        """
        Initializes the wrapper given a vpool name for which it finds the corresponding Storage Driver
        Loads and returns the client
        :param vpool: vPool for which the StorageRouterClient needs to be loaded
        """
        key = vpool.identifier
        if key not in client_vpool_cache:
            cluster_contacts = []
            for storagedriver in vpool.storagedrivers[:3]:
                cluster_contacts.append(
                    ClusterContact(str(storagedriver.cluster_ip),
                                   storagedriver.ports[1]))
            client = SRClient(str(vpool.guid), cluster_contacts)
            client_vpool_cache[key] = client
        return client_vpool_cache[key]