def is_lun_io_ready(lun): utils.update_res_without_poll(lun) if not lun.existed: return False lun_state = lun.state if lun_state == common.LUNState.INITIALIZING: return False elif lun_state in [common.LUNState.READY, common.LUNState.FAULTED]: return lun.operation == 'None' else: # Quick exit wait_until when the lun is other state to avoid # long-time timeout. msg = ('Volume %(name)s was created in VNX, ' 'but in %(state)s state.' % {'name': lun.name, 'state': lun_state}) raise exception.VolumeBackendAPIException(data=msg)
def is_lun_expanded(lun, new_size): utils.update_res_without_poll(lun) return new_size == lun.total_capacity_gb
def is_lun_ops_ready(lun): utils.update_res_without_poll(lun) return 'None' == lun.operation
def is_object_existed(obj): utils.update_res_without_poll(obj) return obj.existed