Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 655 lines (369 sloc) 17.798 kB
bf6e6e7 @anotherjesse 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 @vishvananda 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 @anotherjesse 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 @anotherjesse Merged Vish's work on adding projects to nova
anotherjesse authored
12 #
bf6e6e7 @anotherjesse 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 @anotherjesse initial commit
anotherjesse authored
18
f69600e @termie 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 @anotherjesse initial commit
anotherjesse authored
25 """
26
c7305af @xtoddx Apply logging changes as a giant patch to work around the cloudpipe d…
xtoddx authored
27 from nova import log as logging
f69600e @termie docstring cleanup, nova dir
termie authored
28
29
c7305af @xtoddx Apply logging changes as a giant patch to work around the cloudpipe d…
xtoddx authored
30 LOG = logging.getLogger('nova.exception')
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
31
d508418 @termie rather comprehensive style fixes
termie authored
32
fc5e1c6 @vishvananda 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 @termie docstring cleanup, nova dir
termie authored
37 description = _('Unexpected error while running command.')
fc5e1c6 @vishvananda a few formatting fixes and moved exception
vishvananda authored
38 if exit_code is None:
39 exit_code = '-'
f69600e @termie 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 @vishvananda a few formatting fixes and moved exception
vishvananda authored
43 IOError.__init__(self, message)
44
45
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
46 class Error(Exception):
9451872 @anotherjesse Merged Vish's work on adding projects to nova
anotherjesse authored
47 def __init__(self, message=None):
48 super(Error, self).__init__(message)
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
49
d508418 @termie rather comprehensive style fixes
termie authored
50
9451872 @anotherjesse 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…
John Tran authored
52 def __init__(self, message='Unknown', code=None):
8d9e8ea merging trunk; resolving conflicts; fixing issue with ApiError test f…
Brian Waldon authored
53 self.msg = message
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
54 self.code = code
430975c ApiError code should default to None, and will only display a code if…
John Tran authored
55 if code:
56 outstr = '%s: %s' % (code, message)
57 else:
58 outstr = '%s' % message
59 super(ApiError, self).__init__(outstr)
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
60
d508418 @termie rather comprehensive style fixes
termie authored
61
1ecd9b3 adding 'building' power state; testing for 409 from OSAPI when rebuil…
Brian Waldon authored
62 class BuildInProgress(Error):
e66f301 @EdLeafe Got the basic 'set admin password' stuff working
EdLeafe authored
63 pass
64
65
9bdcc71 @vishvananda wrap sqlalchemy exceptions in a generic error
vishvananda authored
66 class DBError(Error):
f69600e @termie docstring cleanup, nova dir
termie authored
67 """Wraps an implementation specific exception."""
ae18421 @vishvananda Tests to assure all exceptions can be raised as well as fixing NotAut…
vishvananda authored
68 def __init__(self, inner_exception=None):
9bdcc71 @vishvananda wrap sqlalchemy exceptions in a generic error
vishvananda authored
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 @termie docstring cleanup, nova dir
termie authored
78 LOG.exception(_('DB exception wrapped.'))
9bdcc71 @vishvananda 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 @anotherjesse 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 @vishvananda trackback formatting isn't logging correctly
vishvananda authored
90 #exc_type, exc_value, exc_traceback = sys.exc_info()
c7305af @xtoddx Apply logging changes as a giant patch to work around the cloudpipe d…
xtoddx authored
91 LOG.exception(_('Uncaught exception'))
3c8efde @vishvananda trackback formatting isn't logging correctly
vishvananda authored
92 #logging.error(traceback.extract_stack(exc_traceback))
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
93 raise Error(str(e))
94 raise
95 _wrap.func_name = f.func_name
96 return _wrap
093c820 @tr3buchet committing to share
tr3buchet authored
97
98
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
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
0502a2b @tr3buchet updated the exceptions around virtual interface creation, updated fla…
tr3buchet authored
121 class VirtualInterfaceCreateException(NovaException):
122 message = _("Virtual Interface creation failed")
123
124
a2f9e4b @tr3buchet renamed VirtualInterface exception and extend NovaException
tr3buchet authored
125 class VirtualInterfaceMacAddressException(NovaException):
126 message = _("5 attempts to create virtual interface"
127 "with unique mac address failed")
0438855 @tr3buchet removed network_info shims in vmops
tr3buchet authored
128
129
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
130 class NotAuthorized(NovaException):
131 message = _("Not authorized.")
132
133 def __init__(self, *args, **kwargs):
ae18421 @vishvananda Tests to assure all exceptions can be raised as well as fixing NotAut…
vishvananda authored
134 super(NotAuthorized, self).__init__(**kwargs)
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
135
136
137 class AdminRequired(NotAuthorized):
138 message = _("User does not have admin privileges")
139
140
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
141 class Invalid(NovaException):
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
142 message = _("Unacceptable parameters.")
143
144
145 class InvalidSignature(Invalid):
146 message = _("Invalid signature %(signature)s for user %(user)s.")
147
148
149 class InvalidInput(Invalid):
150 message = _("Invalid input received") + ": %(reason)s"
151
152
153 class InvalidInstanceType(Invalid):
154 message = _("Invalid instance type %(instance_type)s.")
155
156
157 class InvalidPortRange(Invalid):
158 message = _("Invalid port range %(from_port)s:%(to_port)s.")
159
160
161 class InvalidIpProtocol(Invalid):
162 message = _("Invalid IP protocol %(protocol)s.")
163
164
165 class InvalidContentType(Invalid):
166 message = _("Invalid content type %(content_type)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
167
168
169 class InstanceNotRunning(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
170 message = _("Instance %(instance_id)s is not running.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
171
172
173 class InstanceNotSuspended(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
174 message = _("Instance %(instance_id)s is not suspended.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
175
176
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
177 class InstanceNotInRescueMode(Invalid):
178 message = _("Instance %(instance_id)s is not in rescue mode")
179
180
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
181 class InstanceSuspendFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
182 message = _("Failed to suspend instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
183
184
185 class InstanceResumeFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
186 message = _("Failed to resume server") + ": %(reason)s."
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
187
188
189 class InstanceRebootFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
190 message = _("Failed to reboot instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
191
192
193 class ServiceUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
194 message = _("Service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
195
196
197 class VolumeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
198 message = _("Volume service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
199
200
201 class ComputeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
202 message = _("Compute service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
203
204
205 class UnableToMigrateToSelf(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
206 message = _("Unable to migrate instance (%(instance_id)s) "
7b5cf70 multi-line string spacing
Brian Waldon authored
207 "to current host (%(host)s).")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
208
209
210 class SourceHostUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
211 message = _("Original compute host is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
212
213
214 class InvalidHypervisorType(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
215 message = _("The supplied hypervisor type of is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
216
217
218 class DestinationHypervisorTooOld(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
219 message = _("The instance requires a newer hypervisor version than "
7b5cf70 multi-line string spacing
Brian Waldon authored
220 "has been provided.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
221
222
223 class InvalidDevicePath(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
224 message = _("The supplied device path (%(path)s) is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
225
226
227 class InvalidCPUInfo(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
228 message = _("Unacceptable CPU info") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
229
230
231 class InvalidVLANTag(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
232 message = _("VLAN tag is not appropriate for the port group "
7b5cf70 multi-line string spacing
Brian Waldon authored
233 "%(bridge)s. Expected VLAN tag is %(tag)s, "
234 "but the one associated with the port group is %(pgroup)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
235
236
237 class InvalidVLANPortGroup(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
238 message = _("vSwitch which contains the port group %(bridge)s is "
7b5cf70 multi-line string spacing
Brian Waldon authored
239 "not associated with the desired physical adapter. "
240 "Expected vSwitch is %(expected)s, but the one associated "
241 "is %(actual)s.")
ad138a5 correcting tests; pep8
Brian Waldon authored
242
243
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
244 class InvalidDiskFormat(Invalid):
245 message = _("Disk format %(disk_format)s is not acceptable")
246
247
ad138a5 correcting tests; pep8
Brian Waldon authored
248 class ImageUnacceptable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
249 message = _("Image %(image_id)s is unacceptable") + ": %(reason)s"
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
250
251
252 class InstanceUnacceptable(Invalid):
253 message = _("Instance %(instance_id)s is unacceptable") + ": %(reason)s"
254
255
3b0b69d @vishvananda make sure proper exceptions are raised for ec2 id conversion and add …
vishvananda authored
256 class InvalidEc2Id(Invalid):
257 message = _("Ec2 id %(ec2_id)s is unacceptable.")
258
259
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
260 class NotFound(NovaException):
261 message = _("Resource could not be found.")
262
263 def __init__(self, *args, **kwargs):
264 super(NotFound, self).__init__(**kwargs)
265
266
01f7b0a @rconradharris Adding FlagNotSet exception
rconradharris authored
267 class FlagNotSet(NotFound):
268 message = _("Required flag %(flag)s not set.")
269
270
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
271 class InstanceNotFound(NotFound):
272 message = _("Instance %(instance_id)s could not be found.")
273
274
275 class VolumeNotFound(NotFound):
276 message = _("Volume %(volume_id)s could not be found.")
277
278
279 class VolumeNotFoundForInstance(VolumeNotFound):
280 message = _("Volume not found for instance %(instance_id)s.")
281
282
2ecfa05 @kazum Merge trunk
kazum authored
283 class SnapshotNotFound(NotFound):
284 message = _("Snapshot %(snapshot_id)s could not be found.")
285
286
4f7cfba @yamahata volume/driver: implement basic snapshot
yamahata authored
287 class VolumeIsBusy(Error):
288 message = _("deleting volume %(volume_name)s that has snapshot")
289
290
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
291 class ExportDeviceNotFoundForVolume(NotFound):
292 message = _("No export device found for volume %(volume_id)s.")
293
294
295 class ISCSITargetNotFoundForVolume(NotFound):
296 message = _("No target id found for volume %(volume_id)s.")
297
298
299 class DiskNotFound(NotFound):
300 message = _("No disk at %(location)s")
301
302
e16b2d2 @ironcamel Fixed some tests.
ironcamel authored
303 class InvalidImageRef(Invalid):
099c295 @ironcamel Handle the case when a v1.0 api tries to list servers that contain im…
ironcamel authored
304 message = _("Invalid image href %(image_href)s.")
305
306
307 class ListingImageRefsNotSupported(Invalid):
308 message = _("Some images have been stored via hrefs."
309 + " This version of the api does not support displaying image hrefs.")
e16b2d2 @ironcamel Fixed some tests.
ironcamel authored
310
311
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
312 class ImageNotFound(NotFound):
313 message = _("Image %(image_id)s could not be found.")
314
315
316 class KernelNotFoundForImage(ImageNotFound):
317 message = _("Kernel not found for image %(image_id)s.")
318
319
320 class RamdiskNotFoundForImage(ImageNotFound):
321 message = _("Ramdisk not found for image %(image_id)s.")
322
323
324 class UserNotFound(NotFound):
325 message = _("User %(user_id)s could not be found.")
326
327
328 class ProjectNotFound(NotFound):
329 message = _("Project %(project_id)s could not be found.")
330
331
332 class ProjectMembershipNotFound(NotFound):
333 message = _("User %(user_id)s is not a member of project %(project_id)s.")
334
335
336 class UserRoleNotFound(NotFound):
337 message = _("Role %(role_id)s could not be found.")
338
339
340 class StorageRepositoryNotFound(NotFound):
341 message = _("Cannot find SR to read/write VDI.")
342
343
344 class NetworkNotFound(NotFound):
345 message = _("Network %(network_id)s could not be found.")
346
347
348 class NetworkNotFoundForBridge(NetworkNotFound):
349 message = _("Network could not be found for bridge %(bridge)s")
350
351
352 class NetworkNotFoundForCidr(NetworkNotFound):
353 message = _("Network could not be found with cidr %(cidr)s.")
354
355
356 class NetworkNotFoundForInstance(NetworkNotFound):
357 message = _("Network could not be found for instance %(instance_id)s.")
358
359
360 class NoNetworksFound(NotFound):
361 message = _("No networks defined.")
362
363
364 class DatastoreNotFound(NotFound):
365 message = _("Could not find the datastore reference(s) which the VM uses.")
366
367
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
368 class FixedIpNotFound(NotFound):
369 message = _("No fixed IP associated with id %(id)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
370
371
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
372 class FixedIpNotFoundForAddress(FixedIpNotFound):
373 message = _("Fixed ip not found for address %(address)s.")
374
375
376 class FixedIpNotFoundForInstance(FixedIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
377 message = _("Instance %(instance_id)s has zero fixed ips.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
378
379
01b9d21 @vishvananda First round of changes for ha-flatdhcp.
vishvananda authored
380 class FixedIpNotFoundForNetworkHost(FixedIpNotFound):
381 message = _("Network host %(host)s has zero fixed ips "
382 "in network %(network_id)s.")
383
384
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
385 class FixedIpNotFoundForVirtualInterface(FixedIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
386 message = _("Virtual interface %(vif_id)s has zero associated fixed ips.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
387
388
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
389 class FixedIpNotFoundForHost(FixedIpNotFound):
390 message = _("Host %(host)s has zero fixed ips.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
391
392
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
393 class NoMoreFixedIps(Error):
394 message = _("Zero fixed ips available.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
395
396
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
397 class NoFixedIpsDefined(NotFound):
398 message = _("Zero fixed ips could be found.")
399
400
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
401 class FloatingIpNotFound(NotFound):
402 message = _("Floating ip not found for id %(id)s.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
403
404
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
405 class FloatingIpNotFoundForAddress(FloatingIpNotFound):
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
406 message = _("Floating ip not found for address %(address)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
407
408
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
409 class FloatingIpNotFoundForProject(FloatingIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
410 message = _("Floating ip not found for project %(project_id)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
411
412
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
413 class FloatingIpNotFoundForHost(FloatingIpNotFound):
414 message = _("Floating ip not found for host %(host)s.")
415
416
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
417 class NoMoreFloatingIps(FloatingIpNotFound):
418 message = _("Zero floating ips available.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
419
420
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
421 class NoFloatingIpsDefined(NotFound):
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
422 message = _("Zero floating ips exist.")
05fecdf added new exception more descriptive of not having available floating…
John Tran authored
423
424
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
425 class KeypairNotFound(NotFound):
426 message = _("Keypair %(keypair_name)s not found for user %(user_id)s")
427
428
429 class CertificateNotFound(NotFound):
430 message = _("Certificate %(certificate_id)s not found.")
431
432
433 class ServiceNotFound(NotFound):
434 message = _("Service %(service_id)s could not be found.")
435
436
437 class HostNotFound(NotFound):
438 message = _("Host %(host)s could not be found.")
439
440
441 class ComputeHostNotFound(HostNotFound):
442 message = _("Compute host %(host)s could not be found.")
443
444
445 class HostBinaryNotFound(NotFound):
446 message = _("Could not find binary %(binary)s on host %(host)s.")
447
448
449 class AuthTokenNotFound(NotFound):
450 message = _("Auth token %(token)s could not be found.")
451
452
453 class AccessKeyNotFound(NotFound):
454 message = _("Access Key %(access_key)s could not be found.")
455
456
457 class QuotaNotFound(NotFound):
458 message = _("Quota could not be found")
459
460
461 class ProjectQuotaNotFound(QuotaNotFound):
462 message = _("Quota for project %(project_id)s could not be found.")
463
464
465 class SecurityGroupNotFound(NotFound):
466 message = _("Security group %(security_group_id)s not found.")
467
468
469 class SecurityGroupNotFoundForProject(SecurityGroupNotFound):
470 message = _("Security group %(security_group_id)s not found "
471 "for project %(project_id)s.")
472
473
474 class SecurityGroupNotFoundForRule(SecurityGroupNotFound):
475 message = _("Security group with rule %(rule_id)s not found.")
476
477
478 class MigrationNotFound(NotFound):
479 message = _("Migration %(migration_id)s could not be found.")
480
481
482 class MigrationNotFoundByStatus(MigrationNotFound):
483 message = _("Migration not found for instance %(instance_id)s "
484 "with status %(status)s.")
485
486
487 class ConsolePoolNotFound(NotFound):
488 message = _("Console pool %(pool_id)s could not be found.")
489
490
491 class ConsolePoolNotFoundForHostType(NotFound):
492 message = _("Console pool of type %(console_type)s "
493 "for compute host %(compute_host)s "
494 "on proxy host %(host)s not found.")
495
496
497 class ConsoleNotFound(NotFound):
498 message = _("Console %(console_id)s could not be found.")
499
500
501 class ConsoleNotFoundForInstance(ConsoleNotFound):
502 message = _("Console for instance %(instance_id)s could not be found.")
503
504
505 class ConsoleNotFoundInPoolForInstance(ConsoleNotFound):
506 message = _("Console for instance %(instance_id)s "
507 "in pool %(pool_id)s could not be found.")
508
509
510 class NoInstanceTypesFound(NotFound):
511 message = _("Zero instance types found.")
512
513
514 class InstanceTypeNotFound(NotFound):
515 message = _("Instance type %(instance_type_id)s could not be found.")
516
517
518 class InstanceTypeNotFoundByName(InstanceTypeNotFound):
519 message = _("Instance type with name %(instance_type_name)s "
520 "could not be found.")
521
522
523 class FlavorNotFound(NotFound):
524 message = _("Flavor %(flavor_id)s could not be found.")
525
526
527 class ZoneNotFound(NotFound):
528 message = _("Zone %(zone_id)s could not be found.")
529
530
714fe83 @SandyWalsh get rid of all mention of drivers ... it's filter only now
SandyWalsh authored
531 class SchedulerHostFilterNotFound(NotFound):
532 message = _("Scheduler Host Filter %(filter_name)s could not be found.")
f50c726 @SandyWalsh tests and better driver loading
SandyWalsh authored
533
534
579bbde @rconradharris Merging in Sandy's changes adding Noop Cost Fn with tests
rconradharris authored
535 class SchedulerCostFunctionNotFound(NotFound):
536 message = _("Scheduler cost function %(cost_fn_str)s could"
537 " not be found.")
538
439787e @rconradharris Pep8 fixes
rconradharris authored
539
579bbde @rconradharris Merging in Sandy's changes adding Noop Cost Fn with tests
rconradharris authored
540 class SchedulerWeightFlagNotFound(NotFound):
541 message = _("Scheduler weight flag not found: %(flag_name)s")
542
f50c726 @SandyWalsh tests and better driver loading
SandyWalsh authored
543
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
544 class InstanceMetadataNotFound(NotFound):
545 message = _("Instance %(instance_id)s has no metadata with "
546 "key %(metadata_key)s.")
547
548
d68f6de Rename: intance_type_metadata -> instance_type_extra_specs
Lorin Hochstein authored
549 class InstanceTypeExtraSpecsNotFound(NotFound):
550 message = _("Instance Type %(instance_type_id)s has no extra specs with "
551 "key %(extra_specs_key)s.")
65c2675 Adding accessor methods for instance type metadata
Lorin Hochstein authored
552
553
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
554 class LDAPObjectNotFound(NotFound):
555 message = _("LDAP object could not be found")
556
557
558 class LDAPUserNotFound(LDAPObjectNotFound):
559 message = _("LDAP user %(user_id)s could not be found.")
560
561
562 class LDAPGroupNotFound(LDAPObjectNotFound):
563 message = _("LDAP group %(group_id)s could not be found.")
564
565
566 class LDAPGroupMembershipNotFound(NotFound):
567 message = _("LDAP user %(user_id)s is not a member of group %(group_id)s.")
568
569
570 class FileNotFound(NotFound):
571 message = _("File %(file_path)s could not be found.")
572
573
574 class NoFilesFound(NotFound):
575 message = _("Zero files could be found.")
576
577
578 class SwitchNotFoundForNetworkAdapter(NotFound):
579 message = _("Virtual switch associated with the "
580 "network adapter %(adapter)s not found.")
581
582
583 class NetworkAdapterNotFound(NotFound):
584 message = _("Network adapter %(adapter)s could not be found.")
585
586
587 class ClassNotFound(NotFound):
588 message = _("Class %(class_name)s could not be found")
589
590
591 class NotAllowed(NovaException):
592 message = _("Action not allowed.")
593
594
595 class GlobalRoleNotAllowed(NotAllowed):
596 message = _("Unable to use global role %(role_id)s")
64f4032 merging trunk
Brian Waldon authored
597
598
ab2a77d @rconradharris Adding backup rotation
rconradharris authored
599 class ImageRotationNotAllowed(NovaException):
600 message = _("Rotation is not allowed for snapshots")
601
602
594d5c7 @jk0 Refactored backup rotate.
jk0 authored
603 class RotationRequiredForBackup(NovaException):
604 message = _("Rotation param is required for backup image_type")
605
606
1378b11 refactoring usage of exception.Duplicate errors
Brian Waldon authored
607 #TODO(bcwaldon): EOL this exception!
608 class Duplicate(NovaException):
609 pass
610
611
612 class KeyPairExists(Duplicate):
613 message = _("Key pair %(key_name)s already exists.")
614
615
616 class UserExists(Duplicate):
617 message = _("User %(user)s already exists.")
618
619
620 class LDAPUserExists(UserExists):
621 message = _("LDAP user %(user)s already exists.")
622
623
624 class LDAPGroupExists(Duplicate):
625 message = _("LDAP group %(group)s already exists.")
626
627
628 class LDAPMembershipExists(Duplicate):
629 message = _("User %(uid)s is already a member of "
630 "the group %(group_dn)s")
631
632
633 class ProjectExists(Duplicate):
634 message = _("Project %(project)s already exists.")
635
636
637 class InstanceExists(Duplicate):
638 message = _("Instance %(name)s already exists.")
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
639
640
641 class MigrationError(NovaException):
642 message = _("Migration error") + ": %(reason)s"
a3ddb45 Created new exception for handling malformed requests
Alex Meade authored
643
644
645 class MalformedRequestBody(NovaException):
cf66a99 mp fixes
Alex Meade authored
646 message = _("Malformed message body: %(reason)s")
927aecb Introduced Loader concept, for paste decouple.
Brian Lamar authored
647
648
649 class PasteConfigNotFound(NotFound):
650 message = _("Could not find paste config at %(path)s")
651
652
653 class PasteAppNotFound(NotFound):
654 message = _("Could not load paste app '%(name)s' from %(path)s")
Something went wrong with that request. Please try again.