Example #1
0
 def truncate(self, fh, size):
     attr = type3.sattr3(mode=type3.set_mode3(False),
                         uid=type3.set_uid3(False),
                         gid=type3.set_gid3(False),
                         size=type3.set_size3(True, size),
                         atime=type3.set_atime(False),
                         mtime=type3.set_mtime(False))
     arg = op3.setattr(fh, attr, type3.sattrguard3(check=False))
     res = self._execute(const3.NFSPROC3_SETATTR, arg)
Example #2
0
 def truncate(self, fh, size):
     attr = type3.sattr3(mode=type3.set_mode3(False),
                         uid=type3.set_uid3(False),
                         gid=type3.set_gid3(False),
                         size=type3.set_size3(True, size),
                         atime=type3.set_atime(False),
                         mtime=type3.set_mtime(False))
     arg = op3.setattr(fh, attr, type3.sattrguard3(check=False))
     res = self._execute(const3.NFSPROC3_SETATTR, arg)
Example #3
0
    def open_file(self, mds_fh):
        name = self.fh_to_name(mds_fh)
        where = type3.diropargs3(self.rootfh, name)
        attr = type3.sattr3(mode=type3.set_mode3(True, 0777),
                            uid=type3.set_uid3(True, 0),
                            gid=type3.set_gid3(True, 0),
                            size=type3.set_size3(False),
                            atime=type3.set_atime(False),
                            mtime=type3.set_mtime(False))
        how = type3.createhow3(const3.GUARDED, attr)
        arg = op3.create(where, how)
        res = self._execute(const3.NFSPROC3_CREATE, arg,
                            exceptions=(const3.NFS3ERR_EXIST,))

        if res.status == const3.NFS3_OK:
            self.filehandles[mds_fh] = (res.resok.obj.handle, None)

        else:
            arg = op3.lookup(type3.diropargs3(self.rootfh, name))
            res = self._execute(const3.NFSPROC3_LOOKUP, arg)

            self.filehandles[mds_fh] = (res.resok.object, None)
Example #4
0
    def open_file(self, mds_fh):
        name = self.fh_to_name(mds_fh)
        where = type3.diropargs3(self.rootfh, name)
        attr = type3.sattr3(mode=type3.set_mode3(True, 0777),
                            uid=type3.set_uid3(True, 0),
                            gid=type3.set_gid3(True, 0),
                            size=type3.set_size3(False),
                            atime=type3.set_atime(False),
                            mtime=type3.set_mtime(False))
        how = type3.createhow3(const3.GUARDED, attr)
        arg = op3.create(where, how)
        res = self._execute(const3.NFSPROC3_CREATE,
                            arg,
                            exceptions=(const3.NFS3ERR_EXIST, ))

        if res.status == const3.NFS3_OK:
            self.filehandles[mds_fh] = (res.resok.obj.handle, None)

        else:
            arg = op3.lookup(type3.diropargs3(self.rootfh, name))
            res = self._execute(const3.NFSPROC3_LOOKUP, arg)

            self.filehandles[mds_fh] = (res.resok.object, None)