1 # Copyright (c) 2017 Intel Corporation
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from oslo_utils import excutils
18 class ProcessExecutionError(RuntimeError):
19 def __init__(self, message, returncode):
20 super(ProcessExecutionError, self).__init__(message)
21 self.returncode = returncode
24 class YardstickException(Exception):
25 """Base Yardstick Exception.
27 To correctly use this class, inherit from it and define
28 a 'message' property. That message will get printf'd
29 with the keyword arguments provided to the constructor.
31 Based on NeutronException class.
33 message = "An unknown exception occurred."
35 def __init__(self, **kwargs):
37 super(YardstickException, self).__init__(self.message % kwargs)
38 self.msg = self.message % kwargs
39 except Exception: # pylint: disable=broad-except
40 with excutils.save_and_reraise_exception() as ctxt:
41 if not self.use_fatal_exceptions():
43 # at least get the core message out if something happened
44 super(YardstickException, self).__init__(self.message)
49 def use_fatal_exceptions(self):
50 """Is the instance using fatal exceptions.
52 :returns: Always returns False.
57 class FunctionNotImplemented(YardstickException):
58 message = ('The function "%(function_name)s" is not implemented in '
59 '"%(class_name)" class.')
62 class InfluxDBConfigurationMissing(YardstickException):
63 message = ('InfluxDB configuration is not available. Add "influxdb" as '
64 'a dispatcher and the configuration section')
67 class YardstickBannedModuleImported(YardstickException):
69 message = 'Module "%(module)s" cannnot be imported. Reason: "%(reason)s"'
72 class PayloadMissingAttributes(YardstickException):
73 message = ('Error instantiating a Payload class, missing attributes: '
74 '%(missing_attributes)s')
77 class HeatTemplateError(YardstickException):
78 """Error in Heat during the stack deployment"""
79 message = ('Error in Heat during the creation of the OpenStack stack '
83 class IPv6RangeError(YardstickException):
84 message = 'Start IP "%(start_ip)s" is greater than end IP "%(end_ip)s"'
87 class TrafficProfileNotImplemented(YardstickException):
88 message = 'No implementation for traffic profile %(profile_class)s.'
91 class DPDKSetupDriverError(YardstickException):
92 message = '"igb_uio" driver is not loaded'
95 class OVSUnsupportedVersion(YardstickException):
96 message = ('Unsupported OVS version "%(ovs_version)s". Please check the '
97 'config. OVS to DPDK version map: %(ovs_to_dpdk_map)s.')
100 class OVSHugepagesInfoError(YardstickException):
101 message = 'MemInfo cannnot be retrieved.'
104 class OVSHugepagesNotConfigured(YardstickException):
105 message = 'HugePages are not configured in this system.'
108 class OVSHugepagesZeroFree(YardstickException):
109 message = ('There are no HugePages free in this system. Total HugePages '
110 'configured: %(total_hugepages)s')
113 class OVSDeployError(YardstickException):
114 message = 'OVS deploy tool failed with error: %(stderr)s.'
117 class OVSSetupError(YardstickException):
118 message = 'OVS setup error. Command: %(command)s. Error: %(error)s.'
121 class LibvirtCreateError(YardstickException):
122 message = 'Error creating the virtual machine. Error: %(error)s.'
125 class LibvirtQemuImageBaseImageNotPresent(YardstickException):
126 message = ('Error creating the qemu image for %(vm_image)s. Base image: '
127 '%(base_image)s. Base image not present in execution host or '
131 class LibvirtQemuImageCreateError(YardstickException):
132 message = ('Error creating the qemu image for %(vm_image)s. Base image: '
133 '%(base_image)s. Error: %(error)s.')
136 class ScenarioConfigContextNameNotFound(YardstickException):
137 message = 'Context name "%(context_name)s" not found'
140 class StackCreationInterrupt(YardstickException):
141 message = 'Stack create interrupted.'
144 class TaskRenderArgumentError(YardstickException):
145 message = 'Error reading the task input arguments'
148 class TaskReadError(YardstickException):
149 message = 'Failed to read task %(task_file)s'
152 class TaskRenderError(YardstickException):
153 message = 'Failed to render template:\n%(input_task)s'
156 class TimerTimeout(YardstickException):
157 message = 'Timer timeout expired, %(timeout)s seconds'
160 class WaitTimeout(YardstickException):
161 message = 'Wait timeout while waiting for condition'
164 class ScenarioCreateNetworkError(YardstickException):
165 message = 'Create Neutron Network Scenario failed'
168 class ScenarioCreateSubnetError(YardstickException):
169 message = 'Create Neutron Subnet Scenario failed'
172 class ScenarioDeleteRouterError(YardstickException):
173 message = 'Delete Neutron Router Scenario failed'
176 class MissingPodInfoError(YardstickException):
177 message = 'Missing pod args, please check'
180 class UnsupportedPodFormatError(YardstickException):
181 message = 'Failed to load pod info, unsupported format'
184 class ScenarioCreateRouterError(YardstickException):
185 message = 'Create Neutron Router Scenario failed'
188 class ScenarioRemoveRouterIntError(YardstickException):
189 message = 'Remove Neutron Router Interface Scenario failed'
192 class ScenarioCreateFloatingIPError(YardstickException):
193 message = 'Create Neutron Floating IP Scenario failed'
196 class ScenarioDeleteFloatingIPError(YardstickException):
197 message = 'Delete Neutron Floating IP Scenario failed'
200 class ScenarioCreateSecurityGroupError(YardstickException):
201 message = 'Create Neutron Security Group Scenario failed'
204 class ScenarioDeleteNetworkError(YardstickException):
205 message = 'Delete Neutron Network Scenario failed'
208 class ScenarioCreateServerError(YardstickException):
209 message = 'Nova Create Server Scenario failed'
212 class ScenarioDeleteServerError(YardstickException):
213 message = 'Delete Server Scenario failed'
216 class ScenarioCreateKeypairError(YardstickException):
217 message = 'Nova Create Keypair Scenario failed'
220 class ScenarioDeleteKeypairError(YardstickException):
221 message = 'Nova Delete Keypair Scenario failed'
224 class ScenarioAttachVolumeError(YardstickException):
225 message = 'Nova Attach Volume Scenario failed'
228 class ScenarioGetServerError(YardstickException):
229 message = 'Nova Get Server Scenario failed'
232 class ScenarioGetFlavorError(YardstickException):
233 message = 'Nova Get Falvor Scenario failed'