Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 571 lines (325 sloc) 15.499 kb
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
1 # vim: tabstop=4 shiftwidth=4 softtabstop=4
caeece6 Updated licenses
Devin Carlen authored
2
3 # Copyright 2010 United States Government as represented by the
4ba6802 Vish Ishaya Removed trailing whitespace from header
vishvananda authored
4 # Administrator of the National Aeronautics and Space Administration.
caeece6 Updated licenses
Devin Carlen authored
5 # All Rights Reserved.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License"); you may
8 # not use this file except in compliance with the License. You may obtain
9 # a copy of the License at
9451872 Jesse Andrews Merged Vish's work on adding projects to nova
anotherjesse authored
10 #
caeece6 Updated licenses
Devin Carlen authored
11 # http://www.apache.org/licenses/LICENSE-2.0
9451872 Jesse Andrews Merged Vish's work on adding projects to nova
anotherjesse authored
12 #
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
13 # Unless required by applicable law or agreed to in writing, software
caeece6 Updated licenses
Devin Carlen authored
14 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 # License for the specific language governing permissions and limitations
17 # under the License.
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
18
f69600e Andy Smith docstring cleanup, nova dir
termie authored
19 """Nova base exception handling.
20
21 Includes decorator for re-raising Nova-type exceptions.
22
23 SHOULD include dedicated exception logging.
24
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
25 """
26
c7305af Todd Willey Apply logging changes as a giant patch to work around the cloudpipe dele...
xtoddx authored
27 from nova import log as logging
f69600e Andy Smith docstring cleanup, nova dir
termie authored
28
29
c7305af Todd Willey Apply logging changes as a giant patch to work around the cloudpipe dele...
xtoddx authored
30 LOG = logging.getLogger('nova.exception')
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
31
d508418 Andy Smith rather comprehensive style fixes
termie authored
32
fc5e1c6 Vish Ishaya a few formatting fixes and moved exception
vishvananda authored
33 class ProcessExecutionError(IOError):
34 def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
35 description=None):
36 if description is None:
f69600e Andy Smith docstring cleanup, nova dir
termie authored
37 description = _('Unexpected error while running command.')
fc5e1c6 Vish Ishaya a few formatting fixes and moved exception
vishvananda authored
38 if exit_code is None:
39 exit_code = '-'
f69600e Andy Smith docstring cleanup, nova dir
termie authored
40 message = _('%(description)s\nCommand: %(cmd)s\n'
41 'Exit code: %(exit_code)s\nStdout: %(stdout)r\n'
42 'Stderr: %(stderr)r') % locals()
fc5e1c6 Vish Ishaya a few formatting fixes and moved exception
vishvananda authored
43 IOError.__init__(self, message)
44
45
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
46 class Error(Exception):
9451872 Jesse Andrews Merged Vish's work on adding projects to nova
anotherjesse authored
47 def __init__(self, message=None):
48 super(Error, self).__init__(message)
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
49
d508418 Andy Smith rather comprehensive style fixes
termie authored
50
9451872 Jesse Andrews Merged Vish's work on adding projects to nova
anotherjesse authored
51 class ApiError(Error):
430975c ApiError code should default to None, and will only display a code if on...
John Tran authored
52 def __init__(self, message='Unknown', code=None):
8d9e8ea merging trunk; resolving conflicts; fixing issue with ApiError test fail...
Brian Waldon authored
53 self.msg = message
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
54 self.code = code
430975c ApiError code should default to None, and will only display a code if on...
John Tran authored
55 if code:
56 outstr = '%s: %s' % (code, message)
57 else:
58 outstr = '%s' % message
59 super(ApiError, self).__init__(outstr)
e66f301 Ed Leafe Got the basic 'set admin password' stuff working
EdLeafe authored
60
61
1ecd9b3 adding 'building' power state; testing for 409 from OSAPI when rebuild r...
Brian Waldon authored
62 class BuildInProgress(Error):
63 pass
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
64
d508418 Andy Smith rather comprehensive style fixes
termie authored
65
9bdcc71 Vish Ishaya wrap sqlalchemy exceptions in a generic error
vishvananda authored
66 class DBError(Error):
f69600e Andy Smith docstring cleanup, nova dir
termie authored
67 """Wraps an implementation specific exception."""
9bdcc71 Vish Ishaya wrap sqlalchemy exceptions in a generic error
vishvananda authored
68 def __init__(self, inner_exception):
69 self.inner_exception = inner_exception
70 super(DBError, self).__init__(str(inner_exception))
71
72
73 def wrap_db_error(f):
74 def _wrap(*args, **kwargs):
75 try:
76 return f(*args, **kwargs)
77 except Exception, e:
f69600e Andy Smith docstring cleanup, nova dir
termie authored
78 LOG.exception(_('DB exception wrapped.'))
9bdcc71 Vish Ishaya wrap sqlalchemy exceptions in a generic error
vishvananda authored
79 raise DBError(e)
80 return _wrap
81 _wrap.func_name = f.func_name
82
83
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
84 def wrap_exception(f):
85 def _wrap(*args, **kw):
86 try:
87 return f(*args, **kw)
88 except Exception, e:
89 if not isinstance(e, Error):
3c8efde Vish Ishaya trackback formatting isn't logging correctly
vishvananda authored
90 #exc_type, exc_value, exc_traceback = sys.exc_info()
c7305af Todd Willey Apply logging changes as a giant patch to work around the cloudpipe dele...
xtoddx authored
91 LOG.exception(_('Uncaught exception'))
3c8efde Vish Ishaya trackback formatting isn't logging correctly
vishvananda authored
92 #logging.error(traceback.extract_stack(exc_traceback))
bf6e6e7 Jesse Andrews initial commit
anotherjesse authored
93 raise Error(str(e))
94 raise
95 _wrap.func_name = f.func_name
96 return _wrap
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
97
98
99 class NovaException(Exception):
8762168 adding documentation & error handling
Brian Waldon authored
100 """Base Nova Exception
101
102 To correctly use this class, inherit from it and define
103 a 'message' property. That message will get printf'd
104 with the keyword arguments provided to the constructor.
105
106 """
f5ef0e4 one last i18n string
Brian Waldon authored
107 message = _("An unknown exception occurred.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
108
109 def __init__(self, **kwargs):
8762168 adding documentation & error handling
Brian Waldon authored
110 try:
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
111 self._error_string = self.message % kwargs
8762168 adding documentation & error handling
Brian Waldon authored
112
113 except Exception:
114 # at least get the core message out if something happened
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
115 self._error_string = self.message
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
116
117 def __str__(self):
118 return self._error_string
119
120
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
121 class NotAuthorized(NovaException):
122 message = _("Not authorized.")
123
124 def __init__(self, *args, **kwargs):
125 super(NotFound, self).__init__(**kwargs)
126
127
128 class AdminRequired(NotAuthorized):
129 message = _("User does not have admin privileges")
130
131
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
132 class Invalid(NovaException):
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
133 message = _("Unacceptable parameters.")
134
135
136 class InvalidSignature(Invalid):
137 message = _("Invalid signature %(signature)s for user %(user)s.")
138
139
140 class InvalidInput(Invalid):
141 message = _("Invalid input received") + ": %(reason)s"
142
143
144 class InvalidInstanceType(Invalid):
145 message = _("Invalid instance type %(instance_type)s.")
146
147
148 class InvalidPortRange(Invalid):
149 message = _("Invalid port range %(from_port)s:%(to_port)s.")
150
151
152 class InvalidIpProtocol(Invalid):
153 message = _("Invalid IP protocol %(protocol)s.")
154
155
156 class InvalidContentType(Invalid):
157 message = _("Invalid content type %(content_type)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
158
159
160 class InstanceNotRunning(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
161 message = _("Instance %(instance_id)s is not running.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
162
163
164 class InstanceNotSuspended(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
165 message = _("Instance %(instance_id)s is not suspended.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
166
167
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
168 class InstanceNotInRescueMode(Invalid):
169 message = _("Instance %(instance_id)s is not in rescue mode")
170
171
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
172 class InstanceSuspendFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
173 message = _("Failed to suspend instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
174
175
176 class InstanceResumeFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
177 message = _("Failed to resume server") + ": %(reason)s."
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
178
179
180 class InstanceRebootFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
181 message = _("Failed to reboot instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
182
183
184 class ServiceUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
185 message = _("Service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
186
187
188 class VolumeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
189 message = _("Volume service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
190
191
192 class ComputeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
193 message = _("Compute service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
194
195
196 class UnableToMigrateToSelf(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
197 message = _("Unable to migrate instance (%(instance_id)s) "
7b5cf70 multi-line string spacing
Brian Waldon authored
198 "to current host (%(host)s).")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
199
200
201 class SourceHostUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
202 message = _("Original compute host is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
203
204
205 class InvalidHypervisorType(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
206 message = _("The supplied hypervisor type of is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
207
208
209 class DestinationHypervisorTooOld(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
210 message = _("The instance requires a newer hypervisor version than "
7b5cf70 multi-line string spacing
Brian Waldon authored
211 "has been provided.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
212
213
214 class InvalidDevicePath(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
215 message = _("The supplied device path (%(path)s) is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
216
217
218 class InvalidCPUInfo(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
219 message = _("Unacceptable CPU info") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
220
221
222 class InvalidVLANTag(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
223 message = _("VLAN tag is not appropriate for the port group "
7b5cf70 multi-line string spacing
Brian Waldon authored
224 "%(bridge)s. Expected VLAN tag is %(tag)s, "
225 "but the one associated with the port group is %(pgroup)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
226
227
228 class InvalidVLANPortGroup(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
229 message = _("vSwitch which contains the port group %(bridge)s is "
7b5cf70 multi-line string spacing
Brian Waldon authored
230 "not associated with the desired physical adapter. "
231 "Expected vSwitch is %(expected)s, but the one associated "
232 "is %(actual)s.")
ad138a5 correcting tests; pep8
Brian Waldon authored
233
234
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
235 class InvalidDiskFormat(Invalid):
236 message = _("Disk format %(disk_format)s is not acceptable")
237
238
ad138a5 correcting tests; pep8
Brian Waldon authored
239 class ImageUnacceptable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
240 message = _("Image %(image_id)s is unacceptable") + ": %(reason)s"
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
241
242
243 class InstanceUnacceptable(Invalid):
244 message = _("Instance %(instance_id)s is unacceptable") + ": %(reason)s"
245
246
3b0b69d Vish Ishaya make sure proper exceptions are raised for ec2 id conversion and add tes...
vishvananda authored
247 class InvalidEc2Id(Invalid):
248 message = _("Ec2 id %(ec2_id)s is unacceptable.")
249
250
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
251 class NotFound(NovaException):
252 message = _("Resource could not be found.")
253
254 def __init__(self, *args, **kwargs):
255 super(NotFound, self).__init__(**kwargs)
256
257
01f7b0a Rick Harris Adding FlagNotSet exception
rconradharris authored
258 class FlagNotSet(NotFound):
259 message = _("Required flag %(flag)s not set.")
260
261
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
262 class InstanceNotFound(NotFound):
263 message = _("Instance %(instance_id)s could not be found.")
264
265
266 class VolumeNotFound(NotFound):
267 message = _("Volume %(volume_id)s could not be found.")
268
269
270 class VolumeNotFoundForInstance(VolumeNotFound):
271 message = _("Volume not found for instance %(instance_id)s.")
272
273
2ecfa05 MORITA Kazutaka Merge trunk
kazum authored
274 class SnapshotNotFound(NotFound):
275 message = _("Snapshot %(snapshot_id)s could not be found.")
276
277
4f7cfba yamahata volume/driver: implement basic snapshot
yamahata authored
278 class VolumeIsBusy(Error):
279 message = _("deleting volume %(volume_name)s that has snapshot")
280
281
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
282 class ExportDeviceNotFoundForVolume(NotFound):
283 message = _("No export device found for volume %(volume_id)s.")
284
285
286 class ISCSITargetNotFoundForVolume(NotFound):
287 message = _("No target id found for volume %(volume_id)s.")
288
289
290 class DiskNotFound(NotFound):
291 message = _("No disk at %(location)s")
292
293
294 class ImageNotFound(NotFound):
295 message = _("Image %(image_id)s could not be found.")
296
297
298 class KernelNotFoundForImage(ImageNotFound):
299 message = _("Kernel not found for image %(image_id)s.")
300
301
302 class RamdiskNotFoundForImage(ImageNotFound):
303 message = _("Ramdisk not found for image %(image_id)s.")
304
305
306 class UserNotFound(NotFound):
307 message = _("User %(user_id)s could not be found.")
308
309
310 class ProjectNotFound(NotFound):
311 message = _("Project %(project_id)s could not be found.")
312
313
314 class ProjectMembershipNotFound(NotFound):
315 message = _("User %(user_id)s is not a member of project %(project_id)s.")
316
317
318 class UserRoleNotFound(NotFound):
319 message = _("Role %(role_id)s could not be found.")
320
321
322 class StorageRepositoryNotFound(NotFound):
323 message = _("Cannot find SR to read/write VDI.")
324
325
326 class NetworkNotFound(NotFound):
327 message = _("Network %(network_id)s could not be found.")
328
329
330 class NetworkNotFoundForBridge(NetworkNotFound):
331 message = _("Network could not be found for bridge %(bridge)s")
332
333
334 class NetworkNotFoundForCidr(NetworkNotFound):
335 message = _("Network could not be found with cidr %(cidr)s.")
336
337
338 class NetworkNotFoundForInstance(NetworkNotFound):
339 message = _("Network could not be found for instance %(instance_id)s.")
340
341
342 class NoNetworksFound(NotFound):
343 message = _("No networks defined.")
344
345
346 class DatastoreNotFound(NotFound):
347 message = _("Could not find the datastore reference(s) which the VM uses.")
348
349
350 class NoFixedIpsFoundForInstance(NotFound):
351 message = _("Instance %(instance_id)s has zero fixed ips.")
352
353
354 class FloatingIpNotFound(NotFound):
355 message = _("Floating ip not found for fixed address %(fixed_ip)s.")
356
357
358 class NoFloatingIpsDefined(NotFound):
359 message = _("Zero floating ips could be found.")
360
361
362 class NoFloatingIpsDefinedForHost(NoFloatingIpsDefined):
363 message = _("Zero floating ips defined for host %(host)s.")
364
365
366 class NoFloatingIpsDefinedForInstance(NoFloatingIpsDefined):
367 message = _("Zero floating ips defined for instance %(instance_id)s.")
368
369
370 class KeypairNotFound(NotFound):
371 message = _("Keypair %(keypair_name)s not found for user %(user_id)s")
372
373
374 class CertificateNotFound(NotFound):
375 message = _("Certificate %(certificate_id)s not found.")
376
377
378 class ServiceNotFound(NotFound):
379 message = _("Service %(service_id)s could not be found.")
380
381
382 class HostNotFound(NotFound):
383 message = _("Host %(host)s could not be found.")
384
385
386 class ComputeHostNotFound(HostNotFound):
387 message = _("Compute host %(host)s could not be found.")
388
389
390 class HostBinaryNotFound(NotFound):
391 message = _("Could not find binary %(binary)s on host %(host)s.")
392
393
394 class AuthTokenNotFound(NotFound):
395 message = _("Auth token %(token)s could not be found.")
396
397
398 class AccessKeyNotFound(NotFound):
399 message = _("Access Key %(access_key)s could not be found.")
400
401
402 class QuotaNotFound(NotFound):
403 message = _("Quota could not be found")
404
405
406 class ProjectQuotaNotFound(QuotaNotFound):
407 message = _("Quota for project %(project_id)s could not be found.")
408
409
410 class SecurityGroupNotFound(NotFound):
411 message = _("Security group %(security_group_id)s not found.")
412
413
414 class SecurityGroupNotFoundForProject(SecurityGroupNotFound):
415 message = _("Security group %(security_group_id)s not found "
416 "for project %(project_id)s.")
417
418
419 class SecurityGroupNotFoundForRule(SecurityGroupNotFound):
420 message = _("Security group with rule %(rule_id)s not found.")
421
422
423 class MigrationNotFound(NotFound):
424 message = _("Migration %(migration_id)s could not be found.")
425
426
427 class MigrationNotFoundByStatus(MigrationNotFound):
428 message = _("Migration not found for instance %(instance_id)s "
429 "with status %(status)s.")
430
431
432 class ConsolePoolNotFound(NotFound):
433 message = _("Console pool %(pool_id)s could not be found.")
434
435
436 class ConsolePoolNotFoundForHostType(NotFound):
437 message = _("Console pool of type %(console_type)s "
438 "for compute host %(compute_host)s "
439 "on proxy host %(host)s not found.")
440
441
442 class ConsoleNotFound(NotFound):
443 message = _("Console %(console_id)s could not be found.")
444
445
446 class ConsoleNotFoundForInstance(ConsoleNotFound):
447 message = _("Console for instance %(instance_id)s could not be found.")
448
449
450 class ConsoleNotFoundInPoolForInstance(ConsoleNotFound):
451 message = _("Console for instance %(instance_id)s "
452 "in pool %(pool_id)s could not be found.")
453
454
455 class NoInstanceTypesFound(NotFound):
456 message = _("Zero instance types found.")
457
458
459 class InstanceTypeNotFound(NotFound):
460 message = _("Instance type %(instance_type_id)s could not be found.")
461
462
463 class InstanceTypeNotFoundByName(InstanceTypeNotFound):
464 message = _("Instance type with name %(instance_type_name)s "
465 "could not be found.")
466
467
468 class FlavorNotFound(NotFound):
469 message = _("Flavor %(flavor_id)s could not be found.")
470
471
472 class ZoneNotFound(NotFound):
473 message = _("Zone %(zone_id)s could not be found.")
474
475
714fe83 Sandy Walsh get rid of all mention of drivers ... it's filter only now
SandyWalsh authored
476 class SchedulerHostFilterNotFound(NotFound):
477 message = _("Scheduler Host Filter %(filter_name)s could not be found.")
f50c726 Sandy Walsh tests and better driver loading
SandyWalsh authored
478
479
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
480 class InstanceMetadataNotFound(NotFound):
481 message = _("Instance %(instance_id)s has no metadata with "
482 "key %(metadata_key)s.")
483
69a4974 Fixing pep8 problems
Lorin Hochstein authored
484
d68f6de Rename: intance_type_metadata -> instance_type_extra_specs
Lorin Hochstein authored
485 class InstanceTypeExtraSpecsNotFound(NotFound):
486 message = _("Instance Type %(instance_type_id)s has no extra specs with "
487 "key %(extra_specs_key)s.")
65c2675 Adding accessor methods for instance type metadata
Lorin Hochstein authored
488
489
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
490 class LDAPObjectNotFound(NotFound):
491 message = _("LDAP object could not be found")
492
493
494 class LDAPUserNotFound(LDAPObjectNotFound):
495 message = _("LDAP user %(user_id)s could not be found.")
496
497
498 class LDAPGroupNotFound(LDAPObjectNotFound):
499 message = _("LDAP group %(group_id)s could not be found.")
500
501
502 class LDAPGroupMembershipNotFound(NotFound):
503 message = _("LDAP user %(user_id)s is not a member of group %(group_id)s.")
504
505
506 class FileNotFound(NotFound):
507 message = _("File %(file_path)s could not be found.")
508
509
510 class NoFilesFound(NotFound):
511 message = _("Zero files could be found.")
512
513
514 class SwitchNotFoundForNetworkAdapter(NotFound):
515 message = _("Virtual switch associated with the "
516 "network adapter %(adapter)s not found.")
517
518
519 class NetworkAdapterNotFound(NotFound):
520 message = _("Network adapter %(adapter)s could not be found.")
521
522
523 class ClassNotFound(NotFound):
524 message = _("Class %(class_name)s could not be found")
525
526
527 class NotAllowed(NovaException):
528 message = _("Action not allowed.")
529
530
531 class GlobalRoleNotAllowed(NotAllowed):
532 message = _("Unable to use global role %(role_id)s")
64f4032 merging trunk
Brian Waldon authored
533
534
1378b11 refactoring usage of exception.Duplicate errors
Brian Waldon authored
535 #TODO(bcwaldon): EOL this exception!
536 class Duplicate(NovaException):
537 pass
538
539
540 class KeyPairExists(Duplicate):
541 message = _("Key pair %(key_name)s already exists.")
542
543
544 class UserExists(Duplicate):
545 message = _("User %(user)s already exists.")
546
547
548 class LDAPUserExists(UserExists):
549 message = _("LDAP user %(user)s already exists.")
550
551
552 class LDAPGroupExists(Duplicate):
553 message = _("LDAP group %(group)s already exists.")
554
555
556 class LDAPMembershipExists(Duplicate):
557 message = _("User %(uid)s is already a member of "
558 "the group %(group_dn)s")
559
560
561 class ProjectExists(Duplicate):
562 message = _("Project %(project)s already exists.")
563
564
565 class InstanceExists(Duplicate):
566 message = _("Instance %(name)s already exists.")
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
567
568
569 class MigrationError(NovaException):
570 message = _("Migration error") + ": %(reason)s"
Something went wrong with that request. Please try again.