From c4d2d95eb36aab504ea75762b5201d4b39fc4a13 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 4 May 2014 05:19:02 -0700 Subject: [PATCH] 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 --- oslo/vmware/exceptions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oslo/vmware/exceptions.py b/oslo/vmware/exceptions.py index 3590d51..875bd22 100644 --- a/oslo/vmware/exceptions.py +++ b/oslo/vmware/exceptions.py @@ -31,6 +31,7 @@ FILE_ALREADY_EXISTS = 'FileAlreadyExists' FILE_FAULT = 'FileFault' FILE_LOCKED = 'FileLocked' FILE_NOT_FOUND = 'FileNotFound' +INVALID_POWER_STATE = 'InvalidPowerState' INVALID_PROPERTY = 'InvalidProperty' NO_PERMISSION = 'NoPermission' NOT_AUTHENTICATED = 'NotAuthenticated' @@ -168,6 +169,11 @@ class FileNotFoundException(VMwareDriverException): code = 404 +class InvalidPowerStateException(VMwareDriverException): + msg_fmt = _("Invalid power state.") + code = 409 + + class InvalidPropertyException(VMwareDriverException): msg_fmt = _("Invalid property.") code = 400 @@ -192,6 +198,7 @@ _fault_classes_registry = { FILE_FAULT: FileFaultException, FILE_LOCKED: FileLockedException, FILE_NOT_FOUND: FileNotFoundException, + INVALID_POWER_STATE: InvalidPowerStateException, INVALID_PROPERTY: InvalidPropertyException, NO_PERMISSION: NoPermissionException, NOT_AUTHENTICATED: NotAuthenticatedException,