Exemplo n.º 1
0
def main():
    options = parse_args(sys.argv[1:])
    init_logging(options.debug)
    operations = Operations(options.source)

    log.debug("Mounting...")
    fuse_options = set(llfuse.default_options)
    fuse_options.add("fsname=passthroughfs")
    fuse_options.add("default_permissions")
    if options.debug_fuse:
        fuse_options.add("debug")
    llfuse.init(operations, options.mountpoint, fuse_options)

    try:
        log.debug("Entering main loop..")
        if options.single:
            llfuse.main(workers=1)
        else:
            llfuse.main()
    except:
        llfuse.close(unmount=False)
        raise

    log.debug("Unmounting..")
    llfuse.close()
Exemplo n.º 2
0
def mount(operations, mountpoint, options=None, *,
          override_default_options=False, workers=30):
    """Mount a file system.

    Args
    ----
    operations: `~.Operations`
        The operations handler for the file system.
    mountpoint: str
        The directory on which the file system should be mounted.
    options: set
        A set of options that should be used when mounting.
    override_default_options: bool
        If this is set to `True` only the supplied options will be used.
        Otherwise the options will be added to the defaults. The defaults are
        the defaults supplied by `llfuse.default_options`.
    workers: int
        The amount of worker threads that should be spawned to handle the file
        operations.
    """

    operations.mountpoint = os.path.abspath(mountpoint)

    if options is None:
        options = llfuse.default_options
    elif not override_default_options:
        options |= llfuse.default_options

    llfuse.init(operations, mountpoint, options)

    try:
        llfuse.main(workers=workers)
    finally:
        llfuse.close()
Exemplo n.º 3
0
 def _llfuse_main(self):
     try:
         llfuse.main()
     except:
         llfuse.close(unmount=False)
         raise
     llfuse.close()
Exemplo n.º 4
0
def main():
    parser = create_parser()
    args = parser.parse_args()

    if args.verbose:
        level = logging.DEBUG
    else:
        level = logging.INFO
    logging.basicConfig(
        stream=sys.stdout, level=level,
        format="%(asctime)s %(levelname)s %(threadName)s "
        "%(filename)s:%(lineno)d %(message)s")

    backend = configure_backend(parser, args)
    root = configure_root(parser, args, backend)
    fs = yatfs_fs.Filesystem(backend, root)
    ops = yatfs_fs.Operations(fs)
    fuse_options = configure_fuse_options(args)

    llfuse.init(ops, args.mountpoint, fuse_options)

    try:
        llfuse.main(workers=args.num_workers)
    finally:
        llfuse.close()
Exemplo n.º 5
0
def main():

    remotefs = RemoteMount(options.base_url, options.block_size)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('name=Tiler.filesystem')
    llfuse.main(workers=1)
    llfuse.close()
Exemplo n.º 6
0
def main():
    options = parse_args(sys.argv[1:])
    init_logging(options.debug)
    operations = Operations(options.source, {
        "jquery.min.js": b"/usr/share/javascript/jquery/jquery.min.js"
    })

    log.debug('Mounting...')
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=passthroughfs')
    fuse_options.add('default_permissions')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(operations, options.mountpoint, fuse_options)

    try:
        log.debug('Entering main loop..')
        if options.single:
            llfuse.main(workers=1)
        else:
            llfuse.main()
    except:
        llfuse.close(unmount=False)
        raise

    log.debug('Unmounting..')
    llfuse.close()
Exemplo n.º 7
0
def main():
    options = parse_args()
    sys.stderr.write('\n' * ddrescue_pollution)
    sys.stderr.flush()
    term_up = '\x1B[A'
    clear_to_eol = '\x1B[K'
    logging.basicConfig(
        format='\r' + (term_up * ddrescue_pollution) +
        '%(asctime)-23s %(levelname)-7s %(name)s: %(message)s' + clear_to_eol +
        ('\n' * ddrescue_pollution))
    if options.debug:
        logging.getLogger().setLevel(logging.DEBUG)
        logging.getLogger().debug('Debug logging enabled')
    else:
        logging.getLogger().setLevel(logging.INFO)

    fs = DDRescueFS(options)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=ddrescuefs')
    if options.debug_fuse:
        fuse_options.add('debug')

    llfuse.init(fs, options.mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    except:
        llfuse.close(unmount=False)
        raise

    llfuse.close()
Exemplo n.º 8
0
def mount(mountpoint, file_mappings, background=True):
	server = DXFuse(file_mappings)
	llfuse.init(server, mountpoint, [ b'fsname=dxfuse', b'subtype=dnanexus', b'ro' ])
	if background:
		daemonize('/')
	llfuse.main()
	llfuse.close()
Exemplo n.º 9
0
def main():
    options = parse_args(sys.argv[1:])
    init_logging(options.debug)
    operations = Operations(options.source)

    log.debug('Mounting...')
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=passthroughfs')
    fuse_options.add('default_permissions')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(operations, options.mountpoint, fuse_options)

    try:
        log.debug('Entering main loop..')
        if options.single:
            llfuse.main(workers=1)
        else:
            llfuse.main()
    except:
        llfuse.close(unmount=False)
        raise

    log.debug('Unmounting..')
    llfuse.close()
Exemplo n.º 10
0
 def _llfuse_main(self):
     try:
         llfuse.main()
     except:
         llfuse.close(unmount=False)
         raise
     llfuse.close()
Exemplo n.º 11
0
def run_fuse_mount(ops, options, mount_opts):
    mount_opts = ['fsname=gridfs_fuse'] + mount_opts
    llfuse.init(ops, options.mount_point, mount_opts)

    try:
        llfuse.main(single=True)
    finally:
        llfuse.close()
Exemplo n.º 12
0
def run_fuse_mount(ops, options, mount_opts):
    mount_opts = ['fsname=gridfs_fuse'] + mount_opts
    llfuse.init(ops, options.mount_point, mount_opts)

    try:
        llfuse.main(single=True)
    finally:
        llfuse.close()
Exemplo n.º 13
0
def mount(mountpoint, file_mappings, background=True):
    server = DXFuse(file_mappings)
    llfuse.init(server, mountpoint,
                [b'fsname=dxfuse', b'subtype=dnanexus', b'ro'])
    if background:
        daemonize('/')
    llfuse.main()
    llfuse.close()
Exemplo n.º 14
0
Arquivo: fs.py Projeto: NaPs/Marty
 def _llfuse_worker(self, fs, mountpoint, init_event):
     fuse_options = set(llfuse.default_options)
     fuse_options.add('fsname=marty')
     llfuse.init(fs, mountpoint, fuse_options)
     init_event.set()
     try:
         llfuse.main(workers=1)
     finally:
         llfuse.close()
Exemplo n.º 15
0
     def mainloop():
         ''' Worker main loop to run the filesystem then tidy up.
 '''
         with stackattrs(defaults, fs=fs):
             with S:
                 with defaults.common_S(S):
                     llfuse.main(workers=32)
                     llfuse.close()
         S.close()
Exemplo n.º 16
0
def run_fs(mountpoint, cross_process):
    testfs = Fs(cross_process)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=llfuse_testfs')
    llfuse.init(testfs, mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    finally:
        llfuse.close()
Exemplo n.º 17
0
 def _llfuse_worker(self, fs, mountpoint, init_event):
     fuse_options = set(llfuse.default_options)
     fuse_options.add('fsname=marty')
     llfuse.init(fs, mountpoint, fuse_options)
     init_event.set()
     try:
         llfuse.main(workers=1)
     finally:
         llfuse.close()
Exemplo n.º 18
0
def main(scanner):
    if scanner:
        scanner.start()

    try:
        llfuse.main()
    except Exception:
        log.exception("Error in FuseFS")
    finally:
        llfuse.close()
Exemplo n.º 19
0
 def mount(self, mountpoint, extra_options, foreground=False):
     options = ['fsname=borgfs', 'ro']
     if extra_options:
         options.extend(extra_options.split(','))
     llfuse.init(self, mountpoint, options)
     if not foreground:
         daemonize()
     try:
         llfuse.main(single=True)
     finally:
         llfuse.close()
Exemplo n.º 20
0
Arquivo: fuse.py Projeto: Herover/borg
 def mount(self, mountpoint, extra_options, foreground=False):
     options = ['fsname=borgfs', 'ro']
     if extra_options:
         options.extend(extra_options.split(','))
     llfuse.init(self, mountpoint, options)
     if not foreground:
         daemonize()
     try:
         llfuse.main(single=True)
     finally:
         llfuse.close()
 def __init__(self, rootpath):
     MOUNT_POINT = "/tmp/mountpoint"
     ops = FuseOperations(rootpath)
     fuse_options = set(llfuse.default_options)
     fuse_options.add("fsname=testfs")
     fuse_options.discard("default_permissions")
     j.sal.fs.createDir(MOUNT_POINT)
     llfuse.init(ops, MOUNT_POINT, fuse_options)
     try:
         llfuse.main(workers=1)
     except BaseException:
         llfuse.close(unmount=False)
         raise
     llfuse.close()
Exemplo n.º 22
0
    def run(self, debug=False):
        # Setup our fuse interaction, but don't process requests yet.
        opts = ['fsname=thingfs', 'nonempty']
        if debug:
            opts.append('debug')
        llfuse.init(self, self.mount_path, opts)
        self.ready_ = True

        try:
            llfuse.main(workers=1)
        except:
            llfuse.close(unmount=False)
            raise

        llfuse.close()
Exemplo n.º 23
0
    def mount(self, log=True):
        self.init_logging(log)

        fs = zfsfuse(self.dataset)
        fuse_options = set(llfuse.default_options)
        fuse_options.add('fsname=zfsrescue')
        #fuse_options.add('debug')
        llfuse.init(fs, self.mountpoint, fuse_options)
        try:
            llfuse.main(workers=1)
        except Exception as e:
            print(str(e))
            llfuse.close(unmount=False)
            raise e
        llfuse.close()
Exemplo n.º 24
0
def main():
    options = parse_args()
    init_logging(options.debug)

    testfs = TestFs()
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=lltest')
    llfuse.init(testfs, options.mountpoint, fuse_options)
    try:
        llfuse.main(single=True)
    except:
        llfuse.close(unmount=False)
        raise

    llfuse.close()
Exemplo n.º 25
0
Arquivo: lisk.py Projeto: kuxi/lisk
def run():
    fs = Lisk()
    fw = FileWorker()
    llfuse.init(fs, "/home/heidar/fs", [b"fsname=lisk", b"nonempty"])
    print "here"
    print llfuse.ROOT_INODE

    fw.start()
    try:
        llfuse.main(single=True)
    except:
        llfuse.close()
        raise

    llfuse.close()
Exemplo n.º 26
0
    def runTest(self):
        # Create the request handler
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(
            fuse.MagicDirectory(llfuse.ROOT_INODE, operations.inodes))

        self.mounttmp = tempfile.mkdtemp()

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        # now check some stuff
        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual(d1, [])

        d2 = os.listdir(os.path.join(self.mounttmp, self.testcollection))
        d2.sort()
        self.assertEqual(d2, ['thing1.txt'])

        d3 = os.listdir(self.mounttmp)
        d3.sort()
        self.assertEqual(d3, [self.testcollection])

        files = {}
        files[os.path.join(self.mounttmp, self.testcollection,
                           'thing1.txt')] = 'data 1'

        for k, v in files.items():
            with open(os.path.join(self.mounttmp, k)) as f:
                self.assertEqual(f.read(), v)
Exemplo n.º 27
0
    def runTest(self):
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(
            fuse.ProjectDirectory(llfuse.ROOT_INODE, operations.inodes,
                                  self.api, 0,
                                  self.api.users().current().execute()))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertIn('Unrestricted public data', d1)

        d2 = os.listdir(os.path.join(self.mounttmp,
                                     'Unrestricted public data'))
        d2.sort()
        self.assertEqual(['GNU General Public License, version 3'], d2)

        d3 = os.listdir(
            os.path.join(self.mounttmp, 'Unrestricted public data',
                         'GNU General Public License, version 3'))
        d3.sort()
        self.assertEqual(["GNU_General_Public_License,_version_3.pdf"], d3)
Exemplo n.º 28
0
    def runTest(self):
        # Create the request handler
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.MagicDirectory(llfuse.ROOT_INODE, operations.inodes))

        self.mounttmp = tempfile.mkdtemp()

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        # now check some stuff
        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual([], d1)

        d2 = os.listdir(os.path.join(self.mounttmp, self.testcollection))
        d2.sort()
        self.assertEqual(['thing1.txt'], d2)

        d3 = os.listdir(self.mounttmp)
        d3.sort()
        self.assertEqual([self.testcollection], d3)

        files = {}
        files[os.path.join(self.mounttmp, self.testcollection, 'thing1.txt')] = 'data 1'

        for k, v in files.items():
            with open(os.path.join(self.mounttmp, k)) as f:
                self.assertEqual(v, f.read())
Exemplo n.º 29
0
    def runTest(self):
        run_test_server.authorize_with("admin")
        api = arvados.api('v1', cache=False)

        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, api))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual(['foo_tag'], d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'foo_tag'))
        d2.sort()
        self.assertEqual(['1f4b0bc7583c2a7f9102c395f4ffc5e3+45'], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'foo_tag', '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'))
        d3.sort()
        self.assertEqual(['foo'], d3)

        files = {}
        files[os.path.join(self.mounttmp, 'foo_tag', '1f4b0bc7583c2a7f9102c395f4ffc5e3+45', 'foo')] = 'foo'

        for k, v in files.items():
            with open(os.path.join(self.mounttmp, k)) as f:
                self.assertEqual(v, f.read())
