From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: Daniel Wagner <dwagner@suse.de>,
Keith Busch <keith.busch@wdc.com>,
Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
Hannes Reinecke <hare@suse.de>,
linux-nvme@lists.infradead.org,
Enzo Matsumiya <ematsumiya@suse.com>,
Sagi Grimberg <sagi@grimberg.me>
Subject: [PATCH 1/3] nvmetcli: add 'merge' parameter to set_config()
Date: Fri, 12 Feb 2021 16:52:27 +0100 [thread overview]
Message-ID: <20210212155229.98816-2-hare@suse.de> (raw)
In-Reply-To: <20210212155229.98816-1-hare@suse.de>
Add a parameter 'merge' to set_config() to allow for merge a given
configuration with the existing one.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
nvmet/nvme.py | 8 +++++---
nvmetcli | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 83fd75b..22aef5a 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -331,17 +331,19 @@ class Root(CFSNode):
for h in self.hosts:
h.delete()
- def restore(self, config, clear_existing=False, abort_on_error=False):
+ def restore(self, config, clear_existing=False, abort_on_error=False, merge=False):
'''
Takes a dict generated by dump() and reconfigures the target to match.
Returns list of non-fatal errors that were encountered.
Will refuse to restore over an existing configuration unless
- clear_existing is True.
+ clear_existing or merge is True. If clear_existing is True the
+ existing configuration will be cleared. If merge is True the
+ given configuration will be attempted to be merged.
'''
if clear_existing:
self.clear_existing()
else:
- if any(self.subsystems):
+ if any(self.subsystems) and not merge:
raise CFSError("subsystems present, not restoring")
errors = []
diff --git a/nvmetcli b/nvmetcli
index 8ee8590..f2b59bb 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -104,11 +104,11 @@ class UIRootNode(UINode):
UIPortsNode(self)
UIHostsNode(self)
- def ui_command_restoreconfig(self, savefile=None, clear_existing=False):
+ def ui_command_restoreconfig(self, savefile=None, clear_existing=False, merge=False):
'''
Restores configuration from a file.
'''
- errors = self.cfnode.restore_from_file(savefile, clear_existing)
+ errors = self.cfnode.restore_from_file(savefile, clear_existing, merge)
self.refresh()
if errors:
--
2.29.2
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-02-12 15:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 15:52 [RFC PATCH 0/3] nvmetcli: remote configuation Hannes Reinecke
2021-02-12 15:52 ` Hannes Reinecke [this message]
2021-02-12 15:52 ` [PATCH 2/3] nvmetproxy: add a JSON-RPC proxy daemon Hannes Reinecke
2021-02-12 15:52 ` [PATCH 3/3] nvmetadm: add JSON-RPC client for remote configuration Hannes Reinecke
2021-07-13 9:21 ` [RFC PATCH 0/3] nvmetcli: remote configuation Christoph Hellwig
2021-07-13 9:41 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210212155229.98816-2-hare@suse.de \
--to=hare@suse.de \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=dwagner@suse.de \
--cc=ematsumiya@suse.com \
--cc=hch@lst.de \
--cc=keith.busch@wdc.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox