当前位置: 首页>>代码示例>>Python>>正文


Python vpoollist.VPoolList类代码示例

本文整理汇总了Python中ovs.dal.lists.vpoollist.VPoolList的典型用法代码示例。如果您正苦于以下问题:Python VPoolList类的具体用法?Python VPoolList怎么用?Python VPoolList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VPoolList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_vpool_by_name

 def get_vpool_by_name(vpool_name):
     """
     Retrieve the vPool object by its name
     :param vpool_name: Name of the vPool
     :return: vPool DAL object
     """
     return VPoolList.get_vpool_by_name(vpool_name)
开发者ID:DarumasLegs,项目名称:integrationtests,代码行数:7,代码来源:general_vpool.py

示例2: check_filedrivers

 def check_filedrivers(result_handler):
     """
     Checks if the file drivers work on a local machine (compatible with multiple vPools)
     :param result_handler: logging object
     :type result_handler: ovs.extensions.healthcheck.result.HCResults
     """
     result_handler.info('Checking file drivers.', add_to_result=False)
     vpools = VPoolList.get_vpools()
     # perform tests
     if len(vpools) == 0:
         result_handler.skip('No vPools found!')
         return
     for vp in vpools:
         name = 'ovs-healthcheck-test-{0}'.format(VolumedriverHealthCheck.LOCAL_ID)
         if vp.guid not in VolumedriverHealthCheck.LOCAL_SR.vpools_guids:
             result_handler.skip('Skipping vPool {0} because it is not living here.'.format(vp.name))
             continue
         try:
             VolumedriverHealthCheck._check_filedriver(vp.name, name)
             if os.path.exists('/mnt/{0}/{1}.xml'.format(vp.name, name)):
                 # working
                 VolumedriverHealthCheck._check_filedriver_remove(vp.name)
                 result_handler.success('Filedriver for vPool {0} is working fine!'.format(vp.name))
             else:
                 # not working
                 result_handler.failure('Filedriver for vPool {0} seems to have problems!'.format(vp.name))
         except TimeoutError:
             # timeout occurred, action took too long
             result_handler.warning('Filedriver of vPool {0} seems to have `timeout` problems'.format(vp.name))
         except subprocess.CalledProcessError:
             # can be input/output error by filedriver
             result_handler.failure('Filedriver of vPool {0} seems to have `input/output` problems'.format(vp.name))
开发者ID:openvstorage,项目名称:openvstorage-health-check,代码行数:32,代码来源:volumedriver.py

示例3: update_vdisk_name

    def update_vdisk_name(volume_id, old_name, new_name):
        """
        Update a vDisk name using Management Center: set new name
        """
        vdisk = None
        for mgmt_center in MgmtCenterList.get_mgmtcenters():
            mgmt = Factory.get_mgmtcenter(mgmt_center = mgmt_center)
            try:
                disk_info = mgmt.get_vdisk_device_info(volume_id)
                device_path = disk_info['device_path']
                vpool_name = disk_info['vpool_name']
                vp = VPoolList.get_vpool_by_name(vpool_name)
                file_name = os.path.basename(device_path)
                vdisk = VDiskList.get_by_devicename_and_vpool(file_name, vp)
                if vdisk:
                    break
            except Exception as ex:
                logger.info('Trying to get mgmt center failed for disk {0} with volume_id {1}. {2}'.format(old_name, volume_id, ex))
        if not vdisk:
            logger.error('No vdisk found for name {0}'.format(old_name))
            return

        vpool = vdisk.vpool
        mutex = VolatileMutex('{}_{}'.format(old_name, vpool.guid if vpool is not None else 'none'))
        try:
            mutex.acquire(wait=5)
            vdisk.name = new_name
            vdisk.save()
        finally:
            mutex.release()
开发者ID:tcpcloud,项目名称:openvstorage,代码行数:30,代码来源:vdisk.py

