rpcctl - fix failure when setting xprt offline and online (bz 2081934)

Signed-off-by: Steve Dickson <steved@redhat.com>
Resolves: bz2081934
This commit is contained in:
Steve Dickson 2022-07-22 12:23:42 -04:00
parent 1d262326db
commit 04506e2d25
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,36 @@
diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py
index b8df556b..d2110ad6 100755
--- a/tools/rpcctl/rpcctl.py
+++ b/tools/rpcctl/rpcctl.py
@@ -90,10 +90,18 @@ class Xprt:
self.dstaddr = write_addr_file(self.path / "dstaddr", newaddr)
def set_state(self, state):
+ if self.info.get("main_xprt"):
+ raise Exception(f"Main xprts cannot be set {state}")
with open(self.path / "xprt_state", 'w') as f:
f.write(state)
self.read_state()
+ def remove(self):
+ if self.info.get("main_xprt"):
+ raise Exception("Main xprts cannot be removed")
+ self.set_state("offline")
+ self.set_state("remove")
+
def add_command(subparser):
parser = subparser.add_parser("xprt", help="Commands for individual xprts")
parser.set_defaults(func=Xprt.show, xprt=None)
@@ -139,10 +147,9 @@ class Xprt:
if args.property == "dstaddr":
xprt.set_dstaddr(socket.gethostbyname(args.newaddr[0]))
elif args.property == "remove":
- xprt.set_state("offline")
- xprt.set_state("remove")
+ xprt.remove()
else:
- args.set_state(args.property)
+ xprt.set_state(args.property)
print(xprt)

View File

@ -31,6 +31,7 @@ Patch007: nfs-utils-2.5.4-nfsman-maxconnect.patch
Patch008: nfs-utils-2.5.4-rpcpipefs-warn.patch Patch008: nfs-utils-2.5.4-rpcpipefs-warn.patch
Patch009: nfs-utils-2.5.4-rpcidmapd-return.patch Patch009: nfs-utils-2.5.4-rpcidmapd-return.patch
Patch010: nfs-utils-2.5.4-mount-ebusy.patch Patch010: nfs-utils-2.5.4-mount-ebusy.patch
Patch011: nfs-utils-2.5.4-rpcctl-xprt.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
@ -465,6 +466,7 @@ fi
* Fri Jul 22 2022 Steve Dickson <steved@redhat.com> 2.5.4-12 * Fri Jul 22 2022 Steve Dickson <steved@redhat.com> 2.5.4-12
- idmapd: Fix error status when nfs-idmapd exits (bz 2001764) - idmapd: Fix error status when nfs-idmapd exits (bz 2001764)
- mount.nfs Fix error reporting for already mounted shares (bz 2054300) - mount.nfs Fix error reporting for already mounted shares (bz 2054300)
- rpcctl - fix failure when setting xprt offline and online (bz 2081934)
* Sat Jul 16 2022 Steve Dickson <steved@redhat.com> 2.5.4-11 * Sat Jul 16 2022 Steve Dickson <steved@redhat.com> 2.5.4-11
- nfs.man: adding new mount option max_connect (bz 2106848) - nfs.man: adding new mount option max_connect (bz 2106848)