def _resize_if_needed(guid): name = devicemapper.getDmId(guid) slaves = [(slave, getDeviceSize(slave)) for slave in devicemapper.getSlaves(name)] if len(slaves) == 0: log.warning("Map %r has no slaves" % guid) return False if len(set(size for slave, size in slaves)) != 1: raise Error("Map %r slaves size differ %s" % (guid, slaves)) map_size = getDeviceSize(name) slave_size = slaves[0][1] if map_size == slave_size: return False log.info("Resizing map %r (map_size=%d, slave_size=%d)", guid, map_size, slave_size) supervdsm.getProxy().resizeMap(name) return True
def _getpvblksize(pv): dev = devicemapper.getDmId(os.path.basename(pv)) return multipath.getDeviceBlockSizes(dev)