def destroy(self): """ Destroy the device. """ if not self.exists: raise VolumeGroupError("device has not been created", self.name) # set up the pvs since lvm needs access to them to do the vgremove self.setupParents(orig=True) # this sometimes fails for some reason. try: lvm.vgreduce(self.name, [], rm=True) lvm.vgremove(self.name) except lvm.LVMError: raise VolumeGroupError("Could not completely remove VG", self.name) finally: self.exists = False
def reduce(self, pv_list): """ Remove the listed PVs from the VG. """ if not self.exists: raise VolumeGroupError("device has not been created", self.name) lvm.vgreduce(self.name, pv_list)