nvmetcli: Fix Port and Host operations in shell
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").
--- nvmet/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
nvmet/__init__.py +1 -1
@@ -1 +1 @@ -from .nvme import Root, Subsystem, Namespace +from .nvme import Root, Subsystem, Namespace, Port, Host
Signature · 1 line
2.7.4
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'.
--- nvmet/__init__.py | 2 +- nvmetcli | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
nvmet/__init__.py +1 -1
@@ -1 +1 @@ -from .nvme import Root, Subsystem, Namespace, Port, Host +from .nvme import Root, Subsystem, Namespace, Port, Host, Referral
nvmetcli +1 -1
@@ -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
Sagi Grimberg
maintainerPATCH 2/3 nvmetcli: Fix Referral operation in shell
Looks good,
PATCH 2/3 nvmetcli: Fix Referral operation in shell
In reply to Mauro S. M. RodriguesThanks, applied.
PATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH
In reply to Mauro S. M. RodriguesAccording 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.
--- setup.py | 1 + 1 file changed, 1 insertion(+)
setup.py +1 -0
@@ -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
Sagi Grimberg
maintainerPATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH
Looks good,
Christoph Hellwig
maintainerPATCH 3/3 nvmetcli: Install nvmetcli executable in $PATH
In reply to Mauro S. M. RodriguesQuoted 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 insetup.pysolved 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.
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 insetup.pysolved 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 accountDo 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
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.
Sagi Grimberg
maintainerPATCH 1/3 nvmetcli: Fix Port and Host operations in shell
In reply to Mauro S. M. RodriguesQuoted 3 lines
Operations against Port and Host entities are broken. When performing operations like the follow:
PATCH 1/3 nvmetcli: Fix Port and Host operations in shell
In reply to Mauro S. M. RodriguesThanks Mauro,
applied.