Support 'InvalidPowerState' exception

The aforementioned exception is used to determine if a VM is
already powered on. This was introduced in the spwan refactor:
https://review.openstack.org/#/c/83207/.

Change-Id: I35fa88cdae5d488d0dbf65346aa5903e5eec17fb
This commit is contained in:
Gary Kotton 2014-05-04 05:19:02 -07:00
parent c1670bebdc
commit c4d2d95eb3

View File

@ -31,6 +31,7 @@ FILE_ALREADY_EXISTS = 'FileAlreadyExists'
FILE_FAULT = 'FileFault' FILE_FAULT = 'FileFault'
FILE_LOCKED = 'FileLocked' FILE_LOCKED = 'FileLocked'
FILE_NOT_FOUND = 'FileNotFound' FILE_NOT_FOUND = 'FileNotFound'
INVALID_POWER_STATE = 'InvalidPowerState'
INVALID_PROPERTY = 'InvalidProperty' INVALID_PROPERTY = 'InvalidProperty'
NO_PERMISSION = 'NoPermission' NO_PERMISSION = 'NoPermission'
NOT_AUTHENTICATED = 'NotAuthenticated' NOT_AUTHENTICATED = 'NotAuthenticated'
@ -168,6 +169,11 @@ class FileNotFoundException(VMwareDriverException):
code = 404 code = 404
class InvalidPowerStateException(VMwareDriverException):
msg_fmt = _("Invalid power state.")
code = 409
class InvalidPropertyException(VMwareDriverException): class InvalidPropertyException(VMwareDriverException):
msg_fmt = _("Invalid property.") msg_fmt = _("Invalid property.")
code = 400 code = 400
@ -192,6 +198,7 @@ _fault_classes_registry = {
FILE_FAULT: FileFaultException, FILE_FAULT: FileFaultException,
FILE_LOCKED: FileLockedException, FILE_LOCKED: FileLockedException,
FILE_NOT_FOUND: FileNotFoundException, FILE_NOT_FOUND: FileNotFoundException,
INVALID_POWER_STATE: InvalidPowerStateException,
INVALID_PROPERTY: InvalidPropertyException, INVALID_PROPERTY: InvalidPropertyException,
NO_PERMISSION: NoPermissionException, NO_PERMISSION: NoPermissionException,
NOT_AUTHENTICATED: NotAuthenticatedException, NOT_AUTHENTICATED: NotAuthenticatedException,