Exemplo n.º 30
0
    def runTest(self):
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(
            fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, self.api,
                               0))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual(['foo_tag'], d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'foo_tag'))
        d2.sort()
        self.assertEqual(['zzzzz-4zz18-fy296fx3hot09f7'], d2)

        d3 = os.listdir(
            os.path.join(self.mounttmp, 'foo_tag',
                         'zzzzz-4zz18-fy296fx3hot09f7'))
        d3.sort()
        self.assertEqual(['foo'], d3)
Exemplo n.º 31
0
def main():
    options = parse_args()
    init_logging(options.debug)

    testfs = JsonSysClassFS(TestJscfsMethods.test_json_str)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=jscfs')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(testfs, options.mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    except:
        llfuse.close(unmount=False)
        raise

    llfuse.close()
Exemplo n.º 32
0
	def mount(self,stream,mountpt,foreground=False,debug=False):
		mountpt = os.path.abspath(mountpt)
		ops     = Operations(stream,self)
		args    = ['fsname=u4pak', 'subtype=u4pak', 'ro']

		if debug:
			foreground = True
			args.append('debug')

		if not foreground:
			deamonize()

		llfuse.init(ops, mountpt, args)
		try:
			llfuse.main(single=False)
		finally:
			llfuse.close()
Exemplo n.º 33
0
def main():
    options = parse_args()
    init_logging(options.debug)

    remotefs = RemoteFileFS(options.base_url, options.block_size)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=Tiler.filesystem')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(remotefs, options.mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    except:
        llfuse.close(unmount=False)
        raise

    llfuse.close()
