def testValidDeleg(t, env): """REBOOT with read delegation and reclaim it FLAGS: reboot delegations DEPEND: MKFILE CODE: REBT8 """ from st_delegation import _get_deleg c = env.c1 id = 'pynfs%i_%s' % (os.getpid(), t.code) c.init_connection(id, cb_ident=0) deleg_info, fh, stateid = _get_deleg(t, c, c.homedir + [t.code], None, NFS4_OK) sleeptime = _waitForReboot(c, env) try: res = c.open_file(t.code, fh, claim_type=CLAIM_PREVIOUS, deleg_type=OPEN_DELEGATE_NONE) check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid") # res = c.compound([op.renew(c.clientid)]) # check(res, NFS4ERR_STALE_CLIENTID, "RENEW after reboot") c.init_connection(id, cb_ident=0) res = c.open_file(t.code, fh, claim_type=CLAIM_PREVIOUS, deleg_type=OPEN_DELEGATE_READ) check(res, msg="Reclaim using newly created clientid") deleg_info = res.resarray[-2].switch.switch.delegation if deleg_info.delegation_type != OPEN_DELEGATE_READ: t.fail("Could not reclaim read delegation") finally: env.sleep(sleeptime, "Waiting for grace period to end")
def testValidDeleg(t, env): """REBOOT with read delegation and reclaim it FLAGS: reboot delegations DEPEND: MKFILE CODE: REBT8 """ from st_delegation import _get_deleg c = env.c1 id = "pynfs%i_%s" % (os.getpid(), t.code) c.init_connection(id, cb_ident=0) deleg_info, fh, stateid = _get_deleg(t, c, c.homedir + [t.code], None, NFS4_OK) sleeptime = _waitForReboot(c, env) try: res = c.open_file(t.code, fh, claim_type=CLAIM_PREVIOUS, deleg_type=OPEN_DELEGATE_NONE) check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid") # res = c.compound([c.renew_op(c.clientid)]) # check(res, NFS4ERR_STALE_CLIENTID, "RENEW after reboot") c.init_connection(id, cb_ident=0) res = c.open_file(t.code, fh, claim_type=CLAIM_PREVIOUS, deleg_type=OPEN_DELEGATE_READ) check(res, msg="Reclaim using newly created clientid") deleg_info = res.resarray[-2].switch.switch.delegation if deleg_info.delegation_type != OPEN_DELEGATE_READ: t.fail("Could not reclaim read delegation") finally: env.sleep(sleeptime, "Waiting for grace period to end")