示例4: get_vpool_stats

    def get_vpool_stats():
        """
        Send Vpool statistics to InfluxDB
        """
        points = []
        vpools = VPoolList.get_vpools()
        if len(vpools) == 0:
            StatsmonkeyScheduledTaskController._logger.info("No vpools found")
            return

        for vpool in vpools:
            try:
                metrics = StatsmonkeyScheduledTaskController._pop_realtime_info(vpool.statistics)
                vpool_name = vpool.name

                entry = {
                    'measurement': 'vpool_stats',
                    'tags': {
                        'vpool_name': vpool_name
                    },
                    'fields': metrics
                }
                points.append(entry)
            except Exception as ex:
                StatsmonkeyScheduledTaskController._logger.error(ex.message)

        if len(points) == 0:
            StatsmonkeyScheduledTaskController._logger.info("No statistics found")
            return

        StatsmonkeyScheduledTaskController._send_stats(points)
        return points
开发者ID:paperandsoap,项目名称:openvstorage-monitoring,代码行数:32,代码来源:statsmonkeyscheduledtask.py

示例5: check_volumedrivers

    def check_volumedrivers(result_handler):
        """
        Checks if the VOLUMEDRIVERS work on a local machine (compatible with multiple vPools)
        :param result_handler: logging object
        :type result_handler: ovs.extensions.healthcheck.result.HCResults
        :return: None
        :rtype: NoneType
        """
        result_handler.info('Checking volumedrivers.', add_to_result=False)
        vpools = VPoolList.get_vpools()
        if len(vpools) == 0:
            result_handler.skip('No vPools found!')
            return
        for vp in vpools:
            name = 'ovs-healthcheck-test-{0}.raw'.format(VolumedriverHealthCheck.LOCAL_ID)
            if vp.guid not in VolumedriverHealthCheck.LOCAL_SR.vpools_guids:
                result_handler.skip('Skipping vPool {0} because it is not living here.'.format(vp.name))
                continue
            try:
                # delete if previous vdisk with this name exists
                storagedriver_guid = next((storagedriver.guid for storagedriver in vp.storagedrivers
                                           if storagedriver.storagedriver_id == vp.name +
                                           VolumedriverHealthCheck.LOCAL_ID))
                # create a new one
                volume = VolumedriverHealthCheck._check_volumedriver(name, storagedriver_guid, result_handler)

                if volume is True:
                    # delete the recently created
                    try:
                        VolumedriverHealthCheck._check_volumedriver_remove(vpool_name=vp.name, vdisk_name=name)
                    except Exception as ex:
                        raise RuntimeError('Could not delete the created volume. Got {0}'.format(str(ex)))
                    # Working at this point
                    result_handler.success('Volumedriver of vPool {0} is working fine!'.format(vp.name))
                else:
                    # not working
                    result_handler.failure('Something went wrong during vdisk creation on vpool {0}.'.format(vp.name))

            except TimeoutError:
                # timeout occurred, action took too long
                result_handler.warning('Volumedriver of vPool {0} seems to timeout.'.format(vp.name))
            except IOError as ex:
                # can be input/output error by volumedriver
                result_handler.failure('Volumedriver of vPool {0} seems to have IO problems. Got `{1}` while executing.'.format(vp.name, ex.message))
            except RuntimeError as ex:
                result_handler.failure('Volumedriver of vPool {0} seems to have problems. Got `{1}` while executing.'.format(vp.name, ex))
            except VDiskNotFoundError:
                result_handler.warning('Volume on vPool {0} was not found, please retry again'.format(vp.name))
            except Exception as ex:
                result_handler.failure('Uncaught exception for Volumedriver of vPool {0}.Got {1} while executing.'.format(vp.name, ex))
            finally:
                # Attempt to delete the created vdisk
                try:
                    VolumedriverHealthCheck._check_volumedriver_remove(vpool_name=vp.name, vdisk_name=name, present=False)
                except:
                    pass