Exemplo n.º 34
0
	def mount(self,stream,mountpt,foreground=False,debug=False):
		mountpt = os.path.abspath(mountpt)
		ops     = Operations(stream,self)
		args    = ['fsname=u4pak', 'subtype=u4pak', 'ro']

		if debug:
			foreground = True
			args.append('debug')

		if not foreground:
			deamonize()

		llfuse.init(ops, mountpt, args)
		try:
			llfuse.main()
		finally:
			llfuse.close()
Exemplo n.º 35
0
def main():
    options = parse_args()
    init_logging(options.debug)

    testfs = TestFs()
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=lltest')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(testfs, options.mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    except:
        llfuse.close(unmount=False)
        raise

    llfuse.close()
Exemplo n.º 36
0
def main():
    global deley_time
    options = parse_args(sys.argv[1:])
    init_logging(options.debug)
    print("\nMounting Image {} -to-> {} and version period is {}..\n".format(
        options.image, options.mountpoint, options.time))
    file = open(options.image, "rb")
    try:
        loaded_data = pickle.load(file)
        try:
            inodestruct.r_inode = loaded_data[0]
            pp.pprint(inodestruct.r_inode.slot)
        except:
            print("fail to load inodestruct.r_inode")
        try:
            inodestruct.datablockT = loaded_data[1]
            pp.pprint(inodestruct.datablockT.slot)
        except:
            print("fail to load inodestruct.datablockT")
    except:
        print("empty image")
    file.close()
    deley_time = int(options.time)
    print(deley_time)
    testfs = Vcowfs()
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=vcowfs')
    fuse_options.discard('default_permissions')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(testfs, options.mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    except:
        llfuse.close(unmount=False)
        raise

    file = open(options.image, "wb")
    print("Saving Complete XD XD XD XD XD XD")
    print(inodestruct.r_inode)
    print(inodestruct.datablockT)
    pickler = pickle.Pickler(file, -1)
    pickler.dump([inodestruct.r_inode, inodestruct.datablockT])
    file.close()
    llfuse.close()
Exemplo n.º 37
0
def main():    
    options = parse_args(sys.argv[1:])
    init_logging(options.debug)
    operations = Operations(options.source)
    
    log.debug('Mounting...')
    llfuse.init(operations, options.mountpoint, 
                [  b'fsname=passthroughfs', b"nonempty" ])
    
    try:
        log.debug('Entering main loop..')
        llfuse.main(options.single)
    except:
        llfuse.close(unmount=False)
        raise

    log.debug('Unmounting..')
    llfuse.close()
Exemplo n.º 38
0
def main():
    parser = ArgumentParser()
    parser.add_argument('mountpoint', type=str,
                        help='Where to mount the file system')
    parser.add_argument('token', type=str,
                        help='Token of dropbox app')
    parser.add_argument('--debug', action='store_true', default=False,
                        help='Enable debugging output')
    parser.add_argument('--debug-fuse', action='store_true', default=False,
                        help='Enable FUSE debugging output')
    parser.add_argument('--tmpdir', type=str, default='/tmp/fusedive',
                        help='Temporary local path')
    options = parser.parse_args()

    subprocess.Popen(('mkdir -p %s' % (options.tmpdir)).split())

    init_logging(options.debug)

    pros = {
            'http':     "socks5://127.0.0.1:1080",
            'https':    "socks5://127.0.0.1:1080"
            }
    sess = dropbox.create_session(max_connections=3, proxies=pros)
    dbx = dropbox.Dropbox(options.token, session=sess)
    operations = DropboxOperations(dbx, options.tmpdir)
    
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=dropboxfs')
    fuse_options.discard('default_permissions')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(operations, options.mountpoint, fuse_options)

    # sqlite3 does not support multithreading
    try:
        llfuse.main(workers=1)
    except:
        subprocess.Popen(('rm -rf %s' % (options.tmpdir)).split())
        llfuse.close()
        raise

    subprocess.Popen(('rm -rf %s' % (options.tmpdir)).split())
    llfuse.close()
Exemplo n.º 39
0
	def mount(archive,mountpt,ext_func=lambda data,offset,size:'',foreground=False,debug=False):
		archive = os.path.abspath(archive)
		mountpt = os.path.abspath(mountpt)
		with open(archive,"rb") as fp:
			ops = Operations(fp,ext_func)
			args = ['fsname=fezpak', 'subtype=fezpak', 'ro']

			if debug:
				foreground = True
				args.append('debug')

			if not foreground:
				deamonize()

			llfuse.init(ops, mountpt, args)
			try:
				llfuse.main()
			finally:
				llfuse.close()
Exemplo n.º 40
0
    def mount(archive, mountpt, foreground=False, debug=False):
        archive = os.path.abspath(archive)
        mountpt = os.path.abspath(mountpt)
        with open(archive, "rb") as fp:
            ops = Operations(fp)
            args = ['fsname=bf64', 'subtype=bf64', 'ro']

            if debug:
                foreground = True
                args.append('debug')

            if not foreground:
                deamonize()

            llfuse.init(ops, mountpt, args)
            try:
                llfuse.main()
            finally:
                llfuse.close()
Exemplo n.º 41
0
    def mount(archive, mountpt, foreground=False, debug=False):
        archive = os.path.abspath(archive)
        mountpt = os.path.abspath(mountpt)
        with open(archive, "rb") as fp:
            ops = Operations(fp)
            args = ['fsname=psypkg', 'subtype=psypkg', 'ro']

            if debug:
                foreground = True
                args.append('debug')

            if not foreground:
                deamonize()

            llfuse.init(ops, mountpt, args)
            try:
                llfuse.main(single=False)
            finally:
                llfuse.close()
Exemplo n.º 42
0
def main():
    ops = TestOperations()
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=test_fs')
    fuse_options.discard('nonempty')
    fuse_options.add('max_read=60000')
    # fuse_options.add('debug')
    llfuse.init(ops, MOUNTPOINT, fuse_options)
    r = llfuse.main()
    if r is None:
        llfuse.close()
Exemplo n.º 43
0
def main():
    options = parse_args(sys.argv[1:])
    init_logging(options.debug)
    operations = Operations(options.source)

    log.debug('Mounting...')
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=passthroughfs')
    fuse_options.add('default_permissions')
    llfuse.init(operations, options.mountpoint, fuse_options)

    try:
        log.debug('Entering main loop..')
        llfuse.main(options.single)
    except:
        llfuse.close(unmount=False)
        raise

    log.debug('Unmounting..')
    llfuse.close()
Exemplo n.º 44
0
    def main(self):

        self.preInit()
        self._checkNotUnmounted()

        self.setupSignals()

        error = False
        ex = None
        try:
            fuse.init(self.operations, self.mountpoint, self._opts)
            fuse.main(single=True)
        except Exception as e:
            error = True
            ex = e
            self.getLogger().error(traceback.format_exc())

        self.onSignalUmount(error=error)
        if ex:
            raise ex
Exemplo n.º 45
0
    def main(self):

        self.preInit()
        self._checkNotUnmounted()

        self.setupSignals()

        error = False
        ex = None
        try:
            fuse.init(self.operations, self.mountpoint, self._opts)
            fuse.main(single=True)
        except Exception as e:
            error = True
            ex = e
            self.getLogger().error(traceback.format_exc())

        self.onSignalUmount(error=error)
        if ex:
            raise ex
Exemplo n.º 46
0
def main():
  """
  """
  options = parse_args()
  init_logging(options.debug)

  mpath = getmount_point(options)
  tarfs = TarFS(options.tarfile)
  fuse_options = set(llfuse.default_options)
  fuse_options.add('fsname=fuse_tar')
  fuse_options.add('ro')
  if options.debug_fuse:
    fuse_options.add('debug')
  llfuse.init(tarfs, mpath, fuse_options)
  try:
    llfuse.main()
  except:
    llfuse.close(unmount=False)
    raise

  llfuse.close()
Exemplo n.º 47
0
    def runRealTest(self):
        run_test_server.authorize_with("admin")
        api = arvados.api('v1', cache=False)

        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, api, poll_time=1))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual(['foo_tag'], d1)

        api.links().create(body={'link': {
            'head_uuid': 'fa7aeb5140e2848d39b416daeef4ffc5+45',
            'link_class': 'tag',
            'name': 'bar_tag'
        }}).execute()

        time.sleep(1)

        d2 = os.listdir(self.mounttmp)
        d2.sort()
        self.assertEqual(['bar_tag', 'foo_tag'], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'bar_tag'))
        d3.sort()
        self.assertEqual(['fa7aeb5140e2848d39b416daeef4ffc5+45'], d3)

        l = api.links().create(body={'link': {
            'head_uuid': 'ea10d51bcf88862dbcc36eb292017dfd+45',
            'link_class': 'tag',
            'name': 'bar_tag'
        }}).execute()

        time.sleep(1)

        d4 = os.listdir(os.path.join(self.mounttmp, 'bar_tag'))
        d4.sort()
        self.assertEqual(['ea10d51bcf88862dbcc36eb292017dfd+45', 'fa7aeb5140e2848d39b416daeef4ffc5+45'], d4)

        api.links().delete(uuid=l['uuid']).execute()

        time.sleep(1)

        d5 = os.listdir(os.path.join(self.mounttmp, 'bar_tag'))
        d5.sort()
        self.assertEqual(['fa7aeb5140e2848d39b416daeef4ffc5+45'], d5)
