Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
 def reload(self):
     """Reload this VolumeGroup"""
     self.attributes, = vgs(self.vg_name)
Example #6
0
 def reload(self):
     """Reload this VolumeGroup"""
     self.attributes, = vgs(self.vg_name)
Example #7
0
 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)