开发者ID:openvstorage,项目名称:openvstorage-health-check,代码行数:56,代码来源:volumedriver.py

示例6: _create_vpool

    def _create_vpool(self):
        """
        Needed to actually run tests on
        This is not actually a test of "Add Vpool to OVS",
        so any failure here will be reported as a setUp error and no tests will run
        """
        pmachine = System.get_my_storagerouter().pmachine
        mgmt_center = MgmtCenter(data={'name':'Openstack',
                                       'description':'test',
                                       'username':CINDER_USER,
                                       'password':CINDER_PASS,
                                       'ip':CINDER_CONTROLLER,
                                       'port':80,
                                       'type':'OPENSTACK',
                                       'metadata':{'integratemgmt':True}})
        mgmt_center.save()
        pmachine.mgmtcenter = mgmt_center
        pmachine.save()
        self._debug('Creating vpool')
        backend_type = 'local'
        fields = ['storage_ip', 'vrouter_port']

        parameters = {'storagerouter_ip': IP,
                      'vpool_name': VPOOL_NAME,
                      'type': 'local',
                      'mountpoint_bfs': VPOOL_BFS,
                      'mountpoint_temp': VPOOL_TEMP,
                      'mountpoint_md': VPOOL_MD,
                      'mountpoint_readcaches': [VPOOL_READCACHE],
                      'mountpoint_writecaches': [VPOOL_WRITECACHE],
                      'mountpoint_foc': VPOOL_FOC,
                      'storage_ip': '127.0.0.1', #KVM
                      'vrouter_port': VPOOL_PORT,
                      'integrate_vpool': True,
                      'connection_host': IP,
                      'connection_port': VPOOL_PORT,
                      'connection_username': '',
                      'connection_password': '',
                      'connection_backend': {},
                      }
        StorageRouterController.add_vpool(parameters)
        attempt = 0
        while attempt < 10:
            vpool = VPoolList.get_vpool_by_name(VPOOL_NAME)
            if vpool is not None:
                self._debug('vpool %s created' % VPOOL_NAME)
                try:
                    os.listdir(VPOOL_MOUNTPOINT)
                    return vpool
                except Exception as ex:
                    #either it doesn't exist, or we don't have permission
                    self._debug('vpool not ready yet %s' % (str(ex)))
                    pass
            attempt += 1
            time.sleep(2)
        raise RuntimeError('Vpool %s was not modeled correctly or did not start.' % VPOOL_NAME)
开发者ID:tcpcloud,项目名称:openvstorage,代码行数:56,代码来源:ovs_common.py

示例7: _create_vpool

    def _create_vpool(self):
        """
        Needed to actually run tests on
        This is not actually a test of "Add Vpool to OVS",
        so any failure here will be reported as a setUp error and no tests will run
        """
        pmachine = System.get_my_storagerouter().pmachine
        mgmt_center = MgmtCenter(
            data={
                "name": "Openstack",
                "description": "test",
                "username": CINDER_USER,
                "password": CINDER_PASS,
                "ip": CINDER_CONTROLLER,
                "port": 80,
                "type": "OPENSTACK",
                "metadata": {"integratemgmt": True},
            }
        )
        mgmt_center.save()
        pmachine.mgmtcenter = mgmt_center
        pmachine.save()
        self._debug("Creating vpool")

        parameters = {
            "storagerouter_ip": IP,
            "vpool_name": VPOOL_NAME,
            "type": "local",
            "storage_ip": "127.0.0.1",  # KVM
            "vrouter_port": VPOOL_PORT,
            "integrate_vpool": True,
            "connection_host": IP,
            "connection_port": VPOOL_PORT,
            "connection_username": "",
            "connection_password": "",
            "connection_backend": {},
            "readcache_size": 50,
            "writecache_size": 50,
        }
        StorageRouterController.add_vpool(parameters)
        attempt = 0
        while attempt < 10:
            vpool = VPoolList.get_vpool_by_name(VPOOL_NAME)
            if vpool is not None:
                self._debug("vpool {0} created".format(VPOOL_NAME))
                try:
                    os.listdir(VPOOL_MOUNTPOINT)
                    return vpool
                except Exception as ex:
                    # either it doesn't exist, or we don't have permission
                    self._debug("vpool not ready yet {0}".format(str(ex)))
                    pass
            attempt += 1
            time.sleep(2)
        raise RuntimeError("Vpool {0} was not modeled correctly or did not start.".format(VPOOL_NAME))