Exemplo n.º 48
0
def run_fs(mountpoint, cross_process):
    # Logging (note that we run in a new process, so we can't
    # rely on direct log capture and instead print to stdout)
    root_logger = logging.getLogger()
    formatter = logging.Formatter('%(asctime)s.%(msecs)03d %(levelname)s '
                                  '%(funcName)s(%(threadName)s): %(message)s',
                                   datefmt="%M:%S")
    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    handler.setFormatter(formatter)
    root_logger.addHandler(handler)
    root_logger.setLevel(logging.DEBUG)

    testfs = Fs(cross_process)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=llfuse_testfs')
    llfuse.init(testfs, mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    finally:
        llfuse.close()
Exemplo n.º 49
0
def main(args):
    options = parse_args(args)
    init_logging(options.debug)
    operations = Operations(options.lsfile, options.mountpoint)
    log.debug('Mounting...')
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=phantomfs')
    if options.debug_fuse:
        fuse_options.add('debug')
    llfuse.init(operations, options.mountpoint, fuse_options)
    try:
        log.debug('Entering main loop..')
        if options.single:
            llfuse.main(workers=1)
        else:
            llfuse.main()
    except:
        llfuse.close()
        raise
    log.debug('Unmounting..')
    llfuse.close()
Exemplo n.º 50
0
def main() -> None:# {{{
  """
  main function
  """
  options = parseargs()
  init_logging(options.debug)

  mpath: str = getmount_point(options)
  tarfs = TarFS(options.tarfile)
  fuse_options = set(llfuse.default_options)
  fuse_options.add('fsname=fuse_tar')
  fuse_options.add('ro')
  if options.debug_fuse:
    fuse_options.add('debug')
  llfuse.init(tarfs, mpath, fuse_options)
  try:
    llfuse.main()
  except Exception as exc:
    llfuse.close(unmount=False)
    raise exc

  llfuse.close()
Exemplo n.º 51
0
def run_fs(mountpoint, cross_process):
    # Logging (note that we run in a new process, so we can't
    # rely on direct log capture and instead print to stdout)
    root_logger = logging.getLogger()
    formatter = logging.Formatter(
        '%(asctime)s.%(msecs)03d %(levelname)s '
        '%(funcName)s(%(threadName)s): %(message)s',
        datefmt="%M:%S")
    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    handler.setFormatter(formatter)
    root_logger.addHandler(handler)
    root_logger.setLevel(logging.DEBUG)

    testfs = Fs(cross_process)
    fuse_options = set(llfuse.default_options)
    fuse_options.add('fsname=llfuse_testfs')
    llfuse.init(testfs, mountpoint, fuse_options)
    try:
        llfuse.main(workers=1)
    finally:
        llfuse.close()
Exemplo n.º 52
0
    def runTest(self):
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.SharedDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0, self.api.users().current().execute()['uuid']))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertIn('Active User', d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'Active User'))
        d2.sort()
        self.assertEqual(['A Project',
                          "Empty collection",
                          "Empty collection.link",
                          "Pipeline Template with Input Parameter with Search.pipelineTemplate",
                          "Pipeline Template with Jobspec Components.pipelineTemplate",
                          "collection_expires_in_future",
                          "collection_with_same_name_in_aproject_and_home_project",
                          "owned_by_active",
                          "pipeline_to_merge_params.pipelineInstance",
                          "pipeline_with_job.pipelineInstance",
                          "pipeline_with_tagged_collection_input.pipelineInstance",
                          "real_log_collection"
                      ], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'Active User', 'A Project'))
        d3.sort()
        self.assertEqual(["A Subproject",
                          "Two Part Pipeline Template.pipelineTemplate",
                          "collection_to_move_around",
                          "collection_with_same_name_in_aproject_and_home_project",
                          "zzzzz-4zz18-fy296fx3hot09f7 added sometime"
                      ], d3)

        with open(os.path.join(self.mounttmp, 'Active User', "A Project", "Two Part Pipeline Template.pipelineTemplate")) as f:
            j = json.load(f)
            self.assertEqual("Two Part Pipeline Template", j['name'])
Exemplo n.º 53
0
    def runTest(self):
        # Create the request handler
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.CollectionDirectory(llfuse.ROOT_INODE, operations.inodes, self.testcollection))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        # now check some stuff
        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual(['dir1', 'dir2', 'thing1.txt', 'thing2.txt'], d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'dir1'))
        d2.sort()
        self.assertEqual(['thing3.txt', 'thing4.txt'], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'dir2'))
        d3.sort()
        self.assertEqual(['dir3', 'thing5.txt', 'thing6.txt'], d3)

        d4 = os.listdir(os.path.join(self.mounttmp, 'dir2/dir3'))
        d4.sort()
        self.assertEqual(['thing7.txt', 'thing8.txt'], d4)

        files = {'thing1.txt': 'data 1',
                 'thing2.txt': 'data 2',
                 'dir1/thing3.txt': 'data 3',
                 'dir1/thing4.txt': 'data 4',
                 'dir2/thing5.txt': 'data 5',
                 'dir2/thing6.txt': 'data 6',
                 'dir2/dir3/thing7.txt': 'data 7',
                 'dir2/dir3/thing8.txt': 'data 8'}

        for k, v in files.items():
            with open(os.path.join(self.mounttmp, k)) as f:
                self.assertEqual(v, f.read())
Exemplo n.º 54
0
    def runTest(self):
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.ProjectDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0, self.api.users().current().execute()))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertIn('Unrestricted public data', d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'Unrestricted public data'))
        d2.sort()
        self.assertEqual(['GNU General Public License, version 3'], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'Unrestricted public data', 'GNU General Public License, version 3'))
        d3.sort()
        self.assertEqual(["GNU_General_Public_License,_version_3.pdf"], d3)
