def search(cls, pathspec=None): """Search for volume groups matching ``pathspec`` This will search for any volume groups matching ``pathspec`` and return an iterable that provides instance of VolumeGroup :returns: iterable of VolumeGroup instances """ for volume in vgs(pathspec): yield cls(volume)
def lookup(cls, pathspec): """Lookup a volume group for ``pathspec`` This will always return the first volume group found and raise an error if multiple volumes match ``pathspec`` :returns: VolumeGroup instance """ try: volume, = vgs(pathspec) return cls(volume) except (LVMCommandError, ValueError): raise LookupError("No VolumeGroup could be found for pathspec %r" % pathspec)
def reload(self): """Reload this VolumeGroup""" self.attributes, = vgs(self.vg_name)
def test_vgs(self): """Test VG""" vol_group, = vgs(TEST_VG) self.assertEqual(vol_group["vg_name"], TEST_VG) self.assertEqual(int(vol_group["pv_count"]), 1)