def extend(self, devlist): mapping = self.readMetadataMapping().values() if self.getVersion() in VERS_METADATA_LV: if len(mapping) + len(devlist) > MAX_PVS: raise se.StorageDomainIsMadeFromTooManyPVs() self._extendlock.acquire() try: knowndevs = list(multipath.getMPDevNamesIter()) devices = [] for dev in devlist: if dev in knowndevs: devices.append(dev) else: raise se.InvalidPhysDev(dev) lvm.extendVG(self.sdUUID, devices) self.updateMapping() newsize = self.metaSize(self.sdUUID) lvm.extendLV(self.sdUUID, sd.METADATA, newsize) finally: self._extendlock.release()
def extend(self, devlist, force): with self._extendlock: if self.getVersion() in VERS_METADATA_LV: mapping = self.readMetadataMapping().values() if len(mapping) + len(devlist) > MAX_PVS: raise se.StorageDomainIsMadeFromTooManyPVs() knowndevs = set(multipath.getMPDevNamesIter()) unknowndevs = set(devlist) - knowndevs if unknowndevs: raise se.InaccessiblePhysDev(unknowndevs) lvm.extendVG(self.sdUUID, devlist, force) self.updateMapping() newsize = self.metaSize(self.sdUUID) lvm.extendLV(self.sdUUID, sd.METADATA, newsize)