开发者ID:jamie-liu,项目名称:openvstorage,代码行数:55,代码来源:ovs_common.py

示例8: __init__

 def __init__(self, *args, **kwargs):
     """Init: args, kwargs pass through;
     Options come from CONF
     """
     super(OVSVolumeDriver, self).__init__(*args, **kwargs)
     LOG.info('INIT %s %s %s ' % (CONF.vpool_name, str(args), str(kwargs)))
     self.configuration.append_config_values(OPTS)
     self._vpool_name = self.configuration.vpool_name
     self._vp = VPoolList.get_vpool_by_name(self._vpool_name)
     self._context = None
     self._db = kwargs.get('db', None)
     self._api = api.API()
开发者ID:jianyongchen,项目名称:openvstorage,代码行数:12,代码来源:openvstorage.py

示例9: check_model_consistency

    def check_model_consistency(result_handler):
        """
        Checks if the model consistency of OVSDB vs. VOLUMEDRIVER and does a preliminary check on RABBITMQ
        :param result_handler: logging object
        :type result_handler: ovs.extensions.healthcheck.result.HCResults
        :return: None
        :rtype: NoneType
        """
        result_handler.info('Checking model consistency: ')

        # Checking consistency of volumedriver vs. ovsdb and backwards
        for vp in VPoolList.get_vpools():
            if vp.guid not in OpenvStorageHealthCheck.LOCAL_SR.vpools_guids:
                result_handler.skip('Skipping vPool {0} because it is not living here.'.format(vp.name))
                continue
            result_handler.info('Checking consistency of volumedriver vs. ovsdb for {0}: '.format(vp.name), add_to_result=False)
            missing_in_volumedriver = []
            missing_in_model = []
            try:
                # noinspection PyArgumentList
                voldrv_volume_list = vp.storagedriver_client.list_volumes()
            except (ClusterNotReachableException, RuntimeError) as ex:
                result_handler.warning('Seems like the volumedriver {0} is not running. Got {1}'.format(vp.name, str(ex)),
                                       code=ErrorCodes.voldrv_connection_problem)
                continue

            vdisk_volume_ids = []
            # Cross-reference model vs. volumedriver
            for vdisk in vp.vdisks:
                vdisk_volume_ids.append(vdisk.volume_id)
                if vdisk.volume_id not in voldrv_volume_list:
                    missing_in_volumedriver.append(vdisk.guid)
                else:
                    voldrv_volume_list.remove(vdisk.volume_id)
            # Cross-reference volumedriver vs. model
            for voldrv_id in voldrv_volume_list:
                if voldrv_id not in vdisk_volume_ids:
                    missing_in_model.append(voldrv_id)

            # Display discrepancies for vPool
            if len(missing_in_volumedriver) != 0:
                result_handler.warning('Detected volumes that are MISSING in volumedriver but are in ovsdb in vpool: {0} - vdisk guid(s):{1}.'
                                       .format(vp.name, ' '.join(missing_in_volumedriver)),
                                       code=ErrorCodes.missing_volumedriver)
            else:
                result_handler.success('No discrepancies found for ovsdb in vPool {0}'.format(vp.name), code=ErrorCodes.missing_volumedriver)

            if len(missing_in_model) != 0:
                result_handler.warning('Detected volumes that are AVAILABLE in volumedriver but are not in ovsdb in vpool: {0} - vdisk volume id(s):{1}'
                                       .format(vp.name, ', '.join(missing_in_model)),
                                       code=ErrorCodes.missing_ovsdb)
            else:
                result_handler.success('No discrepancies found for voldrv in vpool {0}'.format(vp.name), code=ErrorCodes.missing_ovsdb)
