示例#1
0
文件: base.py 项目: bmildren/holland
    def search(cls, pathspec=None):
        """Search for logical volumes matching ``pathspec``

        This will search for any logical volumes matching ``pathspec`` and
        return an iterable that provides instances of LogicalVolume

        :returns: iterable of LogicalVolume instances
        """

        for volume in lvs(pathspec):
            yield cls(volume)
示例#2
0
    def search(cls, pathspec=None):
        """Search for logical volumes matching ``pathspec``

        This will search for any logical volumes matching ``pathspec`` and
        return an iterable that provides instances of LogicalVolume

        :returns: iterable of LogicalVolume instances
        """

        for volume in lvs(pathspec):
            yield cls(volume)
示例#3
0
    def test_lvs(self):
        """Test lv"""
        log_vol, = lvs("%s/%s" % (TEST_VG, TEST_LV))
        self.assertEqual(log_vol["vg_name"], TEST_VG)

        vg_extents = int(log_vol["vg_extent_count"])
        self.assertEqual(int(vg_extents), 31)

        vg_extent_size = int(log_vol["vg_extent_size"])
        self.assertEqual(int(vg_extent_size), 4194304)

        self.assertEqual(int(log_vol["lv_size"]), IMG_SIZE / 2)
示例#4
0
    def lookup(cls, pathspec):
        """Lookup a logical volume for ``pathspec``

        This will always return the first volume group found and raise an error
        if multiple volumes match ``pathspec``

        :returns: LogicalVolume instance
        """
        try:
            volume, = lvs(pathspec)
            return cls(volume)
        except (LVMCommandError, ValueError):
            #XX: Perhaps we should be more specific :)
            raise LookupError("No LogicalVolume could be found "
                              "for pathspec %r" %
                              pathspec)
示例#5
0
文件: base.py 项目: bmildren/holland
 def reload(self):
     """Reload the data for this LogicalVolume"""
     self.attributes, = lvs(self.device_name())
示例#6
0
 def reload(self):
     """Reload the data for this LogicalVolume"""
     self.attributes, = lvs(self.device_name())