coprhd_blockdevice.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:flocker-driver 作者: CoprHD 项目源码 文件源码
def get_volume_lunid(self, vol):
        self.authenticate_user()
        Message.new(Info="coprhd-get_volume_lunid" + vol).write(_logger)
        try:
           volumeuri = self.volume_obj.volume_query(
                         self.tenant +
                         "/" +
                         self.project
                         + "/" + vol)
           if not volumeuri:
            return
           volumedetails = self.volume_obj.show_by_uri(volumeuri)
           groupdetails = self.exportgroup_obj.exportgroup_show(
                         self.hostexportgroup,
                         self.project,
                         self.tenant)
           exportedvolumes =  groupdetails['volumes'] 
           Message.new(Info="coprhd-get_volume_lunid for loop").write(_logger)
           for evolumes in exportedvolumes:
              if volumeuri == evolumes['id']:
               return evolumes['lun']
           return 
        except utils.SOSError as e:
            if e.err_code == utils.SOSError.NOT_FOUND_ERR:
                Message.new(Debug="Volume : doesnot exist").write(_logger)
            elif(e.err_code == utils.SOSError.HTTP_ERR):
                raise utils.SOSError(
                    utils.SOSError.HTTP_ERR,
                    "coprhd get volume lunid http error" + e.err_text)
            elif(e.err_code == utils.SOSError.SOS_FAILURE_ERR):
                raise utils.SOSError(
                    utils.SOSError.SOS_FAILURE_ERR,
                    "coprhd get volume lunid failed" + e.err_text)
            else:
                Message.new(Debug="coprhd-get_volume_lunid failed").write(_logger)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号