summaryrefslogtreecommitdiff
path: root/cinderclient/exceptions.py
diff options
context:
space:
mode:
authorChaynika Saikia <csaikia@asu.edu>2017-06-19 16:27:49 -0400
committerChaynika Saikia <csaikia@asu.edu>2017-07-24 09:06:28 -0400
commit0cb09cc560436538366cfa4c91136ba5538f5167 (patch)
tree1e2e4302399ea5bc9971f25d2fa18727ff9547c8 /cinderclient/exceptions.py
parent72671fffe51898446c8671e122cd6ef11171fdb1 (diff)
downloadpython-cinderclient-0cb09cc560436538366cfa4c91136ba5538f5167.tar.gz
Add cinder create --poll
Usage: It adds an optional argument --poll to the cinder create command which waits while the creation of the volume is completed and the volume goes to available state. In case there is an error in volume creation, it throws an error message and exits with a non zero status. The error message printed here is the async error message in case it generates one. Depends-On: Ic3ab32b95abd29e995bc071adc11b1e481b32516 Change-Id: I1a4d361d48a44a0daa830491f415be64f2e356e3
Diffstat (limited to 'cinderclient/exceptions.py')
-rw-r--r--cinderclient/exceptions.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/cinderclient/exceptions.py b/cinderclient/exceptions.py
index 43ae5a4..4f0227e 100644
--- a/cinderclient/exceptions.py
+++ b/cinderclient/exceptions.py
@@ -21,6 +21,29 @@ from datetime import datetime
from oslo_utils import timeutils
+class ResourceInErrorState(Exception):
+ """When resource is in Error state"""
+ def __init__(self, obj, fault_msg):
+ msg = "'%s' resource is in the error state" % obj.__class__.__name__
+ if fault_msg:
+ msg += " due to '%s'" % fault_msg
+ self.message = "%s." % msg
+
+ def __str__(self):
+ return self.message
+
+
+class TimeoutException(Exception):
+ """When an action exceeds the timeout period to complete the action"""
+ def __init__(self, obj, action):
+ self.message = ("The '%(action)s' of the '%(object_name)s' exceeded "
+ "the timeout period." % {"action": action,
+ "object_name": obj.__class__.__name__})
+
+ def __str__(self):
+ return self.message
+
+
class UnsupportedVersion(Exception):
"""Indicates that the user is trying to use an unsupported
version of the API.