/
errors.py
332 lines (184 loc) · 6.4 KB
/
errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# errors.py
# Exception classes for anaconda's storage configuration module.
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
# Red Hat Author(s): Dave Lehman <dlehman@redhat.com>
#
from .i18n import N_
class StorageError(Exception):
def __init__(self, *args, **kwargs):
self.hardware_fault = kwargs.pop("hardware_fault", False)
super(StorageError, self).__init__(*args, **kwargs)
class NoDisksError(StorageError):
pass
# Device
class DeviceError(StorageError):
pass
class DeviceCreateError(DeviceError):
pass
class DeviceDestroyError(DeviceError):
pass
class DeviceResizeError(DeviceError):
pass
class DeviceSetupError(DeviceError):
pass
class DeviceTeardownError(DeviceError):
pass
class DeviceUserDeniedFormatError(DeviceError):
pass
class InconsistentPVSectorSize(DeviceError, ValueError):
pass
# DeviceFormat
class DeviceFormatError(StorageError):
pass
class FormatCreateError(DeviceFormatError):
pass
class FormatDestroyError(DeviceFormatError):
pass
class FormatSetupError(DeviceFormatError):
pass
class FormatTeardownError(DeviceFormatError):
pass
class FormatResizeError(DeviceFormatError):
def __init__(self, message, details):
DeviceFormatError.__init__(self, message)
self.details = details
class DMRaidMemberError(DeviceFormatError):
pass
class MultipathMemberError(DeviceFormatError):
pass
class FSError(DeviceFormatError):
pass
class FSWriteLabelError(FSError):
pass
class FSWriteUUIDError(FSError):
pass
class FSReadLabelError(FSError):
pass
class FSResizeError(FSError):
def __init__(self, message, details):
FSError.__init__(self, message)
self.details = details
class LUKSError(DeviceFormatError):
pass
class IntegrityError(LUKSError):
pass
class MDMemberError(DeviceFormatError):
pass
class PhysicalVolumeError(DeviceFormatError):
pass
class SinglePhysicalVolumeError(DeviceFormatError):
pass
class SwapSpaceError(DeviceFormatError):
pass
class DiskLabelError(DeviceFormatError):
pass
class InvalidDiskLabelError(DiskLabelError):
pass
class DiskLabelCommitError(DiskLabelError):
pass
class AlignmentError(DiskLabelError):
pass
# devicelibs
class RaidError(StorageError):
pass
class DMError(StorageError):
pass
class MPathError(StorageError):
pass
class BTRFSError(StorageError):
pass
class BTRFSValueError(BTRFSError, ValueError):
pass
class StratisError(StorageError):
pass
# DeviceTree
class DeviceTreeError(StorageError):
pass
class NoParentsError(DeviceTreeError):
pass
class DeviceNotFoundError(StorageError):
pass
class UnusableConfigurationError(StorageError):
""" User has an unusable initial storage configuration. """
suggestion = ""
def __init__(self, message, dev_name=None):
super(UnusableConfigurationError, self).__init__(message)
self.dev_name = dev_name
class DuplicateUUIDError(UnusableConfigurationError, ValueError):
suggestion = N_("This is usually caused by cloning the device image resulting "
"in duplication of the UUID value which should be unique. "
"In that case you can either disconnect one of the devices or "
"reformat it.")
class DiskLabelScanError(UnusableConfigurationError):
suggestion = N_("For some reason we were unable to locate a disklabel on a "
"disk that the kernel is reporting partitions on. It is "
"unclear what the exact problem is. Please file a bug at "
"http://bugzilla.redhat.com")
class CorruptGPTError(UnusableConfigurationError):
suggestion = N_("Either restore the disklabel to a completely working "
"state or remove it completely.\n"
"Hint: parted can restore it or wipefs can remove it.")
class DuplicateVGError(UnusableConfigurationError):
suggestion = N_("Rename one of the volume groups so the names are "
"distinct.\n"
"Hint 1: vgrename accepts UUID in place of the old name.\n"
"Hint 2: You can get the VG UUIDs by running "
"'pvs -o +vg_uuid'.")
class InvalidMultideviceSelection(UnusableConfigurationError):
suggestion = N_("All parent devices must be selected when choosing exclusive "
"or ignored disks for a multipath or firmware RAID device.")
# DeviceAction
class DeviceActionError(StorageError):
pass
# partitioning
class PartitioningError(StorageError):
pass
class NotEnoughFreeSpaceError(StorageError):
pass
# udev
class UdevError(StorageError):
pass
# fstab
class UnrecognizedFSTabEntryError(StorageError):
pass
class FSTabTypeMismatchError(StorageError):
pass
# factories
class DeviceFactoryError(StorageError):
pass
class AvailabilityError(StorageError):
""" Raised if problem determining availability of external resource. """
class EventManagerError(StorageError):
pass
class EventParamError(StorageError):
pass
# external dependencies
class DependencyError(StorageError):
"""Raised when an external dependency is missing or not available"""
class EventHandlingError(StorageError):
pass
class ThreadError(StorageError):
""" An error occurred in a non-main thread. """
# other
class FCoEError(StorageError, OSError):
pass
class ISCSIError(StorageError, OSError):
pass
class NVMeError(StorageError, OSError):
pass