def renameVolumeRollback(cls, taskObj, sdUUID, oldUUID, newUUID): try: cls.log.info("renameVolumeRollback: sdUUID=%s oldUUID=%s " "newUUID=%s", sdUUID, oldUUID, newUUID) lvm.renameLV(sdUUID, oldUUID, newUUID) except Exception: cls.log.error("Failure in renameVolumeRollback: sdUUID=%s " "oldUUID=%s newUUID=%s", sdUUID, oldUUID, newUUID, exc_info=True)
def rename(self, newUUID, recovery=True): """ Rename volume """ self.log.info("Rename volume %s as %s ", self.volUUID, newUUID) if not self.imagePath: self.validateImagePath() if os.path.lexists(self.getVolumePath()): os.unlink(self.getVolumePath()) if recovery: name = "Rename volume rollback: " + newUUID vars.task.pushRecovery(task.Recovery(name, "blockVolume", "BlockVolume", "renameVolumeRollback", [self.sdUUID, newUUID, self.volUUID])) lvm.renameLV(self.sdUUID, self.volUUID, newUUID) self.volUUID = newUUID self.volumePath = os.path.join(self.imagePath, newUUID)
def rename(self, newUUID, recovery=True): """ Rename volume """ self.log.info("Rename volume %s as %s ", self.volUUID, newUUID) if not self.imagePath: self.validateImagePath() if os.path.lexists(self.getVolumePath()): os.unlink(self.getVolumePath()) if recovery: name = "Rename volume rollback: " + newUUID vars.task.pushRecovery( task.Recovery(name, "blockVolume", "BlockVolume", "renameVolumeRollback", [self.sdUUID, newUUID, self.volUUID])) lvm.renameLV(self.sdUUID, self.volUUID, newUUID) self.volUUID = newUUID self.volumePath = os.path.join(self.imagePath, newUUID)