From 69dad8a27a993235a77cba41060f634da7e29837 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> Date: Wed, 25 May 2016 14:30:50 +0200 Subject: [PATCH] nvmet: small fixes and cleanups Signed-off-by: Christoph Hellwig <hch@lst.de> --- nvmet/nvme.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/nvmet/nvme.py b/nvmet/nvme.py index e3b85a7..b5e6e4f 100644 --- a/nvmet/nvme.py +++ b/nvmet/nvme.py @@ -422,11 +422,6 @@ class Subsystem(CFSNode): name = str(uuid.uuid4()) return "%s:%s" % (prefix, name) - def _list_namespaces(self): - self._check_self() - for d in os.listdir("%s/namespaces/" % self._path): - yield Namespace(self, int(d), 'lookup') - def delete(self): ''' Recursively deletes a Subsystem object. @@ -440,6 +435,11 @@ class Subsystem(CFSNode): self.remove_allowed_host(h) super(Subsystem, self).delete() + def _list_namespaces(self): + self._check_self() + for d in os.listdir("%s/namespaces/" % self._path): + yield Namespace(self, int(d), 'lookup') + namespaces = property(_list_namespaces, doc="Get the list of Namespaces for the Subsystem.") @@ -592,8 +592,7 @@ class Namespace(CFSNode): class Port(CFSNode): ''' - This is an interface to a NVMe Namespace in configFS. - A Namespace is identified by its parent Subsystem and Namespace ID. + This is an interface to a NVMe Port in configFS. ''' MAX_PORTID = 8192 @@ -625,8 +624,7 @@ class Port(CFSNode): def _get_portid(self): return self._portid - portid = property(_get_portid, - doc="Get the Port ID as an int.") + portid = property(_get_portid, doc="Get the Port ID as an int.") def _list_subsystems(self): return [os.path.basename(name) @@ -660,7 +658,7 @@ class Port(CFSNode): ''' self._check_self() for s in self.subsystems: - self.remove_subsystem(s); + self.remove_subsystem(s) super(Port, self).delete() @classmethod -- GitLab