diff options
author | Mike Christie <mchristi@redhat.com> | 2017-06-20 21:42:20 -0500 |
---|---|---|
committer | Mike Christie <mchristi@redhat.com> | 2017-06-20 21:42:20 -0500 |
commit | 6b14c2af6790ad8073fcd4982363197f5c030de2 (patch) | |
tree | 9e78de7934c7ff9c7d09a8f0a6fe316518cda47a /targetcli | |
parent | c0b93a3f17340350512f58d485989280bceccca6 (diff) | |
download | targetcli-6b14c2af6790ad8073fcd4982363197f5c030de2.tar.gz |
targetcli: handle tcmu dev creation errors
With these kernel patches:
https://www.spinics.net/lists/target-devel/msg15657.html
tcmu will be able to return errors during device addition.
This patch to targetcli catches errors from rtslib (rtslib will
catch the error and cleanup the configfs/kernel device and do a
raise) and return a error and message to the user.
Diffstat (limited to 'targetcli')
-rw-r--r-- | targetcli/ui_backstore.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py index 88240bb..83673a0 100644 --- a/targetcli/ui_backstore.py +++ b/targetcli/ui_backstore.py @@ -599,8 +599,12 @@ class UIUserBackedBackstore(UIBackstore): if not ok: raise ExecutionError("cfgstring invalid: %s" % errmsg) - so = UserBackedStorageObject(name, size=size, config=config, wwn=wwn, - hw_max_sectors=hw_max_sectors) + try: + so = UserBackedStorageObject(name, size=size, config=config, + wwn=wwn, hw_max_sectors=hw_max_sectors) + except: + raise ExecutionError("UserBackedStorageObject creation failed.") + ui_so = UIUserBackedStorageObject(so, self) self.shell.log.info("Created user-backed storage object %s size %d." % (name, size)) |