Exemplo n.º 55
0
    def runTest(self):
        run_test_server.authorize_with("admin")
        api = arvados.api('v1', cache=False)

        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.GroupsDirectory(llfuse.ROOT_INODE, operations.inodes, api))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertIn('zzzzz-j7d0g-v955i6s2oi1cbso', d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'zzzzz-j7d0g-v955i6s2oi1cbso'))
        d2.sort()
        self.assertEqual(['1f4b0bc7583c2a7f9102c395f4ffc5e3+45 added sometime',
                          "I'm a job in a project",
                          "I'm a template in a project",
                          "zzzzz-j58dm-5gid26432uujf79",
                          "zzzzz-j58dm-7r18rnd5nzhg5yk",
                          "zzzzz-j58dm-ypsjlol9dofwijz",
                          "zzzzz-j7d0g-axqo7eu9pwvna1x"
                      ], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'zzzzz-j7d0g-v955i6s2oi1cbso', 'zzzzz-j7d0g-axqo7eu9pwvna1x'))
        d3.sort()
        self.assertEqual(["I'm in a subproject, too",
                          "ea10d51bcf88862dbcc36eb292017dfd+45 added sometime",
                          "zzzzz-j58dm-c40lddwcqqr1ffs"
                      ], d3)

        with open(os.path.join(self.mounttmp, 'zzzzz-j7d0g-v955i6s2oi1cbso', "I'm a template in a project")) as f:
            j = json.load(f)
            self.assertEqual("Two Part Pipeline Template", j['name'])
