def getVolumeTag(sdUUID, volUUID, tagPrefix): tags = lvm.getLV(sdUUID, volUUID).tags if sc.TAG_VOL_UNINIT in tags: log.warning("Reloading uninitialized volume %s/%s", sdUUID, volUUID) lvm.invalidateVG(sdUUID) tags = lvm.getLV(sdUUID, volUUID).tags if sc.TAG_VOL_UNINIT in tags: log.error("Found uninitialized volume: %s/%s", sdUUID, volUUID) raise se.VolumeDoesNotExist("%s/%s" % (sdUUID, volUUID)) for tag in tags: if tag.startswith(tagPrefix): return tag[len(tagPrefix):] else: log.error("Missing tag %s in volume: %s/%s. tags: %s", tagPrefix, sdUUID, volUUID, tags) raise se.MissingTagOnLogicalVolume(volUUID, tagPrefix)
def produceVolume(self, img_id, vol_id): key = (img_id, vol_id) if key not in self.volumes: raise se.VolumeDoesNotExist(vol_id) return self.volumes[key]