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


Python VDiskList.get_vdisk_by_volume_id方法代码示例

本文整理汇总了Python中ovs.dal.lists.vdisklist.VDiskList.get_vdisk_by_volume_id方法的典型用法代码示例。如果您正苦于以下问题:Python VDiskList.get_vdisk_by_volume_id方法的具体用法?Python VDiskList.get_vdisk_by_volume_id怎么用?Python VDiskList.get_vdisk_by_volume_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ovs.dal.lists.vdisklist.VDiskList的用法示例。


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

示例1: delete_from_voldrv

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
 def delete_from_voldrv(volumename, storagedriver_id):
     """
     Delete a disk
     Triggered by volumedriver messages on the queue
     @param volumename: volume id of the disk
     """
     _ = storagedriver_id  # For logging purposes
     disk = VDiskList.get_vdisk_by_volume_id(volumename)
     if disk is not None:
         mutex = VolatileMutex('{}_{}'.format(volumename, disk.devicename))
         try:
             mutex.acquire(wait=20)
             pmachine = None
             try:
                 pmachine = PMachineList.get_by_storagedriver_id(disk.storagedriver_id)
             except RuntimeError as ex:
                 if 'could not be found' not in str(ex):
                     raise
                 # else: pmachine can't be loaded, because the volumedriver doesn't know about it anymore
             if pmachine is not None:
                 limit = 5
                 hypervisor = Factory.get(pmachine)
                 exists = hypervisor.file_exists(disk.vpool, disk.devicename)
                 while limit > 0 and exists is True:
                     time.sleep(1)
                     exists = hypervisor.file_exists(disk.vpool, disk.devicename)
                     limit -= 1
                 if exists is True:
                     logger.info('Disk {0} still exists, ignoring delete'.format(disk.devicename))
                     return
             logger.info('Delete disk {}'.format(disk.name))
             disk.delete()
         finally:
             mutex.release()
开发者ID:mflu,项目名称:openvstorage_centos,代码行数:36,代码来源:vdisk.py

示例2: resize_from_voldrv

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
    def resize_from_voldrv(volumename, volumesize, volumepath, storagedriver_id):
        """
        Resize a disk
        Triggered by volumedriver messages on the queue

        @param volumepath: path on hypervisor to the volume
        @param volumename: volume id of the disk
        @param volumesize: size of the volume
        """
        pmachine = PMachineList.get_by_storagedriver_id(storagedriver_id)
        storagedriver = StorageDriverList.get_by_storagedriver_id(storagedriver_id)
        hypervisor = Factory.get(pmachine)
        volumepath = hypervisor.clean_backing_disk_filename(volumepath)
        mutex = VolatileMutex('{}_{}'.format(volumename, volumepath))
        try:
            mutex.acquire(wait=30)
            disk = VDiskList.get_vdisk_by_volume_id(volumename)
            if disk is None:
                disk = VDiskList.get_by_devicename_and_vpool(volumepath, storagedriver.vpool)
                if disk is None:
                    disk = VDisk()
        finally:
            mutex.release()
        disk.devicename = volumepath
        disk.volume_id = volumename
        disk.size = volumesize
        disk.vpool = storagedriver.vpool
        disk.save()
        VDiskController.sync_with_mgmtcenter(disk, pmachine, storagedriver)
        MDSServiceController.ensure_safety(disk)
开发者ID:tcpcloud,项目名称:openvstorage,代码行数:32,代码来源:vdisk.py

示例3: volumedriver_error

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
 def volumedriver_error(code, volumename):
     """
     Handles error messages/events from the volumedriver
     """
     if code == VolumeDriverEvents.MDSFailover:
         disk = VDiskList.get_vdisk_by_volume_id(volumename)
         if disk is not None:
             MDSServiceController.ensure_safety(disk)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:10,代码来源:storagedriver.py

示例4: volumedriver_error

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
 def volumedriver_error(code, volumename, storagedriver_id):
     """
     Handles error messages/events from the volumedriver
     """
     _ = storagedriver_id  # Required for the @log decorator
     if code == VolumeDriverEvents.MDSFailover:
         disk = VDiskList.get_vdisk_by_volume_id(volumename)
         if disk is not None:
             MDSServiceController.ensure_safety(disk)
开发者ID:tcpcloud,项目名称:openvstorage,代码行数:11,代码来源:storagedriver.py