Exemplo n.º 56
0
    def runTest(self):
        operations = fuse.Operations(os.getuid(), os.getgid())
        e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0))

        llfuse.init(operations, self.mounttmp, [])
        t = threading.Thread(None, lambda: llfuse.main())
        t.start()

        # wait until the driver is finished initializing
        operations.initlock.wait()

        d1 = os.listdir(self.mounttmp)
        d1.sort()
        self.assertEqual(['foo_tag'], d1)

        d2 = os.listdir(os.path.join(self.mounttmp, 'foo_tag'))
        d2.sort()
        self.assertEqual(['zzzzz-4zz18-fy296fx3hot09f7'], d2)

        d3 = os.listdir(os.path.join(self.mounttmp, 'foo_tag', 'zzzzz-4zz18-fy296fx3hot09f7'))
        d3.sort()
        self.assertEqual(['foo'], d3)
Exemplo n.º 57
0
        st.st_ctime = st.st_atime
        st.st_uid = 1000
        st.st_gid = 1000
        st.st_rdev = 0
        st.st_size = 0
        st.st_blksize = 512
        st.st_blocks = 1    
        return st

    def readdir(self, path, offset=0):
        if path == ".":
            bucket = self.swift_conn.get_account()[1][offset]
            yield (bucket['name'], self.getattr(bucket['name']), int(offset + 1))

def init_logging():
    formatter = logging.Formatter('%(message)s') 
    handler = logging.StreamHandler()
    handler.setFormatter(formatter)
    handler.setLevel(logging.INFO)
    log.setLevel(logging.INFO)    
    log.addHandler(handler)    

if __name__ == '__main__':  
    init_logging()
    sf = swiftfuse()
    mountpoint = sys.argv[1]

    llfuse.init(sf, mountpoint, [])
    llfuse.main(single=True)

    llfuse.close()
Exemplo n.º 58
0
            inode = Inode.from_blob(oid, blob)

            inode.write(offset, data)

            try:
                self.rc.update(self.inodes_table, oid, serialize(inode),
                               version)
            except ramcloud.NoObjectError:
                # TODO: should this be silent or throw another type of error?
                raise llfuse.FUSEError(errno.EIO)
            except ramcloud.VersionError:
                retry.later()

        return len(data)


if __name__ == '__main__':

    if FUSE_DEBUG:
        console = logging.StreamHandler()
        console.setLevel(logging.DEBUG)

        fuse_log = logging.getLogger("fuse")
        fuse_log.setLevel(logging.DEBUG)
        fuse_log.addHandler(console)

    mountpoint, args = sys.argv[1], sys.argv[2:]
    llfuse.init(Operations(), mountpoint, args)

    llfuse.main()
Exemplo n.º 59
0
 def fuse_main():
     llfuse.main(single=True)
     return None
Exemplo n.º 60
0
 def fuse_main():
     return llfuse.main(workers=1)