Beispiel #1
0
 def cleanup(self):
     # Remove all volumes of volume group
     try:
         lvm2.vgs(vg_name)
     except lvm2.NotFound:
         pass
     else:
         lvm2.vgremove(vg_name)
Beispiel #2
0
 def cleanup(self):
     # Remove all volumes of volume group
     try:
         lvm2.vgs(vg_name)
     except lvm2.NotFound:
         pass
     else:
         lvm2.vgremove(vg_name)
Beispiel #3
0
    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
Beispiel #4
0
    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
Beispiel #5
0
	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)
Beispiel #6
0
    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)