From 11b19a6d5428aeb4b649355bbb136b4bbf6678db Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 22 Feb 2021 18:05:26 +0100 Subject: [PATCH] nfs4-client: CompoundBuilder#withGetdeviceinfo should accept layout type if client supports multiple layout types, then we need a way to specify which one is needed. Acked-by: Paul Millar Target: master --- .../src/main/java/org/dcache/nfs/v4/client/Main.java | 4 ++-- .../main/java/org/dcache/nfs/v4/CompoundBuilder.java | 10 +++++----- .../org/dcache/nfs/v4/OperationGETDEVICEINFOTest.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/basic-client/src/main/java/org/dcache/nfs/v4/client/Main.java b/basic-client/src/main/java/org/dcache/nfs/v4/client/Main.java index 6ebaa9322..32681698e 100644 --- a/basic-client/src/main/java/org/dcache/nfs/v4/client/Main.java +++ b/basic-client/src/main/java/org/dcache/nfs/v4/client/Main.java @@ -1142,7 +1142,7 @@ private void get_deviceinfo(deviceid4 deviceId) throws OncRpcException, IOException { COMPOUND4args args = new CompoundBuilder() - .withGetdeviceinfo(deviceId) + .withGetdeviceinfo(deviceId, clientLayoutType) .withTag("get_deviceinfo") .build(); COMPOUND4res compound4res = sendCompoundInSession(args); @@ -1191,7 +1191,7 @@ private void get_devicelist() throws OncRpcException, IOException { COMPOUND4args args = new CompoundBuilder() .withPutfh(_rootFh) - .withGetdevicelist() + .withGetdevicelist(clientLayoutType) .withTag("get_devicelist") .build(); diff --git a/core/src/main/java/org/dcache/nfs/v4/CompoundBuilder.java b/core/src/main/java/org/dcache/nfs/v4/CompoundBuilder.java index dacf92673..fdc1f4a0e 100644 --- a/core/src/main/java/org/dcache/nfs/v4/CompoundBuilder.java +++ b/core/src/main/java/org/dcache/nfs/v4/CompoundBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton, + * Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton, * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY * * This library is free software; you can redistribute it and/or modify @@ -369,7 +369,7 @@ public CompoundBuilder withRead(int count, long offset, stateid4 stateid) { return this; } - public CompoundBuilder withGetdevicelist() { + public CompoundBuilder withGetdevicelist(layouttype4 layoutType) { nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_GETDEVICELIST; op.opgetdevicelist = new GETDEVICELIST4args(); @@ -379,19 +379,19 @@ public CompoundBuilder withGetdevicelist() { op.opgetdevicelist.gdla_cookieverf = new verifier4(); op.opgetdevicelist.gdla_cookieverf.value = new byte[nfs4_prot.NFS4_VERIFIER_SIZE]; - op.opgetdevicelist.gdla_layout_type = layouttype4.LAYOUT4_NFSV4_1_FILES.getValue(); + op.opgetdevicelist.gdla_layout_type = layoutType.getValue(); op.opgetdevicelist.gdla_maxdevices = new count4(256); ops.add(op); return this; } - public CompoundBuilder withGetdeviceinfo(deviceid4 devId) { + public CompoundBuilder withGetdeviceinfo(deviceid4 devId, layouttype4 layoutType) { nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_GETDEVICEINFO; op.opgetdeviceinfo = new GETDEVICEINFO4args(); op.opgetdeviceinfo.gdia_device_id = devId; - op.opgetdeviceinfo.gdia_layout_type = layouttype4.LAYOUT4_NFSV4_1_FILES.getValue(); + op.opgetdeviceinfo.gdia_layout_type = layoutType.getValue(); op.opgetdeviceinfo.gdia_maxcount = new count4(1024); op.opgetdeviceinfo.gdia_notify_types = new bitmap4(); diff --git a/core/src/test/java/org/dcache/nfs/v4/OperationGETDEVICEINFOTest.java b/core/src/test/java/org/dcache/nfs/v4/OperationGETDEVICEINFOTest.java index ad51f7845..cc2418da4 100644 --- a/core/src/test/java/org/dcache/nfs/v4/OperationGETDEVICEINFOTest.java +++ b/core/src/test/java/org/dcache/nfs/v4/OperationGETDEVICEINFOTest.java @@ -37,7 +37,7 @@ public void testNotificationBitmapSize() throws IOException, URISyntaxException .build(); COMPOUND4args gdiArgs = new CompoundBuilder() - .withGetdeviceinfo(new deviceid4(new byte[] {0x7})) + .withGetdeviceinfo(new deviceid4(new byte[] {0x7}), layouttype4.LAYOUT4_NFSV4_1_FILES) .build(); COMPOUND4res res = execute(context, gdiArgs);