]> www.infradead.org Git - users/hch/nvmetcli.git/commitdiff
nvmet: reject Namespace and Subsystems lookups without identifier
authorChristoph Hellwig <hch@lst.de>
Fri, 25 Mar 2016 17:19:14 +0000 (18:19 +0100)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Mar 2016 17:47:42 +0000 (18:47 +0100)
Signed-off-by: Christoph Hellwig <hch@lst.de>
nvmet/nvme.py

index b885f059f4d6d98f9f99750144d0c4995c4341a6..0ab41ab9bd26b8729fcb607963bd60e6f0febca8 100644 (file)
@@ -367,6 +367,8 @@ class Subsystem(CFSNode):
         super(Subsystem, self).__init__()
 
         if nqn is None:
+            if mode == 'lookup':
+                raise CFSError("Need NQN for lookup")
             nqn = self._generate_nqn()
 
         self.nqn = nqn
@@ -456,6 +458,9 @@ class Namespace(CFSNode):
             raise CFSError("Invalid parent class")
 
         if nsid is None:
+            if mode == 'lookup':
+                raise CFSError("Need NSID for lookup")
+
             nsids = [n.nsid for n in subsystem.namespaces]
             for index in xrange(1, self.MAX_NSID + 1):
                 if index not in nsids: