Example #1
0
def scanDomains(pattern="*"):
    log = logging.getLogger("scanDomains")

    mntList = getMountsList(pattern)

    def collectMetaFiles(possibleDomain):
        try:
            metaFiles = oop.getGlobalProcPool().glob.glob(os.path.join(possibleDomain,
                constants.UUID_GLOB_PATTERN, sd.DOMAIN_META_DATA))

            for metaFile in metaFiles:
                if os.path.basename(os.path.dirname(metaFile)) != sd.MASTER_FS_DIR:
                    sdUUID = os.path.basename(os.path.dirname(metaFile))

                    return (sdUUID, os.path.dirname(metaFile))

        except Timeout:
            pass
        except Exception:
            log.warn("Could not collect metadata file for domain path %s", possibleDomain, exc_info=True)

    for res in misc.itmap(collectMetaFiles, mntList):
        if res is None:
            continue

        yield res
Example #2
0
def scanDomains(pattern="*"):
    log = logging.getLogger("Storage.scanDomains")

    mntList = getMountsList(pattern)

    def collectMetaFiles(possibleDomain):
        try:
            metaFiles = oop.getProcessPool(possibleDomain).glob.glob(
                os.path.join(possibleDomain, constants.UUID_GLOB_PATTERN, sd.DOMAIN_META_DATA)
            )

            for metaFile in metaFiles:
                if os.path.basename(os.path.dirname(metaFile)) != sd.MASTER_FS_DIR:
                    sdUUID = os.path.basename(os.path.dirname(metaFile))

                    return (sdUUID, os.path.dirname(metaFile))

        except Timeout:
            log.warn("Metadata collection for domain path %s timedout", possibleDomain, exc_info=True)
        except Exception:
            log.warn("Could not collect metadata file for domain path %s", possibleDomain, exc_info=True)

    # Run collectMetaFiles in extenral processes.
    # The amount of processes that can be initiated in the same time is the
    # amount of stuck domains we are willing to handle +1.
    # We Use 30% of the available slots.
    # TODO: calculate it right, now we use same value of max process per
    #       domain.
    for res in misc.itmap(collectMetaFiles, mntList, oop.HELPERS_PER_DOMAIN):
        if res is None:
            continue

        yield res
Example #3
0
def scanDomains(pattern="*"):
    log = logging.getLogger("scanDomains")

    mntList = getMountsList(pattern)

    def collectMetaFiles(possibleDomain):
        try:
            metaFiles = oop.getGlobalProcPool().glob.glob(
                os.path.join(possibleDomain, constants.UUID_GLOB_PATTERN,
                             sd.DOMAIN_META_DATA))

            for metaFile in metaFiles:
                if os.path.basename(
                        os.path.dirname(metaFile)) != sd.MASTER_FS_DIR:
                    sdUUID = os.path.basename(os.path.dirname(metaFile))

                    return (sdUUID, os.path.dirname(metaFile))

        except Timeout:
            pass
        except Exception:
            log.warn("Could not collect metadata file for domain path %s",
                     possibleDomain,
                     exc_info=True)

    for res in misc.itmap(collectMetaFiles, mntList):
        if res is None:
            continue

        yield res
Example #4
0
def scanDomains(pattern="*"):
    log = logging.getLogger("Storage.scanDomains")

    mntList = _getMountsList(pattern)

    def collectMetaFiles(possibleDomain):
        try:
            metaFiles = oop.getProcessPool(possibleDomain).glob.glob(
                os.path.join(possibleDomain, constants.UUID_GLOB_PATTERN,
                             sd.DOMAIN_META_DATA))

            for metaFile in metaFiles:
                if (os.path.basename(os.path.dirname(metaFile)) !=
                        sd.MASTER_FS_DIR):
                    sdUUID = os.path.basename(os.path.dirname(metaFile))

                    return (sdUUID, os.path.dirname(metaFile))

        except Timeout:
            log.warn("Metadata collection for domain path %s timedout",
                     possibleDomain,
                     exc_info=True)
        except Exception:
            log.warn("Could not collect metadata file for domain path %s",
                     possibleDomain,
                     exc_info=True)

    # Run collectMetaFiles in extenral processes.
    # The amount of processes that can be initiated in the same time is the
    # amount of stuck domains we are willing to handle +1.
    # We Use 30% of the available slots.
    # TODO: calculate it right, now we use same value of max process per
    #       domain.
    for res in misc.itmap(collectMetaFiles, mntList, oop.HELPERS_PER_DOMAIN):
        if res is None:
            continue

        yield res