Revision 0623d351 lib/errors.py
b/lib/errors.py | ||
---|---|---|
226 | 226 |
class QuitGanetiException(Exception): |
227 | 227 |
"""Signal that Ganeti that it must quit. |
228 | 228 |
|
229 |
This is not necessarily an error (and thus not a subclass of GenericError), |
|
230 |
but it's an exceptional circumstance and it is thus treated. This instance |
|
231 |
should be instantiated with two values. The first one will specify whether an |
|
232 |
error should returned to the caller, and the second one will be the returned |
|
233 |
result (either as an error or as a normal result). |
|
229 |
This is not necessarily an error (and thus not a subclass of |
|
230 |
GenericError), but it's an exceptional circumstance and it is thus |
|
231 |
treated. This instance should be instantiated with two values. The |
|
232 |
first one will specify the return code to the caller, and the second |
|
233 |
one will be the returned result (either as an error or as a normal |
|
234 |
result). Usually only the leave cluster rpc call should return |
|
235 |
status True (as there it's expected we quit), every other call will |
|
236 |
return status False (as a critical error was encountered). |
|
234 | 237 |
|
235 | 238 |
Examples:: |
236 | 239 |
|
237 | 240 |
# Return a result of "True" to the caller, but quit ganeti afterwards |
238 |
raise QuitGanetiException(False, True)
|
|
241 |
raise QuitGanetiException(True, None)
|
|
239 | 242 |
# Send an error to the caller, and quit ganeti |
240 |
raise QuitGanetiException(True, "Fatal safety violation, shutting down")
|
|
243 |
raise QuitGanetiException(False, "Fatal safety violation, shutting down")
|
|
241 | 244 |
|
242 | 245 |
""" |
243 | 246 |
|
Also available in: Unified diff