Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 759 lines (436 sloc) 21.303 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
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
27 from functools import wraps
9788cdd @jerdfelt Import sys as well
jerdfelt authored
28 import sys
f69600e @termie docstring cleanup, nova dir
termie authored
29
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
30 from nova import log as logging
f69600e @termie docstring cleanup, nova dir
termie authored
31
c7305af @xtoddx Apply logging changes as a giant patch to work around the cloudpipe d…
xtoddx authored
32 LOG = logging.getLogger('nova.exception')
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
33
d508418 @termie rather comprehensive style fixes
termie authored
34
fc5e1c6 @vishvananda a few formatting fixes and moved exception
vishvananda authored
35 class ProcessExecutionError(IOError):
36 def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
37 description=None):
38 if description is None:
f69600e @termie docstring cleanup, nova dir
termie authored
39 description = _('Unexpected error while running command.')
fc5e1c6 @vishvananda a few formatting fixes and moved exception
vishvananda authored
40 if exit_code is None:
41 exit_code = '-'
f69600e @termie docstring cleanup, nova dir
termie authored
42 message = _('%(description)s\nCommand: %(cmd)s\n'
43 'Exit code: %(exit_code)s\nStdout: %(stdout)r\n'
44 'Stderr: %(stderr)r') % locals()
fc5e1c6 @vishvananda a few formatting fixes and moved exception
vishvananda authored
45 IOError.__init__(self, message)
46
47
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
48 class Error(Exception):
9451872 @anotherjesse Merged Vish's work on adding projects to nova
anotherjesse authored
49 def __init__(self, message=None):
50 super(Error, self).__init__(message)
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
51
d508418 @termie rather comprehensive style fixes
termie authored
52
9451872 @anotherjesse Merged Vish's work on adding projects to nova
anotherjesse authored
53 class ApiError(Error):
430975c ApiError code should default to None, and will only display a code if…
John Tran authored
54 def __init__(self, message='Unknown', code=None):
8d9e8ea merging trunk; resolving conflicts; fixing issue with ApiError test f…
Brian Waldon authored
55 self.msg = message
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
56 self.code = code
430975c ApiError code should default to None, and will only display a code if…
John Tran authored
57 if code:
58 outstr = '%s: %s' % (code, message)
59 else:
60 outstr = '%s' % message
61 super(ApiError, self).__init__(outstr)
bf6e6e7 @anotherjesse initial commit
anotherjesse authored
62
d508418 @termie rather comprehensive style fixes
termie authored
63
1ecd9b3 adding 'building' power state; testing for 409 from OSAPI when rebuil…
Brian Waldon authored
64 class BuildInProgress(Error):
e66f301 @EdLeafe Got the basic 'set admin password' stuff working
EdLeafe authored
65 pass
66
67
9bdcc71 @vishvananda wrap sqlalchemy exceptions in a generic error
vishvananda authored
68 class DBError(Error):
f69600e @termie docstring cleanup, nova dir
termie authored
69 """Wraps an implementation specific exception."""
ae18421 @vishvananda Tests to assure all exceptions can be raised as well as fixing NotAut…
vishvananda authored
70 def __init__(self, inner_exception=None):
9bdcc71 @vishvananda wrap sqlalchemy exceptions in a generic error
vishvananda authored
71 self.inner_exception = inner_exception
72 super(DBError, self).__init__(str(inner_exception))
73
74
75 def wrap_db_error(f):
76 def _wrap(*args, **kwargs):
77 try:
78 return f(*args, **kwargs)
79 except Exception, e:
f69600e @termie docstring cleanup, nova dir
termie authored
80 LOG.exception(_('DB exception wrapped.'))
9bdcc71 @vishvananda wrap sqlalchemy exceptions in a generic error
vishvananda authored
81 raise DBError(e)
82 _wrap.func_name = f.func_name
c8a3534 @Cerberus98 Updated with some changes from manual testing
Cerberus98 authored
83 return _wrap
9bdcc71 @vishvananda wrap sqlalchemy exceptions in a generic error
vishvananda authored
84
85
799919f @SandyWalsh done and done
SandyWalsh authored
86 def wrap_exception(notifier=None, publisher_id=None, event_type=None,
87 level=None):
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
88 """This decorator wraps a method to catch any exceptions that may
89 get thrown. It logs the exception as well as optionally sending
90 it to the notification system.
91 """
92 # TODO(sandy): Find a way to import nova.notifier.api so we don't have
93 # to pass it in as a parameter. Otherwise we get a cyclic import of
94 # nova.notifier.api -> nova.utils -> nova.exception :(
95 def inner(f):
96 def wrapped(*args, **kw):
97 try:
98 return f(*args, **kw)
99 except Exception, e:
27a77fb @jerdfelt Save exception and re-raise that instead of depending on thread local
jerdfelt authored
100 # Save exception since it can be clobbered during processing
101 # below before we can re-raise
102 exc_info = sys.exc_info()
103
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
104 if notifier:
105 payload = dict(args=args, exception=e)
106 payload.update(kw)
107
108 # Use a temp vars so we don't shadow
109 # our outer definitions.
110 temp_level = level
111 if not temp_level:
112 temp_level = notifier.ERROR
113
114 temp_type = event_type
115 if not temp_type:
116 # If f has multiple decorators, they must use
117 # functools.wraps to ensure the name is
118 # propagated.
119 temp_type = f.__name__
120
e789dd2 @SandyWalsh review fixes
SandyWalsh authored
121 notifier.notify(publisher_id, temp_type, temp_level,
122 payload)
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
123
9008b1f @vishvananda add invalid device test and make sure NovaExceptions don't get wrapped
vishvananda authored
124 if (not isinstance(e, Error) and
125 not isinstance(e, NovaException)):
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
126 #exc_type, exc_value, exc_traceback = sys.exc_info()
127 LOG.exception(_('Uncaught exception'))
128 #logging.error(traceback.extract_stack(exc_traceback))
129 raise Error(str(e))
27a77fb @jerdfelt Save exception and re-raise that instead of depending on thread local
jerdfelt authored
130
131 # re-raise original exception since it may have been clobbered
132 raise exc_info[0], exc_info[1], exc_info[2]
1c5e014 @SandyWalsh phew ... working
SandyWalsh authored
133
134 return wraps(f)(wrapped)
135 return inner
093c820 @tr3buchet committing to share
tr3buchet authored
136
137
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
138 class NovaException(Exception):
8762168 adding documentation & error handling
Brian Waldon authored
139 """Base Nova Exception
140
141 To correctly use this class, inherit from it and define
142 a 'message' property. That message will get printf'd
143 with the keyword arguments provided to the constructor.
144
145 """
f5ef0e4 one last i18n string
Brian Waldon authored
146 message = _("An unknown exception occurred.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
147
148 def __init__(self, **kwargs):
8762168 adding documentation & error handling
Brian Waldon authored
149 try:
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
150 self._error_string = self.message % kwargs
8762168 adding documentation & error handling
Brian Waldon authored
151
152 except Exception:
153 # at least get the core message out if something happened
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
154 self._error_string = self.message
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
155
156 def __str__(self):
157 return self._error_string
158
159
9602a55 glance image service pagination
Brian Waldon authored
160 class ImagePaginationFailed(NovaException):
161 message = _("Failed to paginate through images from image service")
162
163
0502a2b @tr3buchet updated the exceptions around virtual interface creation, updated fla…
tr3buchet authored
164 class VirtualInterfaceCreateException(NovaException):
165 message = _("Virtual Interface creation failed")
166
167
a2f9e4b @tr3buchet renamed VirtualInterface exception and extend NovaException
tr3buchet authored
168 class VirtualInterfaceMacAddressException(NovaException):
169 message = _("5 attempts to create virtual interface"
170 "with unique mac address failed")
0438855 @tr3buchet removed network_info shims in vmops
tr3buchet authored
171
172
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
173 class NotAuthorized(NovaException):
174 message = _("Not authorized.")
175
176 def __init__(self, *args, **kwargs):
ae18421 @vishvananda Tests to assure all exceptions can be raised as well as fixing NotAut…
vishvananda authored
177 super(NotAuthorized, self).__init__(**kwargs)
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
178
179
180 class AdminRequired(NotAuthorized):
181 message = _("User does not have admin privileges")
182
183
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
184 class Invalid(NovaException):
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
185 message = _("Unacceptable parameters.")
186
187
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
188 class AlreadyInUse(NovaException):
189 message = _("Already is in use.")
190
191
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
192 class InvalidSignature(Invalid):
193 message = _("Invalid signature %(signature)s for user %(user)s.")
194
195
196 class InvalidInput(Invalid):
197 message = _("Invalid input received") + ": %(reason)s"
198
199
200 class InvalidInstanceType(Invalid):
201 message = _("Invalid instance type %(instance_type)s.")
202
203
204 class InvalidPortRange(Invalid):
205 message = _("Invalid port range %(from_port)s:%(to_port)s.")
206
207
208 class InvalidIpProtocol(Invalid):
209 message = _("Invalid IP protocol %(protocol)s.")
210
211
212 class InvalidContentType(Invalid):
213 message = _("Invalid content type %(content_type)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
214
215
634fe88 @tpatil Initial version
tpatil authored
216 class InvalidCidr(Invalid):
217 message = _("Invalid cidr %(cidr)s.")
218
219
9d0b441 @Daviey pep8'd
Daviey authored
220 # Cannot be templated as the error syntax varies.
221 # msg needs to be constructed when raised.
5c6e4aa @Daviey Some basic validation for creating ec2 security groups. (LP: #715443)
Daviey authored
222 class InvalidParameterValue(Invalid):
223 message = _("%(err)s")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
224
9d0b441 @Daviey pep8'd
Daviey authored
225
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
226 class InstanceNotRunning(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
227 message = _("Instance %(instance_id)s is not running.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
228
229
230 class InstanceNotSuspended(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
231 message = _("Instance %(instance_id)s is not suspended.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
232
233
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
234 class InstanceNotInRescueMode(Invalid):
235 message = _("Instance %(instance_id)s is not in rescue mode")
236
237
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
238 class InstanceSuspendFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
239 message = _("Failed to suspend instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
240
241
242 class InstanceResumeFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
243 message = _("Failed to resume server") + ": %(reason)s."
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
244
245
246 class InstanceRebootFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
247 message = _("Failed to reboot instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
248
249
250 class ServiceUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
251 message = _("Service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
252
253
254 class VolumeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
255 message = _("Volume service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
256
257
258 class ComputeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
259 message = _("Compute service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
260
261
262 class UnableToMigrateToSelf(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
263 message = _("Unable to migrate instance (%(instance_id)s) "
7b5cf70 multi-line string spacing
Brian Waldon authored
264 "to current host (%(host)s).")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
265
266
267 class SourceHostUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
268 message = _("Original compute host is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
269
270
271 class InvalidHypervisorType(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
272 message = _("The supplied hypervisor type of is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
273
274
275 class DestinationHypervisorTooOld(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
276 message = _("The instance requires a newer hypervisor version than "
7b5cf70 multi-line string spacing
Brian Waldon authored
277 "has been provided.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
278
279
840c3e0 fix reviewer's comment
Kei Masumoto authored
280 class DestinationDiskExists(Invalid):
09bd503 block migration feature added
Kei Masumoto authored
281 message = _("The supplied disk path (%(path)s) already exists, "
282 "it is expected not to exist.")
283
284
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
285 class InvalidDevicePath(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
286 message = _("The supplied device path (%(path)s) is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
287
288
289 class InvalidCPUInfo(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
290 message = _("Unacceptable CPU info") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
291
292
293 class InvalidVLANTag(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
294 message = _("VLAN tag is not appropriate for the port group "
7b5cf70 multi-line string spacing
Brian Waldon authored
295 "%(bridge)s. Expected VLAN tag is %(tag)s, "
296 "but the one associated with the port group is %(pgroup)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
297
298
299 class InvalidVLANPortGroup(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
300 message = _("vSwitch which contains the port group %(bridge)s is "
7b5cf70 multi-line string spacing
Brian Waldon authored
301 "not associated with the desired physical adapter. "
302 "Expected vSwitch is %(expected)s, but the one associated "
303 "is %(actual)s.")
ad138a5 correcting tests; pep8
Brian Waldon authored
304
305
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
306 class InvalidDiskFormat(Invalid):
307 message = _("Disk format %(disk_format)s is not acceptable")
308
309
ad138a5 correcting tests; pep8
Brian Waldon authored
310 class ImageUnacceptable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
311 message = _("Image %(image_id)s is unacceptable") + ": %(reason)s"
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
312
313
314 class InstanceUnacceptable(Invalid):
315 message = _("Instance %(instance_id)s is unacceptable") + ": %(reason)s"
316
317
3b0b69d @vishvananda make sure proper exceptions are raised for ec2 id conversion and add …
vishvananda authored
318 class InvalidEc2Id(Invalid):
319 message = _("Ec2 id %(ec2_id)s is unacceptable.")
320
321
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
322 class NotFound(NovaException):
323 message = _("Resource could not be found.")
324
325 def __init__(self, *args, **kwargs):
326 super(NotFound, self).__init__(**kwargs)
327
328
01f7b0a @rconradharris Adding FlagNotSet exception
rconradharris authored
329 class FlagNotSet(NotFound):
330 message = _("Required flag %(flag)s not set.")
331
332
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
333 class InstanceNotFound(NotFound):
334 message = _("Instance %(instance_id)s could not be found.")
335
336
337 class VolumeNotFound(NotFound):
338 message = _("Volume %(volume_id)s could not be found.")
339
340
341 class VolumeNotFoundForInstance(VolumeNotFound):
342 message = _("Volume not found for instance %(instance_id)s.")
343
344
2ecfa05 @kazum Merge trunk
kazum authored
345 class SnapshotNotFound(NotFound):
346 message = _("Snapshot %(snapshot_id)s could not be found.")
347
348
4f7cfba @yamahata volume/driver: implement basic snapshot
yamahata authored
349 class VolumeIsBusy(Error):
350 message = _("deleting volume %(volume_name)s that has snapshot")
351
352
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
353 class ExportDeviceNotFoundForVolume(NotFound):
354 message = _("No export device found for volume %(volume_id)s.")
355
356
357 class ISCSITargetNotFoundForVolume(NotFound):
358 message = _("No target id found for volume %(volume_id)s.")
359
360
361 class DiskNotFound(NotFound):
362 message = _("No disk at %(location)s")
363
364
e16b2d2 @ironcamel Fixed some tests.
ironcamel authored
365 class InvalidImageRef(Invalid):
099c295 @ironcamel Handle the case when a v1.0 api tries to list servers that contain im…
ironcamel authored
366 message = _("Invalid image href %(image_href)s.")
367
368
369 class ListingImageRefsNotSupported(Invalid):
370 message = _("Some images have been stored via hrefs."
371 + " This version of the api does not support displaying image hrefs.")
e16b2d2 @ironcamel Fixed some tests.
ironcamel authored
372
373
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
374 class ImageNotFound(NotFound):
375 message = _("Image %(image_id)s could not be found.")
376
377
378 class KernelNotFoundForImage(ImageNotFound):
379 message = _("Kernel not found for image %(image_id)s.")
380
381
382 class RamdiskNotFoundForImage(ImageNotFound):
383 message = _("Ramdisk not found for image %(image_id)s.")
384
385
386 class UserNotFound(NotFound):
387 message = _("User %(user_id)s could not be found.")
388
389
390 class ProjectNotFound(NotFound):
391 message = _("Project %(project_id)s could not be found.")
392
393
394 class ProjectMembershipNotFound(NotFound):
395 message = _("User %(user_id)s is not a member of project %(project_id)s.")
396
397
398 class UserRoleNotFound(NotFound):
399 message = _("Role %(role_id)s could not be found.")
400
401
402 class StorageRepositoryNotFound(NotFound):
403 message = _("Cannot find SR to read/write VDI.")
404
405
a0b5360 @tr3buchet updated nova-manage create network. better help, handling of required…
tr3buchet authored
406 class NetworkNotCreated(NovaException):
2b0134b @tr3buchet added ipv6 requirements to nova-manage network create. changed --netw…
tr3buchet authored
407 message = _("%(req)s is required to create a network.")
a0b5360 @tr3buchet updated nova-manage create network. better help, handling of required…
tr3buchet authored
408
409
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
410 class NetworkNotFound(NotFound):
411 message = _("Network %(network_id)s could not be found.")
412
413
414 class NetworkNotFoundForBridge(NetworkNotFound):
415 message = _("Network could not be found for bridge %(bridge)s")
416
417
418 class NetworkNotFoundForCidr(NetworkNotFound):
419 message = _("Network could not be found with cidr %(cidr)s.")
420
421
422 class NetworkNotFoundForInstance(NetworkNotFound):
423 message = _("Network could not be found for instance %(instance_id)s.")
424
425
426 class NoNetworksFound(NotFound):
427 message = _("No networks defined.")
428
429
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
430 class NetworkNotFoundForProject(NotFound):
9081e8b @tpatil Added uuid for networks and made changes to the Create server API for…
tpatil authored
431 message = _("Either Network uuid %(network_uuid)s is not present or "
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
432 "is not assigned to the project %(project_id)s.")
433
434
435 class NetworkHostNotSet(NovaException):
436 message = _("Host is not set to the network (%(network_id)s).")
437
438
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
439 class DatastoreNotFound(NotFound):
440 message = _("Could not find the datastore reference(s) which the VM uses.")
441
442
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
443 class FixedIpNotFound(NotFound):
444 message = _("No fixed IP associated with id %(id)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
445
446
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
447 class FixedIpNotFoundForAddress(FixedIpNotFound):
448 message = _("Fixed ip not found for address %(address)s.")
449
450
451 class FixedIpNotFoundForInstance(FixedIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
452 message = _("Instance %(instance_id)s has zero fixed ips.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
453
454
01b9d21 @vishvananda First round of changes for ha-flatdhcp.
vishvananda authored
455 class FixedIpNotFoundForNetworkHost(FixedIpNotFound):
456 message = _("Network host %(host)s has zero fixed ips "
457 "in network %(network_id)s.")
458
459
e6ebcbd @SandyWalsh pre trunk merge
SandyWalsh authored
460 class FixedIpNotFoundForSpecificInstance(FixedIpNotFound):
461 message = _("Instance %(instance_id)s doesn't have fixed ip '%(ip)s'.")
462
463
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
464 class FixedIpNotFoundForVirtualInterface(FixedIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
465 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
466
467
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
468 class FixedIpNotFoundForHost(FixedIpNotFound):
469 message = _("Host %(host)s has zero fixed ips.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
470
471
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
472 class FixedIpNotFoundForNetwork(FixedIpNotFound):
473 message = _("Fixed IP address (%(address)s) does not exist in "
9081e8b @tpatil Added uuid for networks and made changes to the Create server API for…
tpatil authored
474 "network (%(network_uuid)s).")
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
475
476
477 class FixedIpAlreadyInUse(AlreadyInUse):
478 message = _("Fixed IP address %(address)s is already in use.")
479
480
481 class FixedIpInvalid(Invalid):
482 message = _("Fixed IP address %(address)s is invalid.")
483
484
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
485 class NoMoreFixedIps(Error):
486 message = _("Zero fixed ips available.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
487
488
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
489 class NoFixedIpsDefined(NotFound):
490 message = _("Zero fixed ips could be found.")
491
492
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
493 class FloatingIpNotFound(NotFound):
494 message = _("Floating ip not found for id %(id)s.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
495
496
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
497 class FloatingIpNotFoundForAddress(FloatingIpNotFound):
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
498 message = _("Floating ip not found for address %(address)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
499
500
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
501 class FloatingIpNotFoundForProject(FloatingIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
502 message = _("Floating ip not found for project %(project_id)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
503
504
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
505 class FloatingIpNotFoundForHost(FloatingIpNotFound):
506 message = _("Floating ip not found for host %(host)s.")
507
508
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
509 class NoMoreFloatingIps(FloatingIpNotFound):
510 message = _("Zero floating ips available.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
511
512
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
513 class NoFloatingIpsDefined(NotFound):
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
514 message = _("Zero floating ips exist.")
05fecdf added new exception more descriptive of not having available floating…
John Tran authored
515
516
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
517 class KeypairNotFound(NotFound):
518 message = _("Keypair %(keypair_name)s not found for user %(user_id)s")
519
520
521 class CertificateNotFound(NotFound):
522 message = _("Certificate %(certificate_id)s not found.")
523
524
525 class ServiceNotFound(NotFound):
526 message = _("Service %(service_id)s could not be found.")
527
528
529 class HostNotFound(NotFound):
530 message = _("Host %(host)s could not be found.")
531
532
533 class ComputeHostNotFound(HostNotFound):
534 message = _("Compute host %(host)s could not be found.")
535
536
537 class HostBinaryNotFound(NotFound):
538 message = _("Could not find binary %(binary)s on host %(host)s.")
539
540
541 class AuthTokenNotFound(NotFound):
542 message = _("Auth token %(token)s could not be found.")
543
544
545 class AccessKeyNotFound(NotFound):
546 message = _("Access Key %(access_key)s could not be found.")
547
548
549 class QuotaNotFound(NotFound):
550 message = _("Quota could not be found")
551
552
553 class ProjectQuotaNotFound(QuotaNotFound):
554 message = _("Quota for project %(project_id)s could not be found.")
555
556
557 class SecurityGroupNotFound(NotFound):
558 message = _("Security group %(security_group_id)s not found.")
559
560
561 class SecurityGroupNotFoundForProject(SecurityGroupNotFound):
562 message = _("Security group %(security_group_id)s not found "
563 "for project %(project_id)s.")
564
565
566 class SecurityGroupNotFoundForRule(SecurityGroupNotFound):
567 message = _("Security group with rule %(rule_id)s not found.")
568
569
570 class MigrationNotFound(NotFound):
571 message = _("Migration %(migration_id)s could not be found.")
572
573
574 class MigrationNotFoundByStatus(MigrationNotFound):
575 message = _("Migration not found for instance %(instance_id)s "
576 "with status %(status)s.")
577
578
579 class ConsolePoolNotFound(NotFound):
580 message = _("Console pool %(pool_id)s could not be found.")
581
582
583 class ConsolePoolNotFoundForHostType(NotFound):
584 message = _("Console pool of type %(console_type)s "
585 "for compute host %(compute_host)s "
586 "on proxy host %(host)s not found.")
587
588
589 class ConsoleNotFound(NotFound):
590 message = _("Console %(console_id)s could not be found.")
591
592
593 class ConsoleNotFoundForInstance(ConsoleNotFound):
594 message = _("Console for instance %(instance_id)s could not be found.")
595
596
597 class ConsoleNotFoundInPoolForInstance(ConsoleNotFound):
598 message = _("Console for instance %(instance_id)s "
599 "in pool %(pool_id)s could not be found.")
600
601
602 class NoInstanceTypesFound(NotFound):
603 message = _("Zero instance types found.")
604
605
606 class InstanceTypeNotFound(NotFound):
607 message = _("Instance type %(instance_type_id)s could not be found.")
608
609
610 class InstanceTypeNotFoundByName(InstanceTypeNotFound):
611 message = _("Instance type with name %(instance_type_name)s "
612 "could not be found.")
613
614
615 class FlavorNotFound(NotFound):
616 message = _("Flavor %(flavor_id)s could not be found.")
617
618
619 class ZoneNotFound(NotFound):
620 message = _("Zone %(zone_id)s could not be found.")
621
622
714fe83 @SandyWalsh get rid of all mention of drivers ... it's filter only now
SandyWalsh authored
623 class SchedulerHostFilterNotFound(NotFound):
624 message = _("Scheduler Host Filter %(filter_name)s could not be found.")
f50c726 @SandyWalsh tests and better driver loading
SandyWalsh authored
625
626
579bbde @rconradharris Merging in Sandy's changes adding Noop Cost Fn with tests
rconradharris authored
627 class SchedulerCostFunctionNotFound(NotFound):
628 message = _("Scheduler cost function %(cost_fn_str)s could"
629 " not be found.")
630
439787e @rconradharris Pep8 fixes
rconradharris authored
631
579bbde @rconradharris Merging in Sandy's changes adding Noop Cost Fn with tests
rconradharris authored
632 class SchedulerWeightFlagNotFound(NotFound):
633 message = _("Scheduler weight flag not found: %(flag_name)s")
634
f50c726 @SandyWalsh tests and better driver loading
SandyWalsh authored
635
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
636 class InstanceMetadataNotFound(NotFound):
637 message = _("Instance %(instance_id)s has no metadata with "
638 "key %(metadata_key)s.")
639
640
d68f6de Rename: intance_type_metadata -> instance_type_extra_specs
Lorin Hochstein authored
641 class InstanceTypeExtraSpecsNotFound(NotFound):
642 message = _("Instance Type %(instance_type_id)s has no extra specs with "
643 "key %(extra_specs_key)s.")
65c2675 Adding accessor methods for instance type metadata
Lorin Hochstein authored
644
645
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
646 class LDAPObjectNotFound(NotFound):
647 message = _("LDAP object could not be found")
648
649
650 class LDAPUserNotFound(LDAPObjectNotFound):
651 message = _("LDAP user %(user_id)s could not be found.")
652
653
654 class LDAPGroupNotFound(LDAPObjectNotFound):
655 message = _("LDAP group %(group_id)s could not be found.")
656
657
658 class LDAPGroupMembershipNotFound(NotFound):
659 message = _("LDAP user %(user_id)s is not a member of group %(group_id)s.")
660
661
662 class FileNotFound(NotFound):
663 message = _("File %(file_path)s could not be found.")
664
665
666 class NoFilesFound(NotFound):
667 message = _("Zero files could be found.")
668
669
670 class SwitchNotFoundForNetworkAdapter(NotFound):
671 message = _("Virtual switch associated with the "
672 "network adapter %(adapter)s not found.")
673
674
675 class NetworkAdapterNotFound(NotFound):
676 message = _("Network adapter %(adapter)s could not be found.")
677
678
679 class ClassNotFound(NotFound):
680 message = _("Class %(class_name)s could not be found")
681
682
683 class NotAllowed(NovaException):
684 message = _("Action not allowed.")
685
686
687 class GlobalRoleNotAllowed(NotAllowed):
688 message = _("Unable to use global role %(role_id)s")
64f4032 merging trunk
Brian Waldon authored
689
690
ab2a77d @rconradharris Adding backup rotation
rconradharris authored
691 class ImageRotationNotAllowed(NovaException):
692 message = _("Rotation is not allowed for snapshots")
693
694
594d5c7 @jk0 Refactored backup rotate.
jk0 authored
695 class RotationRequiredForBackup(NovaException):
696 message = _("Rotation param is required for backup image_type")
697
698
1378b11 refactoring usage of exception.Duplicate errors
Brian Waldon authored
699 #TODO(bcwaldon): EOL this exception!
700 class Duplicate(NovaException):
701 pass
702
703
704 class KeyPairExists(Duplicate):
705 message = _("Key pair %(key_name)s already exists.")
706
707
708 class UserExists(Duplicate):
709 message = _("User %(user)s already exists.")
710
711
712 class LDAPUserExists(UserExists):
713 message = _("LDAP user %(user)s already exists.")
714
715
716 class LDAPGroupExists(Duplicate):
717 message = _("LDAP group %(group)s already exists.")
718
719
720 class LDAPMembershipExists(Duplicate):
721 message = _("User %(uid)s is already a member of "
722 "the group %(group_dn)s")
723
724
725 class ProjectExists(Duplicate):
726 message = _("Project %(project)s already exists.")
727
728
729 class InstanceExists(Duplicate):
730 message = _("Instance %(name)s already exists.")
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
731
732
c184fa5 fixed reviewer's comment. 1. adding dest-instance-dir deleting operat…
Kei Masumoto authored
733 class InvalidSharedStorage(NovaException):
734 message = _("%(path)s is on shared storage: %(reason)s")
735
736
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
737 class MigrationError(NovaException):
738 message = _("Migration error") + ": %(reason)s"
a3ddb45 Created new exception for handling malformed requests
Alex Meade authored
739
740
741 class MalformedRequestBody(NovaException):
cf66a99 mp fixes
Alex Meade authored
742 message = _("Malformed message body: %(reason)s")
927aecb Introduced Loader concept, for paste decouple.
Brian Lamar authored
743
744
745 class PasteConfigNotFound(NotFound):
746 message = _("Could not find paste config at %(path)s")
747
748
749 class PasteAppNotFound(NotFound):
750 message = _("Could not load paste app '%(name)s' from %(path)s")
055a422 Created exceptions for accepting in OSAPI, and handled them appropria…
Brian Lamar authored
751
752
753 class CannotResizeToSameSize(NovaException):
754 message = _("When resizing, instances must change size!")
755
756
757 class CannotResizeToSmallerSize(NovaException):
758 message = _("Resizing to a smaller size is not supported.")
Something went wrong with that request. Please try again.