def search(cls, pathspec=None): """Search for volumes matching ``pathspec`` This will search for any physical volumes matching ``pathspec`` and return an iterable that provides instance of PhysicalVolume :returns: iterable of PhysicalVolume instances """ for volume in pvs(pathspec): yield cls(volume)
def lookup(cls, pathspec): """Lookup a physical volume for the pathspec given This will always return the first volume found and raise an error if multiple volumes match ``pathspec`` :returns: PhysicalVolume instance """ try: volume, = pvs(pathspec) return cls(volume) except (ValueError, LVMCommandError): raise LookupError("No PhysicalVolume could be found for " "pathspec %r" % pathspec)
def reload(self): """Reload this PhysicalVolume""" self.attributes, = pvs(self.pv_name)