Statistics
| Branch: | Tag: | Revision:

root / lib / errors.py @ 5c947f38

History | View | Annotate | Download (3.9 kB)

1 a8083063 Iustin Pop
#!/usr/bin/python
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 a8083063 Iustin Pop
  This exception has two arguments:
108 a8083063 Iustin Pop
    - the name of the os
109 a8083063 Iustin Pop
    - the reason why we consider this an invalid OS (text of error message)
110 a8083063 Iustin Pop

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

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

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

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

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

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

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

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

151 a8083063 Iustin Pop
  """
152 a8083063 Iustin Pop
153 098c0958 Michael Hanselmann
154 a8083063 Iustin Pop
class HooksFailure(GenericError):
155 a8083063 Iustin Pop
  """A generic hook failure.
156 a8083063 Iustin Pop

157 a8083063 Iustin Pop
  This signifies usually a setup misconfiguration.
158 a8083063 Iustin Pop

159 a8083063 Iustin Pop
  """
160 a8083063 Iustin Pop
161 098c0958 Michael Hanselmann
162 a8083063 Iustin Pop
class HooksAbort(HooksFailure):
163 a8083063 Iustin Pop
  """A required hook has failed.
164 a8083063 Iustin Pop

165 a8083063 Iustin Pop
  This caused an abort of the operation in the initial phase. This
166 a8083063 Iustin Pop
  exception always has an attribute args which is a list of tuples of:
167 a8083063 Iustin Pop
    - node: the source node on which this hooks has failed
168 a8083063 Iustin Pop
    - script: the name of the script which aborted the run
169 a8083063 Iustin Pop

170 a8083063 Iustin Pop
  """
171 a8083063 Iustin Pop
172 098c0958 Michael Hanselmann
173 a8083063 Iustin Pop
class UnitParseError(GenericError):
174 a8083063 Iustin Pop
  """Unable to parse size unit.
175 a8083063 Iustin Pop

176 a8083063 Iustin Pop
  """
177 a8083063 Iustin Pop
178 a8083063 Iustin Pop
179 a8083063 Iustin Pop
class SshKeyError(GenericError):
180 a8083063 Iustin Pop
  """Invalid SSH key.
181 a8083063 Iustin Pop
  """
182 5c947f38 Iustin Pop
183 5c947f38 Iustin Pop
184 5c947f38 Iustin Pop
class TagError(GenericError):
185 5c947f38 Iustin Pop
  """Generic tag error.
186 5c947f38 Iustin Pop

187 5c947f38 Iustin Pop
  The argument to this exception will show the exact error.
188 5c947f38 Iustin Pop

189 5c947f38 Iustin Pop
  """