def _detach(self, force, **kwds): self.lvm_group_cfg = lvm2.backup_vg_config(self.vg) lvm2.vgremove(self.vg, force=True) lvm2.pvremove(self.raid_pv, force=True) mdadm.mdadm('misc', None, self.raid_pv, stop=True, force=True) try: mdadm.mdadm('manage', None, self.raid_pv, remove=True, force=True) except (Exception, BaseException), e: if not 'No such file or directory' in str(e): raise
def _destroy(self, force, **kwds): try: lvm2.lvremove(self.device) except lvm2.NotFound: pass if force: try: vg_info = lvm2.vgs(self.vg).values()[0] except lvm2.NotFound: pass else: if not (int(vg_info.snap_count) and not int(vg_info.lv_count)): pv_disks = [device for device, pv_info in lvm2.pvs().items() if pv_info.vg_name == self.vg] lvm2.vgremove(self.vg) for device in pv_disks: lvm2.pvremove(device) for pv in self.pvs: pv.destroy(force=True)
def _destroy(self, force, **kwds): try: lvm2.lvremove(self.device) except lvm2.NotFound: pass if force: try: vg_info = lvm2.vgs(self.vg).values()[0] except lvm2.NotFound: pass else: if not (int(vg_info.snap_count) and not int(vg_info.lv_count)): pv_disks = [ device for device, pv_info in lvm2.pvs().items() if pv_info.vg_name == self.vg ] lvm2.vgremove(self.vg) for device in pv_disks: lvm2.pvremove(device) for pv in self.pvs: pv.destroy(force=True)