|
|
ec3309 |
From 2a816d67e95ac0edc6d56076595b29eddfeb433b Mon Sep 17 00:00:00 2001
|
|
|
ec3309 |
From: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
|
|
|
ec3309 |
Date: Thu, 1 Jun 2017 13:11:37 -0500
|
|
|
ec3309 |
Subject: [PATCH] Support Reconfiguration of device path
|
|
|
ec3309 |
|
|
|
ec3309 |
This patch allows users to pass in a string into the
|
|
|
ec3309 |
attributes. Prior it would throw:
|
|
|
ec3309 |
|
|
|
ec3309 |
Traceback (most recent call last):
|
|
|
ec3309 |
File "/usr/bin/targetcli", line 121, in <module>
|
|
|
ec3309 |
main()
|
|
|
ec3309 |
File "/usr/bin/targetcli", line 117, in main
|
|
|
ec3309 |
root_node.ui_command_saveconfig()
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/targetcli/ui_root.py", line 98, in ui_command_saveconfig
|
|
|
ec3309 |
self.rtsroot.save_to_file(savefile)
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/rtslib_fb/root.py", line 270, in save_to_file
|
|
|
ec3309 |
f.write(json.dumps(self.dump(), sort_keys=True, indent=2))
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/rtslib_fb/root.py", line 160, in dump
|
|
|
ec3309 |
d['storage_objects'] = [so.dump() for so in self.storage_objects]
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/rtslib_fb/root.py", line 160, in <listcomp>
|
|
|
ec3309 |
d['storage_objects'] = [so.dump() for so in self.storage_objects]
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/rtslib_fb/tcm.py", line 850, in dump
|
|
|
ec3309 |
d = super(UserBackedStorageObject, self).dump()
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/rtslib_fb/tcm.py", line 294, in dump
|
|
|
ec3309 |
d = super(StorageObject, self).dump()
|
|
|
ec3309 |
File "/usr/lib/python3/dist-packages/rtslib_fb/node.py", line 217, in dump
|
|
|
ec3309 |
attrs[item] = int(self.get_attribute(item))
|
|
|
ec3309 |
ValueError: invalid literal for int() with base 10: 'file//home/neo/test.raw'
|
|
|
ec3309 |
|
|
|
ec3309 |
This error is due to set attribute dev_path being a non integer.
|
|
|
ec3309 |
|
|
|
ec3309 |
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
|
|
|
ec3309 |
---
|
|
|
ec3309 |
rtslib/node.py | 5 ++++-
|
|
|
ec3309 |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
ec3309 |
|
|
|
ec3309 |
diff --git a/rtslib/node.py b/rtslib/node.py
|
|
|
ec3309 |
index c319a5b..c0092fc 100644
|
|
|
ec3309 |
--- a/rtslib/node.py
|
|
|
ec3309 |
+++ b/rtslib/node.py
|
|
|
ec3309 |
@@ -214,7 +214,10 @@ class CFSNode(object):
|
|
|
ec3309 |
attrs = {}
|
|
|
ec3309 |
params = {}
|
|
|
ec3309 |
for item in self.list_attributes(writable=True):
|
|
|
ec3309 |
- attrs[item] = int(self.get_attribute(item))
|
|
|
ec3309 |
+ try:
|
|
|
ec3309 |
+ attrs[item] = int(self.get_attribute(item))
|
|
|
ec3309 |
+ except ValueError:
|
|
|
ec3309 |
+ attrs[item] = self.get_attribute(item)
|
|
|
ec3309 |
if attrs:
|
|
|
ec3309 |
d['attributes'] = attrs
|
|
|
ec3309 |
for item in self.list_parameters(writable=True):
|
|
|
ec3309 |
--
|
|
|
ec3309 |
1.8.3.1
|
|
|
ec3309 |
|