Skip to contentSkip to conversation

nvmetcli: Fix Port and Host operations in shell

PATCH New Mauro S. M. Rodrigues 3 participants 11 messages Mar 27, 2017 – Apr 6, 2017 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 nvmetcli: Fix Port and Host operations in shell

Operations against Port and Host entities are broken. When performing operations like the follow:

/ports> create 1
/hosts> create 1

nvmetcli fails, saying the object doesn't have the attribute we're trying to access, for instance:
'module' object has no attribute 'Port'

This patch fixes this issue by importing the classes Port and Host in nvmet/__init__.py which was forgotten during the follow change:

a21ebd54f0 ("nvmetcli: Fix nvmet import").

Tested-by Guilherme G. Piccoli <gpiccoli at linux.vnet.ibm.com>
Signed-off-by Mauro S. M. Rodrigues <maurosr at linux.vnet.ibm.com>
---
 nvmet/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
nvmet/__init__.py +1 -1
index a084151..9a0b51d 100644
@@ -1 +1 @@
-from .nvme import Root, Subsystem, Namespace
+from .nvme import Root, Subsystem, Namespace, Port, Host
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 nvmetcli: Fix Referral operation in shell

It's not possible to create or list a Referral under Port entity, because Referral class is not imported and thus it fails:

/ports/1/referrals> ls

returning "'module' object has no attribute 'Referral'".

This is caused by changes introduced in:
a21ebd54f0 ("nvmetcli: Fix nvmet import").

This patch also fixes the attribute type helper expected for Referral's portid attribute. It was 'int', causing the system to show error messages like:

"'UIReferralNode' object has no attribute 'ui_type_int'". The correct type is 'number'.

Reviewed-by Guilherme G. Piccoli<gpiccoli at linux.vnet.ibm.com>
Signed-off-by Mauro S. M. Rodrigues <maurosr at linux.vnet.ibm.com>
---
 nvmet/__init__.py | 2 +-
 nvmetcli          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
nvmet/__init__.py +1 -1
index 9a0b51d..6542d87 100644
@@ -1 +1 @@
-from .nvme import Root, Subsystem, Namespace, Port, Host
+from .nvme import Root, Subsystem, Namespace, Port, Host, Referral
nvmetcli +1 -1
index 8140fc6..9f7eacf 100755
@@ -460,7 +460,7 @@ class UIReferralNode(UINode):
         'traddr': ('string', 'Transport Address (e.g. IP Address)'),
         'trsvcid': ('string', 'Transport Service ID (e.g. IP Port)'),
         'trtype': ('string', 'Transport Type (e.g. rdma or loop)'),
-        'portid': ('int', 'Port identifier'),
+        'portid': ('number', 'Port identifier'),
     }
 
     def __init__(self, parent, cfnode):
Signature · 1 line
2.7.4
maintainer
#2 lore raw

PATCH 2/3 nvmetcli: Fix Referral operation in shell

Looks good,

Reviewed-by Sagi Grimberg <sagi at grimberg.me>
#4 lore raw

PATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH

In reply to Mauro S. M. Rodrigues

According to the README, one can install nvmetcli through setup.py. When we try this, though, the nvmetcli wasn't configured in system's $PATH.
Adding it to script list in setup.py solved the issue.

Tested-by Guilherme G. Piccoli <gpiccoli at linux.vnet.ibm.com>
Signed-off-by Mauro S. M. Rodrigues <maurosr at linux.vnet.ibm.com>
---
 setup.py | 1 +
 1 file changed, 1 insertion(+)
setup.py +1 -0
index fdd6cea..4bd2ac2 100755
@@ -27,4 +27,5 @@ setup(
     maintainer_email = 'hch at lst.de',
     test_suite='nose2.collector.collector',
     packages = ['nvmet'],
+    scripts=['./nvmetcli'],
     )
Signature · 1 line
2.7.4
maintainer
#5 lore raw

PATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH

Looks good,

Reviewed-by Sagi Grimberg <sagi at grimberg.me>
#6 lore raw

PATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH

In reply to Mauro S. M. Rodrigues
Quoted 4 lines · Mauro S. M. Rodrigues

According to the README, one can install nvmetcli through setup.py. When we try this, though, the nvmetcli wasn't configured in system's $PATH.
Adding it to script list in setup.py solved the issue.

Andy sent the same patch a while ago, but it needs a fixup to

a) install into /usr/sbin
b) fixups to the deb and rpm packaging to take this into account

Do you want to fix this up? Otherwise I'll try to get to it myself, I should be able to access a Fedora test box again now.

#7 lore raw

PATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH

Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Mauro S. M. Rodrigues

According to the README, one can install nvmetcli through setup.py. When we try this, though, the nvmetcli wasn't configured in system's $PATH.
Adding it to script list in setup.py solved the issue.

Quoted 8 lines

Andy sent the same patch a while ago, but it needs a fixup to

a) install into /usr/sbin
b) fixups to the deb and rpm packaging to take this into account

Do you want to fix this up? Otherwise I'll try to get to it myself, I should be able to access a Fedora test box again now.

Hi Cristoph!

I just sent a new version of the patch. I've also checked the contents of both rpm and deb packages and everything looks correct:

~/dev/nvmetcli$ dpkg -c dist/nvmetcli_0.3.3.g08963d2_all.deb |grep /usr/sbin/nvmetcli
-rwxr-xr-x root/root 17050 2017-04-05 15:47 ./usr/sbin/nvmetcli

and for the rpm:

# rpm -ql nvmetcli |grep /usr/sbin/nvmetcli
/usr/sbin/nvmetcli

Please let me know if I missed anything here.

Thanks in advanced!

--
Mauro Rodrigues

maintainer Applied
#8 lore raw

PATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH

Thanks a lot Mauro!

I've applied your new version of the patch. I'll also plan to cut a new release in the next days with the various small fixes we had.

maintainer
#9 lore raw

PATCH 1/3 nvmetcli: Fix Port and Host operations in shell

In reply to Mauro S. M. Rodrigues
Quoted 3 lines

Operations against Port and Host entities are broken. When performing operations like the follow:

Tested-by Sagi Grimberg <sagi at grimberg.m>