Ejemplo n.º 1
0
    def __init__(self, opts, u_id, session=None):

        if not 'roots' in opts:
            opts['roots'] = []

        self._volumes = {}
        self._default = None
        self._loaded = False
        self._session = session
        self._time = time.time()
        self._debug = 'debug' in opts and opts['debug']
        self._uploadDebug = ''
        self._mountErrors = []
        self.u_id = u_id

        #TODO: Use signals instead of the original connector's binding mechanism

        #for root in self.getNetVolumes():
        #    opts['roots'].append(root)
        for o in opts['roots'][self.u_id]:
            try:
                volume = instantiate_driver(o)
            except Exception as e:
                self._mountErrors.append(e.__unicode__())
                continue

            id_ = volume.id()
            self._volumes[id_] = volume

            if not self._default and volume.is_readable():
                self._default = self._volumes[id_]

        self._loaded = (self._default is not None)
Ejemplo n.º 2
0
    def __init__(self, opts, session=None):

        if not 'roots' in opts:
            opts['roots'] = []

        self._volumes = {}
        self._default = None
        self._loaded = False
        self._session = session
        self._time = time.time()
        self._debug = 'debug' in opts and opts['debug']
        self._uploadDebug = ''
        self._mountErrors = []

        #TODO: Use signals instead of original connector's binding mechanism

        #for root in self.getNetVolumes():
        #    opts['roots'].append(root)

        for o in opts['roots']:

            try:
                volume = instantiate_driver(o)
            except Exception as e:
                self._mountErrors.append(e.__unicode__())
                continue

            id_ = volume.id()
            self._volumes[id_] = volume
            if not self._default and volume.is_readable():
                self._default = self._volumes[id_]

        self._loaded = (self._default is not None)