开发者ID:openvstorage,项目名称:openvstorage-health-check,代码行数:53,代码来源:generic.py

示例10: _ns_statistics

    def _ns_statistics(self):
        """
        Returns a list of the ASDs namespaces
        """
        # Collect ALBA related statistics
        alba_dataset = {}
        for namespace in self.ns_data:
            if namespace['namespace']['state'] != 'active':
                continue
            alba_dataset[namespace['name']] = namespace['statistics']

        # Collect vPool/vDisk data
        vdisk_dataset = {}
        for vpool in VPoolList.get_vpools():
            vdisk_dataset[vpool] = vpool.storagedriver_client.list_volumes()

        # Collect global usage
        global_usage = {'size': 0,
                        'used': 0}
        for stats in self.asd_statistics.values():
            global_usage['size'] += stats['capacity']
            global_usage['used'] += stats['disk_usage']

        # Cross merge
        dataset = {'global': {'size': global_usage['size'],
                              'used': global_usage['used']},
                   'vpools': {},
                   'overhead': 0,
                   'unknown': {'storage': 0,
                               'logical': 0}}
        for vpool in vdisk_dataset:
            for namespace in vdisk_dataset[vpool]:
                if namespace in alba_dataset:
                    if vpool.guid not in dataset['vpools']:
                        dataset['vpools'][vpool.guid] = {'storage': 0,
                                                         'logical': 0}
                    dataset['vpools'][vpool.guid]['storage'] += alba_dataset[namespace]['storage']
                    dataset['vpools'][vpool.guid]['logical'] += alba_dataset[namespace]['logical']
                    del alba_dataset[namespace]
            fd_namespace = 'fd-{0}-{1}'.format(vpool.name, vpool.guid)
            if fd_namespace in alba_dataset:
                if vpool.guid not in dataset['vpools']:
                    dataset['vpools'][vpool.guid] = {'storage': 0,
                                                     'logical': 0}
                dataset['vpools'][vpool.guid]['storage'] += alba_dataset[fd_namespace]['storage']
                dataset['vpools'][vpool.guid]['logical'] += alba_dataset[fd_namespace]['logical']
                del alba_dataset[fd_namespace]
        for namespace in alba_dataset:
            dataset['unknown']['storage'] += alba_dataset[namespace]['storage']
            dataset['unknown']['logical'] += alba_dataset[namespace]['logical']
        dataset['overhead'] = max(0, dataset['global']['used'] - dataset['unknown']['storage'] - sum(usage['storage'] for usage in dataset['vpools'].values()))
        return dataset
开发者ID:DarumasLegs,项目名称:framework-alba-plugin,代码行数:52,代码来源:albabackend.py

