root / lib / errors.py @ f362096f
History | View | Annotate | Download (4.3 kB)
1 |
#
|
---|---|
2 |
#
|
3 |
|
4 |
# Copyright (C) 2006, 2007 Google Inc.
|
5 |
#
|
6 |
# This program is free software; you can redistribute it and/or modify
|
7 |
# it under the terms of the GNU General Public License as published by
|
8 |
# the Free Software Foundation; either version 2 of the License, or
|
9 |
# (at your option) any later version.
|
10 |
#
|
11 |
# This program is distributed in the hope that it will be useful, but
|
12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
# General Public License for more details.
|
15 |
#
|
16 |
# You should have received a copy of the GNU General Public License
|
17 |
# along with this program; if not, write to the Free Software
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 |
# 02110-1301, USA.
|
20 |
|
21 |
|
22 |
"""Ganeti exception handling"""
|
23 |
|
24 |
|
25 |
class GenericError(Exception): |
26 |
"""Base exception for Ganeti.
|
27 |
|
28 |
"""
|
29 |
pass
|
30 |
|
31 |
|
32 |
class LVMError(GenericError): |
33 |
"""LVM-related exception.
|
34 |
|
35 |
This exception codifies problems with LVM setup.
|
36 |
|
37 |
"""
|
38 |
pass
|
39 |
|
40 |
|
41 |
class LockError(GenericError): |
42 |
"""Lock error exception.
|
43 |
|
44 |
This signifies problems in the locking subsystem.
|
45 |
|
46 |
"""
|
47 |
pass
|
48 |
|
49 |
|
50 |
class HypervisorError(GenericError): |
51 |
"""Hypervisor-related exception.
|
52 |
|
53 |
This is raised in case we can't communicate with the hypervisor
|
54 |
properly.
|
55 |
|
56 |
"""
|
57 |
pass
|
58 |
|
59 |
|
60 |
class ProgrammerError(GenericError): |
61 |
"""Programming-related error.
|
62 |
|
63 |
This is raised in cases we determine that the calling conventions
|
64 |
have been violated, meaning we got some desynchronisation between
|
65 |
parts of our code. It signifies a real programming bug.
|
66 |
|
67 |
"""
|
68 |
pass
|
69 |
|
70 |
|
71 |
class BlockDeviceError(GenericError): |
72 |
"""Block-device related exception.
|
73 |
|
74 |
This is raised in case we can't setup the instance's block devices
|
75 |
properly.
|
76 |
|
77 |
"""
|
78 |
pass
|
79 |
|
80 |
|
81 |
class ConfigurationError(GenericError): |
82 |
"""Configuration related exception.
|
83 |
|
84 |
Things like having an instance with a primary node that doesn't
|
85 |
exist in the config or such raise this exception.
|
86 |
|
87 |
"""
|
88 |
pass
|
89 |
|
90 |
|
91 |
class RemoteError(GenericError): |
92 |
"""Programming-related error on remote call.
|
93 |
|
94 |
This is raised when an unhandled error occurs in a call to a
|
95 |
remote node. It usually signifies a real programming bug.
|
96 |
|
97 |
"""
|
98 |
pass
|
99 |
|
100 |
|
101 |
class InvalidOS(GenericError): |
102 |
"""Missing OS on node.
|
103 |
|
104 |
This is raised when an OS exists on the master (or is otherwise
|
105 |
requested to the code) but not on the target node.
|
106 |
|
107 |
This exception has three arguments:
|
108 |
- the name of the os
|
109 |
- the source directory, if any
|
110 |
- the reason why we consider this an invalid OS (text of error message)
|
111 |
|
112 |
"""
|
113 |
|
114 |
|
115 |
class ParameterError(GenericError): |
116 |
"""A passed parameter to a command is invalid.
|
117 |
|
118 |
This is raised when the parameter passed to a request function is
|
119 |
invalid. Correct code should have verified this before passing the
|
120 |
request structure.
|
121 |
|
122 |
The argument to this exception should be the parameter name.
|
123 |
|
124 |
"""
|
125 |
pass
|
126 |
|
127 |
|
128 |
class OpPrereqError(GenericError): |
129 |
"""Prerequisites for the OpCode are not fulfilled.
|
130 |
|
131 |
"""
|
132 |
|
133 |
|
134 |
class OpExecError(GenericError): |
135 |
"""Error during OpCode execution.
|
136 |
|
137 |
"""
|
138 |
|
139 |
|
140 |
class OpRetryError(OpExecError): |
141 |
"""Error during OpCode execution, action can be retried.
|
142 |
|
143 |
"""
|
144 |
|
145 |
|
146 |
class OpCodeUnknown(GenericError): |
147 |
"""Unknown opcode submitted.
|
148 |
|
149 |
This signifies a mismatch between the definitions on the client and
|
150 |
server side.
|
151 |
|
152 |
"""
|
153 |
|
154 |
|
155 |
class ResolverError(GenericError): |
156 |
"""Host name cannot be resolved.
|
157 |
|
158 |
This is not a normal situation for Ganeti, as we rely on having a
|
159 |
working resolver.
|
160 |
|
161 |
The non-resolvable hostname is available as the first element of the
|
162 |
args tuple; the other two elements of the tuple are the first two
|
163 |
args of the socket.gaierror exception (error code and description).
|
164 |
|
165 |
"""
|
166 |
|
167 |
|
168 |
class HooksFailure(GenericError): |
169 |
"""A generic hook failure.
|
170 |
|
171 |
This signifies usually a setup misconfiguration.
|
172 |
|
173 |
"""
|
174 |
|
175 |
|
176 |
class HooksAbort(HooksFailure): |
177 |
"""A required hook has failed.
|
178 |
|
179 |
This caused an abort of the operation in the initial phase. This
|
180 |
exception always has an attribute args which is a list of tuples of:
|
181 |
- node: the source node on which this hooks has failed
|
182 |
- script: the name of the script which aborted the run
|
183 |
|
184 |
"""
|
185 |
|
186 |
|
187 |
class UnitParseError(GenericError): |
188 |
"""Unable to parse size unit.
|
189 |
|
190 |
"""
|
191 |
|
192 |
|
193 |
class SshKeyError(GenericError): |
194 |
"""Invalid SSH key.
|
195 |
"""
|
196 |
|
197 |
|
198 |
class TagError(GenericError): |
199 |
"""Generic tag error.
|
200 |
|
201 |
The argument to this exception will show the exact error.
|
202 |
|
203 |
"""
|