示例5: volumedriver_error

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
 def volumedriver_error(code, volumename, storagedriver_id):
     """
     Handles error messages/events from the volumedriver
     :param code: Volumedriver error code
     :param volumename: Name of the volume throwing the error
     :param storagedriver_id: ID of the storagedriver hosting the volume
     """
     _ = storagedriver_id  # Required for the @log decorator
     if code == VolumeDriverEvents.MDSFailover:
         disk = VDiskList.get_vdisk_by_volume_id(volumename)
         if disk is not None:
             MDSServiceController.ensure_safety(disk)
开发者ID:JasperLue,项目名称:openvstorage,代码行数:14,代码来源:storagedriver.py

示例6: volumedriver_error

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
 def volumedriver_error(code, volume_id):
     """
     Handles error messages/events from the volumedriver
     :param code: Volumedriver error code
     :type code: int
     :param volume_id: Name of the volume throwing the error
     :type volume_id: str
     :return: None
     """
     if code == VolumeDriverEvents.MDSFailover:
         disk = VDiskList.get_vdisk_by_volume_id(volume_id)
         if disk is not None:
             MDSServiceController.ensure_safety(disk)
开发者ID:grimpy,项目名称:openvstorage,代码行数:15,代码来源:storagedriver.py

示例7: dtl_state_transition

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
 def dtl_state_transition(volume_name, old_state, new_state, storagedriver_id):
     """
     Triggered by volumedriver when DTL state changes
     :param volume_name: ID of the volume
     :param old_state: Previous DTL status
     :param new_state: New DTL status
     :param storagedriver_id: ID of the storagedriver hosting the volume
     :return: None
     """
     if new_state == VolumeDriverEvents_pb2.Degraded and old_state != VolumeDriverEvents_pb2.Standalone:
         vdisk = VDiskList.get_vdisk_by_volume_id(volume_name)
         if vdisk:
             logger.info('Degraded DTL detected for volume {0} with guid {1}'.format(vdisk.name, vdisk.guid))
             storagedriver = StorageDriverList.get_by_storagedriver_id(storagedriver_id)
             VDiskController.dtl_checkup(vdisk_guid=vdisk.guid,
                                         storagerouters_to_exclude=[storagedriver.storagerouter.guid],
                                         chain_timeout=600)
开发者ID:jamie-liu,项目名称:openvstorage,代码行数:19,代码来源:vdisk.py

示例8: rename_from_voldrv

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
    def rename_from_voldrv(volumename, volume_old_path, volume_new_path, storagedriver_id):
        """
        Rename a disk
        Triggered by volumedriver messages

        @param volumename: volume id of the disk
        @param volume_old_path: old path on hypervisor to the volume
        @param volume_new_path: new path on hypervisor to the volume
        """
        pmachine = PMachineList.get_by_storagedriver_id(storagedriver_id)
        hypervisor = Factory.get(pmachine)
        volume_old_path = hypervisor.clean_backing_disk_filename(volume_old_path)
        volume_new_path = hypervisor.clean_backing_disk_filename(volume_new_path)
        disk = VDiskList.get_vdisk_by_volume_id(volumename)
        if disk:
            logger.info("Move disk {} from {} to {}".format(disk.name, volume_old_path, volume_new_path))
            disk.devicename = volume_new_path
            disk.save()
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:20,代码来源:vdisk.py

示例9: migrate_from_voldrv

# 需要导入模块: from ovs.dal.lists.vdisklist import VDiskList [as 别名]
# 或者: from ovs.dal.lists.vdisklist.VDiskList import get_vdisk_by_volume_id [as 别名]
    def migrate_from_voldrv(volume_id, new_owner_id):
        """
        Triggered when volume has changed owner (Clean migration or stolen due to other reason)
        Triggered by volumedriver messages

        :param volume_id:    Volume ID of the disk
        :type volume_id:     unicode

        :param new_owner_id: ID of the storage driver the volume migrated to
        :type new_owner_id:  unicode

        :returns:            None
        """
        sd = StorageDriverList.get_by_storagedriver_id(storagedriver_id=new_owner_id)
        vdisk = VDiskList.get_vdisk_by_volume_id(volume_id=volume_id)
        if vdisk is not None:
            logger.info('Migration - Guid {0} - ID {1} - Detected migration for virtual disk {2}'.format(vdisk.guid, vdisk.volume_id, vdisk.name))
            if sd is not None:
                logger.info('Migration - Guid {0} - ID {1} - Storage Router {2} is the new owner of virtual disk {3}'.format(vdisk.guid, vdisk.volume_id, sd.storagerouter.name, vdisk.name))
            MDSServiceController.mds_checkup()
            VDiskController.dtl_checkup(vdisk_guid=vdisk.guid)
开发者ID:jamie-liu,项目名称:openvstorage,代码行数:23,代码来源:vdisk.py


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