Blame SOURCES/0001-nvmetcli-don-t-remove-ANA-Group-1-on-clear.patch

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