示例11: mds_checkup

 def mds_checkup():
     """
     Validates the current MDS setup/configuration and takes actions where required
     """
     mds_dict = {}
     for vpool in VPoolList.get_vpools():
         for mds_service in vpool.mds_services:
             storagerouter = mds_service.service.storagerouter
             if vpool not in mds_dict:
                 mds_dict[vpool] = {}
             if storagerouter not in mds_dict[vpool]:
                 mds_dict[vpool][storagerouter] = {'client': SSHClient(storagerouter, username='root'),
                                                   'services': []}
             mds_dict[vpool][storagerouter]['services'].append(mds_service)
     for vpool, storagerouter_info in mds_dict.iteritems():
         # 1. First, make sure there's at least one MDS on every StorageRouter that's not overloaded
         # If not, create an extra MDS for that StorageRouter
         for storagerouter in storagerouter_info:
             client = mds_dict[vpool][storagerouter]['client']
             mds_services = mds_dict[vpool][storagerouter]['services']
             has_room = False
             for mds_service in mds_services[:]:
                 if mds_service.capacity == 0 and len(mds_service.vdisks_guids) == 0:
                     client = SSHClient(storagerouter)
                     MDSServiceController.remove_mds_service(mds_service, client, storagerouter, vpool, reload_config=True)
                     mds_services.remove(mds_service)
             for mds_service in mds_services:
                 _, load = MDSServiceController.get_mds_load(mds_service)
                 if load < Configuration.get('ovs.storagedriver.mds.maxload'):
                     has_room = True
                     break
             if has_room is False:
                 mds_service = MDSServiceController.prepare_mds_service(client, storagerouter, vpool,
                                                                        fresh_only=False, reload_config=True)
                 if mds_service is None:
                     raise RuntimeError('Could not add MDS node')
                 mds_services.append(mds_service)
         mds_config_set = MDSServiceController.get_mds_storagedriver_config_set(vpool)
         for storagerouter in mds_dict[vpool]:
             client = mds_dict[vpool][storagerouter]['client']
             storagedriver_config = StorageDriverConfiguration('storagedriver', vpool.name)
             storagedriver_config.load(client)
             if storagedriver_config.is_new is False:
                 storagedriver_config.clean()  # Clean out obsolete values
                 storagedriver_config.configure_filesystem(
                     fs_metadata_backend_mds_nodes=mds_config_set[storagerouter.guid]
                 )
                 storagedriver_config.save(client)
         # 2. Per VPool, execute a safety check, making sure the master/slave configuration is optimal.
         for vdisk in vpool.vdisks:
             MDSServiceController.ensure_safety(vdisk)
开发者ID:jianyongchen,项目名称:openvstorage,代码行数:51,代码来源:mdsservice.py

示例12: _create_vpool

    def _create_vpool(self):
        """
        Needed to actually run tests on
        This is not actually a test of "Add Vpool to OVS",
        so any failure here will be reported as a setUp error and no tests will run
        """
        pmachine = System.get_my_storagerouter().pmachine
        mgmt_center = MgmtCenter(data={'name': 'Openstack',
                                       'description': 'test',
                                       'username': OVSPluginTestCase.CINDER_USER,
                                       'password': OVSPluginTestCase.CINDER_PASS,
                                       'ip': OVSPluginTestCase.CINDER_CONTROLLER,
                                       'port': 80,
                                       'type': 'OPENSTACK',
                                       'metadata': {'integratemgmt': True}})
        mgmt_center.save()
        pmachine.mgmtcenter = mgmt_center
        pmachine.save()
        self._debug('Creating vpool')

        parameters = {'storagerouter_ip': OVSPluginTestCase.ip,
                      'vpool_name': OVSPluginTestCase.VPOOL_NAME,
                      'type': 'local',
                      'storage_ip': '127.0.0.1',  # KVM
                      'vrouter_port': OVSPluginTestCase.VPOOL_PORT,
                      'integrate_vpool': True,
                      'connection_host': OVSPluginTestCase.ip,
                      'connection_port': OVSPluginTestCase.VPOOL_PORT,
                      'connection_username': '',
                      'connection_password': '',
                      'connection_backend': {},
                      'readcache_size': 50,
                      'writecache_size': 50
                      }
        StorageRouterController.add_vpool(parameters)
        attempt = 0
        while attempt < 10:
            vpool = VPoolList.get_vpool_by_name(OVSPluginTestCase.VPOOL_NAME)
            if vpool is not None:
                self._debug('vpool {0} created'.format(OVSPluginTestCase.VPOOL_NAME))
                try:
                    os.listdir(OVSPluginTestCase.VPOOL_MOUNTPOINT)
                    return vpool
                except Exception as ex:
                    # either it doesn't exist, or we don't have permission
                    self._debug('vpool not ready yet {0}'.format(str(ex)))
                    pass
            attempt += 1
            time.sleep(2)
        raise RuntimeError('Vpool {0} was not modeled correctly or did not start.'.format(OVSPluginTestCase.VPOOL_NAME))
