Ejemplo n.º 1
0
import nfs4client
import sys
import os
import nfs4lib
from nfs4lib import use_obj, UnexpectedCompoundRes
import logging
import struct
from rpc.security import AuthSys, AuthGss
from threading import Lock
import nfs_ops
import random
from xdrdef.nfs4_type import channel_attrs4, callback_sec_parms4, GETFH4resok
from xdrdef.nfs4_const import *
from xdrdef.nfs4_pack import NFS4Unpacker

op = nfs_ops.NFS4ops()

log = logging.getLogger("test.env")


class AttrInfo(object):
    def __init__(self, name, access, sample):
        self.name = name
        self.bitnum = nfs4lib.attr2bitnum[name]
        self.mask = 2**self.bitnum
        self.access = access
        self.sample = sample

    def __str__(self):
        return '%s %i %s' % (self.name, self.bitnum, self.access)
Ejemplo n.º 2
0
import threading
import hmac
import inspect
from os.path import basename
from nfs4commoncode import CBCompoundState as CompoundState, \
     cb_encode_status as encode_status, \
     cb_encode_status_by_name as encode_status_by_name


import traceback
import logging
logging.basicConfig(level=logging.INFO,
                    format="%(levelname)-7s:%(name)s:%(message)s")
log_cb = logging.getLogger("nfs.client.cb")

op4 = nfs_ops.NFS4ops()

class NFS4Client(rpc.Client, rpc.Server):
    def __init__(self, host='localhost', port=2049, minorversion=1, ctrl_proc=16, summary=None):
        rpc.Client.__init__(self, 100003, 4)
        self.prog = 0x40000000
        self.versions = [1] # List of supported versions of prog

        self.minorversion = minorversion
        self.minor_versions = [minorversion]
        self.tag = "default tag"
        self.impl_id = nfs_impl_id4("citi.umich.edu", "pynfs X.X",
                                    nfs4lib.get_nfstime())
        self.verifier = struct.pack('>d', time.time())
        self.server_address = (host, port)
        self.c1 = self.connect(self.server_address)