Esempio n. 1
0
        if options.verbose:
            print("Cleaning up %s" % work_dir)
        for b in bricks:
            subprocess.call(["umount", b.path])
        shutil.rmtree(work_dir)

    if not options.leave_mounted:
        atexit.register(cleanup_workdir)
    os.chdir(work_dir)

    # Mount each brick individually, so we can issue brick-specific calls.
    if options.verbose:
        print("Mounting subvolumes...")
    index = 0
    volfile_pipe = get_bricks(hostname, volname)
    all_xlators, last_xlator = volfilter.load(volfile_pipe)
    for dht_vol in all_xlators.itervalues():
        if dht_vol.type == "cluster/distribute":
            break
    else:
        print("no DHT volume found")
        sys.exit(1)
    for sv in dht_vol.subvols:
        #print "found subvol %s" % sv.name
        lpath = "%s/brick%s" % (work_dir, index)
        index += 1
        mount_brick(lpath, all_xlators, sv)
        bricks.append(Brick(lpath, sv.name))
    if index == 0:
        print("no bricks")
        sys.exit(1)
Esempio n. 2
0
                os.chdir(orig_dir)
                if options.verbose:
                        print("Cleaning up %s" % work_dir)
                for b in bricks:
                        subprocess.call(["umount", b.path])
                shutil.rmtree(work_dir)
        if not options.leave_mounted:
                atexit.register(cleanup_workdir)
        os.chdir(work_dir)

        # Mount each brick individually, so we can issue brick-specific calls.
        if options.verbose:
                print("Mounting subvolumes...")
        index = 0
        volfile_pipe = get_bricks(hostname, volname)
        all_xlators, last_xlator = volfilter.load(volfile_pipe)
        for dht_vol in all_xlators.itervalues():
                if dht_vol.type == "cluster/distribute":
                        break
        else:
                print("no DHT volume found")
                sys.exit(1)
        for sv in dht_vol.subvols:
                #print "found subvol %s" % sv.name
                lpath = "%s/brick%s" % (work_dir, index)
                index += 1
                mount_brick(lpath, all_xlators, sv)
                bricks.append(Brick(lpath, sv.name))
        if index == 0:
                print("no bricks")
                sys.exit(1)