* Stop retrying if LB provisioning status reached ERROR The method `wait_for_lb_resource()` retries for 15m while the load balancer could have reached to ERROR during the provisioning in the first few minutes, this approach makes the testing take longer for no reason. This change makes the ERROR state in provisioning_status final and abort raising a ValueError() exception. More details of the provisioning_status possible states can be found at: https://docs.openstack.org/api-ref/load-balancer/v2/#provisioning-status-codes * Use LoadBalancerUnexpectedState and LoadBalancerUnrecoverableError. Drop the (re-)use of AssertionError and ValueError to identify when a load balancer status is in a state where the test needs to retry or break and fail respectively. This change introduces 2 new exceptions to be explicit of what the code is trying to do. - LoadBalancerUnexpectedState is raised when the status of the load balancer is in a state different from the one requested by the caller, but said state can be considered as transitory. - LoadBalancerUnrecoverableError is raised when the status of the load balancer is in ERROR state and said state is final for the proviniong_status property, hence retrying only delays the failure.
223 lines
4.2 KiB
Python
223 lines
4.2 KiB
Python
# Copyright 2018 Canonical Ltd.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
"""Module of exceptions that zaza may raise."""
|
|
|
|
|
|
class InvalidTestConfig(Exception):
|
|
"""Exception when the test configuration is invalid."""
|
|
|
|
pass
|
|
|
|
|
|
class MissingOSAthenticationException(Exception):
|
|
"""Exception when some data needed to authenticate is missing."""
|
|
|
|
pass
|
|
|
|
|
|
class CloudInitIncomplete(Exception):
|
|
"""Cloud init has not completed properly."""
|
|
|
|
pass
|
|
|
|
|
|
class SSHFailed(Exception):
|
|
"""SSH failed."""
|
|
|
|
pass
|
|
|
|
|
|
class NeutronAgentMissing(Exception):
|
|
"""Agent binary does not appear in the Neutron agent list."""
|
|
|
|
pass
|
|
|
|
|
|
class NeutronBGPSpeakerMissing(Exception):
|
|
"""No BGP speaker appeared on agent."""
|
|
|
|
pass
|
|
|
|
|
|
class ApplicationNotFound(Exception):
|
|
"""Application not found in machines."""
|
|
|
|
def __init__(self, application):
|
|
"""Create Application not found exception.
|
|
|
|
:param application: Name of the application
|
|
:type application: string
|
|
:returns: ApplicationNotFound Exception
|
|
"""
|
|
msg = ("{} application was not found in machines.".
|
|
format(application))
|
|
super(ApplicationNotFound, self).__init__(msg)
|
|
|
|
|
|
class SeriesNotFound(Exception):
|
|
"""Series not found in status."""
|
|
|
|
pass
|
|
|
|
|
|
class OSVersionNotFound(Exception):
|
|
"""OS Version not found."""
|
|
|
|
pass
|
|
|
|
|
|
class ReleasePairNotFound(Exception):
|
|
"""Release pair was not found in OPENSTACK_RELEASES_PAIRS."""
|
|
|
|
pass
|
|
|
|
|
|
class KeystoneAuthorizationStrict(Exception):
|
|
"""Authorization/Policy too strict."""
|
|
|
|
pass
|
|
|
|
|
|
class KeystoneAuthorizationPermissive(Exception):
|
|
"""Authorization/Policy too permissive."""
|
|
|
|
pass
|
|
|
|
|
|
class KeystoneWrongTokenProvider(Exception):
|
|
"""A token was issued from the wrong token provider."""
|
|
|
|
pass
|
|
|
|
|
|
class KeystoneKeyRepositoryError(Exception):
|
|
"""Error in key repository.
|
|
|
|
This may be caused by isues with one of:
|
|
- incomplete or missing data in `key_repository` in leader storage
|
|
- synchronization of keys to non-leader units
|
|
- rotation of keys
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class ProcessNameCountMismatch(Exception):
|
|
"""Count of process names doesn't match."""
|
|
|
|
pass
|
|
|
|
|
|
class ProcessNameMismatch(Exception):
|
|
"""Name of processes doesn't match."""
|
|
|
|
pass
|
|
|
|
|
|
class PIDCountMismatch(Exception):
|
|
"""PID's count doesn't match."""
|
|
|
|
pass
|
|
|
|
|
|
class ProcessIdsFailed(Exception):
|
|
"""Process ID lookup failed."""
|
|
|
|
pass
|
|
|
|
|
|
class UnitNotFound(Exception):
|
|
"""Unit not found in actual dict."""
|
|
|
|
pass
|
|
|
|
|
|
class UnitCountMismatch(Exception):
|
|
"""Count of unit doesn't match."""
|
|
|
|
pass
|
|
|
|
|
|
class UbuntuReleaseNotFound(Exception):
|
|
"""Ubuntu release not found in list."""
|
|
|
|
pass
|
|
|
|
|
|
class ServiceNotFound(Exception):
|
|
"""Service not found on unit."""
|
|
|
|
pass
|
|
|
|
|
|
class CephPoolNotFound(Exception):
|
|
"""Ceph pool not found."""
|
|
|
|
pass
|
|
|
|
|
|
class CephPoolNotConfigured(Exception):
|
|
"""Ceph pool not configured properly."""
|
|
|
|
pass
|
|
|
|
|
|
class CephGenericError(Exception):
|
|
"""A generic/other Ceph error occurred."""
|
|
|
|
pass
|
|
|
|
|
|
class NovaGuestMigrationFailed(Exception):
|
|
"""Nova guest migration failed."""
|
|
|
|
pass
|
|
|
|
|
|
class NovaGuestRestartFailed(Exception):
|
|
"""Nova guest restart failed."""
|
|
|
|
pass
|
|
|
|
|
|
class NovaGuestNoPingResponse(Exception):
|
|
"""Nova guest failed to respond to pings."""
|
|
|
|
pass
|
|
|
|
|
|
class PolicydError(Exception):
|
|
"""Policyd override failed."""
|
|
|
|
pass
|
|
|
|
|
|
class CACERTNotFound(Exception):
|
|
"""Could not find cacert."""
|
|
|
|
pass
|
|
|
|
|
|
class LoadBalancerUnexpectedState(Exception):
|
|
"""The LoadBalancer is in a unexpected state."""
|
|
|
|
pass
|
|
|
|
|
|
class LoadBalancerUnrecoverableError(Exception):
|
|
"""The LoadBalancer has reached to an unrecoverable error state."""
|
|
|
|
pass
|