Statistics
| Branch: | Tag: | Revision:

root / lib / errors.py @ 6e06b36c

History | View | Annotate | Download (4.3 kB)

1 2f31098c Iustin Pop
#
2 a8083063 Iustin Pop
#
3 a8083063 Iustin Pop
4 a8083063 Iustin Pop
# Copyright (C) 2006, 2007 Google Inc.
5 a8083063 Iustin Pop
#
6 a8083063 Iustin Pop
# This program is free software; you can redistribute it and/or modify
7 a8083063 Iustin Pop
# it under the terms of the GNU General Public License as published by
8 a8083063 Iustin Pop
# the Free Software Foundation; either version 2 of the License, or
9 a8083063 Iustin Pop
# (at your option) any later version.
10 a8083063 Iustin Pop
#
11 a8083063 Iustin Pop
# This program is distributed in the hope that it will be useful, but
12 a8083063 Iustin Pop
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 a8083063 Iustin Pop
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 a8083063 Iustin Pop
# General Public License for more details.
15 a8083063 Iustin Pop
#
16 a8083063 Iustin Pop
# You should have received a copy of the GNU General Public License
17 a8083063 Iustin Pop
# along with this program; if not, write to the Free Software
18 a8083063 Iustin Pop
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 a8083063 Iustin Pop
# 02110-1301, USA.
20 a8083063 Iustin Pop
21 a8083063 Iustin Pop
22 a8083063 Iustin Pop
"""Ganeti exception handling"""
23 a8083063 Iustin Pop
24 a8083063 Iustin Pop
25 a8083063 Iustin Pop
class GenericError(Exception):
26 a8083063 Iustin Pop
  """Base exception for Ganeti.
27 a8083063 Iustin Pop

28 a8083063 Iustin Pop
  """
29 a8083063 Iustin Pop
  pass
30 a8083063 Iustin Pop
31 a8083063 Iustin Pop
32 a8083063 Iustin Pop
class LVMError(GenericError):
33 a8083063 Iustin Pop
  """LVM-related exception.
34 a8083063 Iustin Pop

35 a8083063 Iustin Pop
  This exception codifies problems with LVM setup.
36 a8083063 Iustin Pop

37 a8083063 Iustin Pop
  """
38 a8083063 Iustin Pop
  pass
39 a8083063 Iustin Pop
40 a8083063 Iustin Pop
41 a8083063 Iustin Pop
class LockError(GenericError):
42 a8083063 Iustin Pop
  """Lock error exception.
43 a8083063 Iustin Pop

44 a8083063 Iustin Pop
  This signifies problems in the locking subsystem.
45 a8083063 Iustin Pop

46 a8083063 Iustin Pop
  """
47 a8083063 Iustin Pop
  pass
48 a8083063 Iustin Pop
49 a8083063 Iustin Pop
50 a8083063 Iustin Pop
class HypervisorError(GenericError):
51 a8083063 Iustin Pop
  """Hypervisor-related exception.
52 a8083063 Iustin Pop

53 a8083063 Iustin Pop
  This is raised in case we can't communicate with the hypervisor
54 a8083063 Iustin Pop
  properly.
55 a8083063 Iustin Pop

56 a8083063 Iustin Pop
  """
57 a8083063 Iustin Pop
  pass
58 a8083063 Iustin Pop
59 a8083063 Iustin Pop
60 a8083063 Iustin Pop
class ProgrammerError(GenericError):
61 a8083063 Iustin Pop
  """Programming-related error.
62 a8083063 Iustin Pop

63 a8083063 Iustin Pop
  This is raised in cases we determine that the calling conventions
64 a8083063 Iustin Pop
  have been violated, meaning we got some desynchronisation between
65 a8083063 Iustin Pop
  parts of our code. It signifies a real programming bug.
66 a8083063 Iustin Pop

67 a8083063 Iustin Pop
  """
68 a8083063 Iustin Pop
  pass
69 a8083063 Iustin Pop
70 a8083063 Iustin Pop
71 a8083063 Iustin Pop
class BlockDeviceError(GenericError):
72 a8083063 Iustin Pop
  """Block-device related exception.
73 a8083063 Iustin Pop

74 a8083063 Iustin Pop
  This is raised in case we can't setup the instance's block devices
75 a8083063 Iustin Pop
  properly.
76 a8083063 Iustin Pop

77 a8083063 Iustin Pop
  """
78 a8083063 Iustin Pop
  pass
79 a8083063 Iustin Pop
80 a8083063 Iustin Pop
81 a8083063 Iustin Pop
class ConfigurationError(GenericError):
82 a8083063 Iustin Pop
  """Configuration related exception.
83 a8083063 Iustin Pop

84 a8083063 Iustin Pop
  Things like having an instance with a primary node that doesn't
85 a8083063 Iustin Pop
  exist in the config or such raise this exception.
86 a8083063 Iustin Pop

87 a8083063 Iustin Pop
  """
88 a8083063 Iustin Pop
  pass
89 a8083063 Iustin Pop
90 a8083063 Iustin Pop
91 a8083063 Iustin Pop
class RemoteError(GenericError):
92 a8083063 Iustin Pop
  """Programming-related error on remote call.
93 a8083063 Iustin Pop

94 a8083063 Iustin Pop
  This is raised when an unhandled error occurs in a call to a
95 a8083063 Iustin Pop
  remote node.  It usually signifies a real programming bug.
96 a8083063 Iustin Pop

97 a8083063 Iustin Pop
  """
98 a8083063 Iustin Pop
  pass
