From 0827df8deb5304854d9efc58e9df5971aa66f490 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 27 Mar 2020 08:01:34 +0100
Subject: [PATCH] nvmetcli: don't remove ANA Group 1 on clear
The first ANA group is maintained by the kernel so it cannot
be deleted.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/nvme.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 0647ddc..fdec4ff 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -845,6 +845,11 @@ class ANAGroup(CFSNode):
a._setup_attrs(n, err_func)
+ def delete(self):
+ # ANA Group 1 is automatically created/deleted
+ if self.grpid != 1:
+ super(ANAGroup, self).delete()
+
def dump(self):
d = super(ANAGroup, self).dump()
d['grpid'] = self.grpid
--
2.30.2