]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: nvme config --modify depends on -n and -t argument
authorDaniel Wagner <dwagner@suse.de>
Thu, 29 Sep 2022 09:28:50 +0000 (11:28 +0200)
committerDaniel Wagner <dwagner@suse.de>
Thu, 29 Sep 2022 10:13:05 +0000 (12:13 +0200)
In order to be able to modify a config we need to look it up
first. The nvme_lookup_subsystem() call will crash if we don't
provide a NQN.

The transport is needed to be able lookup a controller.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
fabrics.c

index 43ca5f422d3d471d78dd5c1dbe838f029fe48b6c..6cf70be7e678ce301b2bc9637249fae5053846ab 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -1134,6 +1134,18 @@ int nvmf_config(const char *desc, int argc, char **argv)
                nvme_subsystem_t s;
                nvme_ctrl_t c;
 
+               if (!subsysnqn) {
+                       fprintf(stderr,
+                               "required argument [--nqn | -n] needed with --modify\n");
+                       return -EINVAL;
+               }
+
+               if (!transport) {
+                       fprintf(stderr,
+                               "required argument [--transport | -t] needed with --modify\n");
+                       return EINVAL;
+               }
+
                if (!hostnqn)
                        hostnqn = hnqn = nvmf_hostnqn_from_file();
                if (!hostid && hnqn)