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)
评论列表
文章目录