开发者ID:DarumasLegs,项目名称:framework,代码行数:50,代码来源:ovs_common.py

示例13: list_volumes

 def list_volumes(vpool_guid=None):
     """
     List all known volumes on a specific vpool or on all
     """
     if vpool_guid is not None:
         vpool = VPool(vpool_guid)
         storagedriver_client = StorageDriverClient.load(vpool)
         response = storagedriver_client.list_volumes()
     else:
         response = []
         for vpool in VPoolList.get_vpools():
             storagedriver_client = StorageDriverClient.load(vpool)
             response.extend(storagedriver_client.list_volumes())
     return response
开发者ID:tcpcloud,项目名称:openvstorage,代码行数:14,代码来源:vdisk.py

示例14: _remove_vpool

 def _remove_vpool(self):
     """
     Clean up
     This is not actually a test of "Remove Vpool from OVS",
     so any failure here will be reported as a tearDown error and no cleanup will occur
     """
     self._debug('Removing vpool')
     vpool = VPoolList.get_vpool_by_name(VPOOL_NAME)
     if vpool is None:
         self._debug('already removed')
         return
     for storagedriver_guid in vpool.storagedrivers_guids:
         self._debug('removing storagedriver {0}'.format(storagedriver_guid))
         StorageRouterController.remove_storagedriver(storagedriver_guid)
     attempt = 0
     while attempt < 10:
         vpool = VPoolList.get_vpool_by_name(VPOOL_NAME)
         if vpool is None:
             self._debug('vpool {0} deleted'.format(VPOOL_NAME))
             return
         attempt += 1
         time.sleep(2)
     raise RuntimeError('Vpool {0} was not removed correctly.'.format(VPOOL_NAME))
开发者ID:JasperLue,项目名称:openvstorage,代码行数:23,代码来源:ovs_common.py

示例15: checkForHaltedVolumes

    def checkForHaltedVolumes(self):

        self.utility.logger("Checking for halted volumes: ", self.module, 3, 'checkHaltedVolumes', False)

        vpools = VPoolList.get_vpools()

        if len(vpools) != 0:

            for vp in vpools:

                haltedVolumes = []

                self.utility.logger("Checking vPool '{0}': ".format(vp.name), self.module, 3,
                                    'checkVPOOL_{0}'.format(vp.name), False)

                config_file = self.utility.fetchConfigFilePath(vp.name, self.machine_id, 1, vp.guid)
                voldrv_client = src.LocalStorageRouterClient(config_file)

                for volume in voldrv_client.list_volumes():
                    # check if volume is halted, returns: 0 or 1
                    try:
                        if int(self.utility.parseXMLtoJSON(voldrv_client.info_volume(volume))
                                   ["boost_serialization"]["XMLRPCVolumeInfo"]["halted"]):
                            haltedVolumes.append(volume)
                    except ObjectNotFoundException:
                        # ignore ovsdb invalid entrees
                        # model consistency will handle it.
                        continue
                    except MaxRedirectsExceededException:
                        # this means the volume is not halted but detached or unreachable for the volumedriver
                        haltedvolumes.append(volume)

                # print all results
                if len(haltedVolumes) > 0:
                    self.utility.logger("Detected volumes that are HALTED in volumedriver in vPool '{0}': {1}"
                                        .format(vp.name, ', '.join(haltedVolumes)), self.module, 0,
                                        'halted')
                else:
                    self.utility.logger("No halted volumes detected in vPool '{0}'"
                                        .format(vp.name), self.module, 1,
                                        'halted')

        else:
            self.utility.logger("No vPools found!".format(len(vpools)), self.module, 5, 'halted')
开发者ID:DarumasLegs,项目名称:openvstorage-health-check,代码行数:44,代码来源:openvstoragecluster_health_check.py


注:本文中的ovs.dal.lists.vpoollist.VPoolList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。