def commit(self): lv = lvm.getLV(self.sd_manifest.sdUUID, self.vol_id) if sc.TEMP_VOL_LVTAG not in lv.tags: raise se.VolumeAlreadyExists("LV %r has already been committed" % self.vol_id) lvm.changeLVTags(self.sd_manifest.sdUUID, self.vol_id, delTags=(sc.TEMP_VOL_LVTAG,))
def commit(self): lv = lvm.getLV(self.sd_manifest.sdUUID, self.vol_id) if sc.TEMP_VOL_LVTAG not in lv.tags: raise se.VolumeAlreadyExists("LV %r has already been committed" % self.vol_id) lvm.changeLVTags(self.sd_manifest.sdUUID, self.vol_id, delTags=(sc.TEMP_VOL_LVTAG, ))
def _create_lv_artifact(self, parent, lv_size): try: lv = lvm.getLV(self.sd_manifest.sdUUID, self.vol_id) except se.LogicalVolumeDoesNotExistError: pass else: if sc.TEMP_VOL_LVTAG in lv.tags: raise se.DomainHasGarbage("Logical volume artifact %s exists" % self.vol_id) else: raise se.VolumeAlreadyExists("Logical volume %s exists" % self.vol_id) parent_vol_id = parent.vol_id if parent else sc.BLANK_UUID tags = (sc.TEMP_VOL_LVTAG, sc.TAG_PREFIX_PARENT + parent_vol_id, sc.TAG_PREFIX_IMAGE + self.img_id) lvm.createLV(self.sd_manifest.sdUUID, self.vol_id, lv_size, activate=True, initialTags=tags)
def is_garbage(self): try: lv = lvm.getLV(self.sd_manifest.sdUUID, self.vol_id) except se.LogicalVolumeDoesNotExistError: return False return sc.TEMP_VOL_LVTAG in lv.tags