99 a8083063 Iustin Pop
100 a8083063 Iustin Pop
101 a8083063 Iustin Pop
class InvalidOS(GenericError):
102 a8083063 Iustin Pop
  """Missing OS on node.
103 a8083063 Iustin Pop

104 a8083063 Iustin Pop
  This is raised when an OS exists on the master (or is otherwise
105 a8083063 Iustin Pop
  requested to the code) but not on the target node.
106 a8083063 Iustin Pop

107 305a7297 Guido Trotter
  This exception has three arguments:
108 a8083063 Iustin Pop
    - the name of the os
109 305a7297 Guido Trotter
    - the source directory, if any
110 a8083063 Iustin Pop
    - the reason why we consider this an invalid OS (text of error message)
111 a8083063 Iustin Pop

112 a8083063 Iustin Pop
  """
113 a8083063 Iustin Pop
114 a8083063 Iustin Pop
115 a8083063 Iustin Pop
class ParameterError(GenericError):
116 a8083063 Iustin Pop
  """A passed parameter to a command is invalid.
117 a8083063 Iustin Pop

118 a8083063 Iustin Pop
  This is raised when the parameter passed to a request function is
119 a8083063 Iustin Pop
  invalid. Correct code should have verified this before passing the
120 a8083063 Iustin Pop
  request structure.
121 a8083063 Iustin Pop

122 a8083063 Iustin Pop
  The argument to this exception should be the parameter name.
123 a8083063 Iustin Pop

124 a8083063 Iustin Pop
  """
125 a8083063 Iustin Pop
  pass
126 a8083063 Iustin Pop
127 a8083063 Iustin Pop
128 a8083063 Iustin Pop
class OpPrereqError(GenericError):
129 a8083063 Iustin Pop
  """Prerequisites for the OpCode are not fulfilled.
130 a8083063 Iustin Pop

131 a8083063 Iustin Pop
  """
132 a8083063 Iustin Pop
133 098c0958 Michael Hanselmann
134 a8083063 Iustin Pop
class OpExecError(GenericError):
135 a8083063 Iustin Pop
  """Error during OpCode execution.
136 a8083063 Iustin Pop

137 a8083063 Iustin Pop
  """
138 a8083063 Iustin Pop
139 098c0958 Michael Hanselmann
140 5c947f38 Iustin Pop
class OpRetryError(OpExecError):
141 5c947f38 Iustin Pop
  """Error during OpCode execution, action can be retried.
142 5c947f38 Iustin Pop

143 5c947f38 Iustin Pop
  """
144 5c947f38 Iustin Pop
145 5c947f38 Iustin Pop
146 a8083063 Iustin Pop
class OpCodeUnknown(GenericError):
147 a8083063 Iustin Pop
  """Unknown opcode submitted.
148 a8083063 Iustin Pop

149 a8083063 Iustin Pop
  This signifies a mismatch between the definitions on the client and
150 a8083063 Iustin Pop
  server side.
151 a8083063 Iustin Pop

152 a8083063 Iustin Pop
  """
153 a8083063 Iustin Pop
154 098c0958 Michael Hanselmann
155 89e1fc26 Iustin Pop
class ResolverError(GenericError):
156 89e1fc26 Iustin Pop
  """Host name cannot be resolved.
157 89e1fc26 Iustin Pop

158 89e1fc26 Iustin Pop
  This is not a normal situation for Ganeti, as we rely on having a
159 89e1fc26 Iustin Pop
  working resolver.
160 89e1fc26 Iustin Pop

161 89e1fc26 Iustin Pop
  The non-resolvable hostname is available as the first element of the
162 89e1fc26 Iustin Pop
  args tuple; the other two elements of the tuple are the first two
163 89e1fc26 Iustin Pop
  args of the socket.gaierror exception (error code and description).
164 89e1fc26 Iustin Pop

165 89e1fc26 Iustin Pop
  """
166 89e1fc26 Iustin Pop
167 89e1fc26 Iustin Pop
168 a8083063 Iustin Pop
class HooksFailure(GenericError):
169 a8083063 Iustin Pop
  """A generic hook failure.
170 a8083063 Iustin Pop

171 a8083063 Iustin Pop
  This signifies usually a setup misconfiguration.
172 a8083063 Iustin Pop

173 a8083063 Iustin Pop
  """
174 a8083063 Iustin Pop
175 098c0958 Michael Hanselmann
176 a8083063 Iustin Pop
class HooksAbort(HooksFailure):
177 a8083063 Iustin Pop
  """A required hook has failed.
178 a8083063 Iustin Pop

179 a8083063 Iustin Pop
  This caused an abort of the operation in the initial phase. This
180 a8083063 Iustin Pop
  exception always has an attribute args which is a list of tuples of:
181 a8083063 Iustin Pop
    - node: the source node on which this hooks has failed
182 a8083063 Iustin Pop
    - script: the name of the script which aborted the run
183 a8083063 Iustin Pop

184 a8083063 Iustin Pop
  """
185 a8083063 Iustin Pop
186 098c0958 Michael Hanselmann
187 a8083063 Iustin Pop
class UnitParseError(GenericError):
188 a8083063 Iustin Pop
  """Unable to parse size unit.
189 a8083063 Iustin Pop

190 a8083063 Iustin Pop
  """
191 a8083063 Iustin Pop
192 a8083063 Iustin Pop
193 a8083063 Iustin Pop
class SshKeyError(GenericError):
194 a8083063 Iustin Pop
  """Invalid SSH key.
195 a8083063 Iustin Pop
  """
196 5c947f38 Iustin Pop
197 5c947f38 Iustin Pop
198 5c947f38 Iustin Pop
class TagError(GenericError):
199 5c947f38 Iustin Pop
  """Generic tag error.
200 5c947f38 Iustin Pop

201 5c947f38 Iustin Pop
  The argument to this exception will show the exact error.
202 5c947f38 Iustin Pop

203 5c947f38 Iustin Pop
  """