Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 770 lines (443 sloc) 21.718 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):
da02fc6 @vishvananda Fix not found exceptions to properly use ec2_ips for not found
vishvananda authored
149 self.kwargs = kwargs
8762168 adding documentation & error handling
Brian Waldon authored
150 try:
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
151 self._error_string = self.message % kwargs
8762168 adding documentation & error handling
Brian Waldon authored
152
153 except Exception:
154 # at least get the core message out if something happened
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
155 self._error_string = self.message
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
156
157 def __str__(self):
158 return self._error_string
159
160
9602a55 glance image service pagination
Brian Waldon authored
161 class ImagePaginationFailed(NovaException):
162 message = _("Failed to paginate through images from image service")
163
164
0502a2b @tr3buchet updated the exceptions around virtual interface creation, updated fla…
tr3buchet authored
165 class VirtualInterfaceCreateException(NovaException):
166 message = _("Virtual Interface creation failed")
167
168
a2f9e4b @tr3buchet renamed VirtualInterface exception and extend NovaException
tr3buchet authored
169 class VirtualInterfaceMacAddressException(NovaException):
170 message = _("5 attempts to create virtual interface"
171 "with unique mac address failed")
0438855 @tr3buchet removed network_info shims in vmops
tr3buchet authored
172
173
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
174 class NotAuthorized(NovaException):
175 message = _("Not authorized.")
176
177 def __init__(self, *args, **kwargs):
ae18421 @vishvananda Tests to assure all exceptions can be raised as well as fixing NotAut…
vishvananda authored
178 super(NotAuthorized, self).__init__(**kwargs)
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
179
180
181 class AdminRequired(NotAuthorized):
182 message = _("User does not have admin privileges")
183
184
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
185 class Invalid(NovaException):
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
186 message = _("Unacceptable parameters.")
187
188
189 class InvalidSignature(Invalid):
190 message = _("Invalid signature %(signature)s for user %(user)s.")
191
192
193 class InvalidInput(Invalid):
194 message = _("Invalid input received") + ": %(reason)s"
195
196
197 class InvalidInstanceType(Invalid):
198 message = _("Invalid instance type %(instance_type)s.")
199
200
201 class InvalidPortRange(Invalid):
202 message = _("Invalid port range %(from_port)s:%(to_port)s.")
203
204
205 class InvalidIpProtocol(Invalid):
206 message = _("Invalid IP protocol %(protocol)s.")
207
208
209 class InvalidContentType(Invalid):
210 message = _("Invalid content type %(content_type)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
211
212
634fe88 @tpatil Initial version
tpatil authored
213 class InvalidCidr(Invalid):
214 message = _("Invalid cidr %(cidr)s.")
215
216
9d0b441 @Daviey pep8'd
Daviey authored
217 # Cannot be templated as the error syntax varies.
218 # msg needs to be constructed when raised.
5c6e4aa @Daviey Some basic validation for creating ec2 security groups. (LP: #715443)
Daviey authored
219 class InvalidParameterValue(Invalid):
220 message = _("%(err)s")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
221
9d0b441 @Daviey pep8'd
Daviey authored
222
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
223 class InstanceNotRunning(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
224 message = _("Instance %(instance_id)s is not running.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
225
226
227 class InstanceNotSuspended(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
228 message = _("Instance %(instance_id)s is not suspended.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
229
230
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
231 class InstanceNotInRescueMode(Invalid):
232 message = _("Instance %(instance_id)s is not in rescue mode")
233
234
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
235 class InstanceSuspendFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
236 message = _("Failed to suspend instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
237
238
239 class InstanceResumeFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
240 message = _("Failed to resume server") + ": %(reason)s."
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
241
242
243 class InstanceRebootFailure(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
244 message = _("Failed to reboot instance") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
245
246
247 class ServiceUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
248 message = _("Service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
249
250
251 class VolumeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
252 message = _("Volume service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
253
254
255 class ComputeServiceUnavailable(ServiceUnavailable):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
256 message = _("Compute service is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
257
258
259 class UnableToMigrateToSelf(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
260 message = _("Unable to migrate instance (%(instance_id)s) "
7b5cf70 multi-line string spacing
Brian Waldon authored
261 "to current host (%(host)s).")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
262
263
264 class SourceHostUnavailable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
265 message = _("Original compute host is unavailable at this time.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
266
267
268 class InvalidHypervisorType(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
269 message = _("The supplied hypervisor type of is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
270
271
272 class DestinationHypervisorTooOld(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
273 message = _("The instance requires a newer hypervisor version than "
7b5cf70 multi-line string spacing
Brian Waldon authored
274 "has been provided.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
275
276
840c3e0 fix reviewer's comment
Kei Masumoto authored
277 class DestinationDiskExists(Invalid):
09bd503 block migration feature added
Kei Masumoto authored
278 message = _("The supplied disk path (%(path)s) already exists, "
279 "it is expected not to exist.")
280
281
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
282 class InvalidDevicePath(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
283 message = _("The supplied device path (%(path)s) is invalid.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
284
285
286 class InvalidCPUInfo(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
287 message = _("Unacceptable CPU info") + ": %(reason)s"
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
288
289
290 class InvalidVLANTag(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
291 message = _("VLAN tag is not appropriate for the port group "
7b5cf70 multi-line string spacing
Brian Waldon authored
292 "%(bridge)s. Expected VLAN tag is %(tag)s, "
293 "but the one associated with the port group is %(pgroup)s.")
4b07856 initial roundup of all 'exception.Invalid' cases
Brian Waldon authored
294
295
296 class InvalidVLANPortGroup(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
297 message = _("vSwitch which contains the port group %(bridge)s is "
7b5cf70 multi-line string spacing
Brian Waldon authored
298 "not associated with the desired physical adapter. "
299 "Expected vSwitch is %(expected)s, but the one associated "
300 "is %(actual)s.")
ad138a5 correcting tests; pep8
Brian Waldon authored
301
302
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
303 class InvalidDiskFormat(Invalid):
304 message = _("Disk format %(disk_format)s is not acceptable")
305
306
ad138a5 correcting tests; pep8
Brian Waldon authored
307 class ImageUnacceptable(Invalid):
9c6cbd4 moving dynamic i18n to static
Brian Waldon authored
308 message = _("Image %(image_id)s is unacceptable") + ": %(reason)s"
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
309
310
311 class InstanceUnacceptable(Invalid):
312 message = _("Instance %(instance_id)s is unacceptable") + ": %(reason)s"
313
314
3b0b69d @vishvananda make sure proper exceptions are raised for ec2 id conversion and add …
vishvananda authored
315 class InvalidEc2Id(Invalid):
316 message = _("Ec2 id %(ec2_id)s is unacceptable.")
317
318
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
319 class NotFound(NovaException):
320 message = _("Resource could not be found.")
321
322 def __init__(self, *args, **kwargs):
323 super(NotFound, self).__init__(**kwargs)
324
325
01f7b0a @rconradharris Adding FlagNotSet exception
rconradharris authored
326 class FlagNotSet(NotFound):
327 message = _("Required flag %(flag)s not set.")
328
329
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
330 class InstanceNotFound(NotFound):
331 message = _("Instance %(instance_id)s could not be found.")
332
333
334 class VolumeNotFound(NotFound):
335 message = _("Volume %(volume_id)s could not be found.")
336
337
338 class VolumeNotFoundForInstance(VolumeNotFound):
339 message = _("Volume not found for instance %(instance_id)s.")
340
341
2ecfa05 @kazum Merge trunk
kazum authored
342 class SnapshotNotFound(NotFound):
343 message = _("Snapshot %(snapshot_id)s could not be found.")
344
345
4f7cfba @yamahata volume/driver: implement basic snapshot
yamahata authored
346 class VolumeIsBusy(Error):
347 message = _("deleting volume %(volume_name)s that has snapshot")
348
349
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
350 class ExportDeviceNotFoundForVolume(NotFound):
351 message = _("No export device found for volume %(volume_id)s.")
352
353
354 class ISCSITargetNotFoundForVolume(NotFound):
355 message = _("No target id found for volume %(volume_id)s.")
356
357
358 class DiskNotFound(NotFound):
359 message = _("No disk at %(location)s")
360
361
e16b2d2 @ironcamel Fixed some tests.
ironcamel authored
362 class InvalidImageRef(Invalid):
099c295 @ironcamel Handle the case when a v1.0 api tries to list servers that contain im…
ironcamel authored
363 message = _("Invalid image href %(image_href)s.")
364
365
366 class ListingImageRefsNotSupported(Invalid):
367 message = _("Some images have been stored via hrefs."
368 + " This version of the api does not support displaying image hrefs.")
e16b2d2 @ironcamel Fixed some tests.
ironcamel authored
369
370
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
371 class ImageNotFound(NotFound):
372 message = _("Image %(image_id)s could not be found.")
373
374
375 class KernelNotFoundForImage(ImageNotFound):
376 message = _("Kernel not found for image %(image_id)s.")
377
378
379 class RamdiskNotFoundForImage(ImageNotFound):
380 message = _("Ramdisk not found for image %(image_id)s.")
381
382
383 class UserNotFound(NotFound):
384 message = _("User %(user_id)s could not be found.")
385
386
387 class ProjectNotFound(NotFound):
388 message = _("Project %(project_id)s could not be found.")
389
390
391 class ProjectMembershipNotFound(NotFound):
392 message = _("User %(user_id)s is not a member of project %(project_id)s.")
393
394
395 class UserRoleNotFound(NotFound):
396 message = _("Role %(role_id)s could not be found.")
397
398
399 class StorageRepositoryNotFound(NotFound):
400 message = _("Cannot find SR to read/write VDI.")
401
402
a0b5360 @tr3buchet updated nova-manage create network. better help, handling of required…
tr3buchet authored
403 class NetworkNotCreated(NovaException):
2b0134b @tr3buchet added ipv6 requirements to nova-manage network create. changed --netw…
tr3buchet authored
404 message = _("%(req)s is required to create a network.")
a0b5360 @tr3buchet updated nova-manage create network. better help, handling of required…
tr3buchet authored
405
406
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
407 class NetworkNotFound(NotFound):
408 message = _("Network %(network_id)s could not be found.")
409
410
411 class NetworkNotFoundForBridge(NetworkNotFound):
412 message = _("Network could not be found for bridge %(bridge)s")
413
414
415 class NetworkNotFoundForCidr(NetworkNotFound):
416 message = _("Network could not be found with cidr %(cidr)s.")
417
418
419 class NetworkNotFoundForInstance(NetworkNotFound):
420 message = _("Network could not be found for instance %(instance_id)s.")
421
422
423 class NoNetworksFound(NotFound):
424 message = _("No networks defined.")
425
426
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
427 class NetworkNotFoundForProject(NotFound):
9081e8b @tpatil Added uuid for networks and made changes to the Create server API for…
tpatil authored
428 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
429 "is not assigned to the project %(project_id)s.")
430
431
432 class NetworkHostNotSet(NovaException):
433 message = _("Host is not set to the network (%(network_id)s).")
434
435
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
436 class DatastoreNotFound(NotFound):
437 message = _("Could not find the datastore reference(s) which the VM uses.")
438
439
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
440 class FixedIpNotFound(NotFound):
441 message = _("No fixed IP associated with id %(id)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
442
443
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
444 class FixedIpNotFoundForAddress(FixedIpNotFound):
445 message = _("Fixed ip not found for address %(address)s.")
446
447
448 class FixedIpNotFoundForInstance(FixedIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
449 message = _("Instance %(instance_id)s has zero fixed ips.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
450
451
01b9d21 @vishvananda First round of changes for ha-flatdhcp.
vishvananda authored
452 class FixedIpNotFoundForNetworkHost(FixedIpNotFound):
453 message = _("Network host %(host)s has zero fixed ips "
454 "in network %(network_id)s.")
455
456
e6ebcbd @SandyWalsh pre trunk merge
SandyWalsh authored
457 class FixedIpNotFoundForSpecificInstance(FixedIpNotFound):
458 message = _("Instance %(instance_id)s doesn't have fixed ip '%(ip)s'.")
459
460
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
461 class FixedIpNotFoundForVirtualInterface(FixedIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
462 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
463
464
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
465 class FixedIpNotFoundForHost(FixedIpNotFound):
466 message = _("Host %(host)s has zero fixed ips.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
467
468
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
469 class FixedIpNotFoundForNetwork(FixedIpNotFound):
470 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
471 "network (%(network_uuid)s).")
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
472
473
d27a4d4 @tpatil Fixed review comments
tpatil authored
474 class FixedIpAlreadyInUse(NovaException):
2a6f979 @tpatil add optional parameter networks to the Create server OS API
tpatil authored
475 message = _("Fixed IP address %(address)s is already in use.")
476
477
478 class FixedIpInvalid(Invalid):
479 message = _("Fixed IP address %(address)s is invalid.")
480
481
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
482 class NoMoreFixedIps(Error):
483 message = _("Zero fixed ips available.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
484
485
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
486 class NoFixedIpsDefined(NotFound):
487 message = _("Zero fixed ips could be found.")
488
489
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
490 class FloatingIpNotFound(NotFound):
491 message = _("Floating ip not found for id %(id)s.")
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
492
493
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
494 class FloatingIpNotFoundForAddress(FloatingIpNotFound):
d3c6f77 @tr3buchet moved auto assign floating ip functionality from compute manager to n…
tr3buchet authored
495 message = _("Floating ip not found for address %(address)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
496
497
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
498 class FloatingIpNotFoundForProject(FloatingIpNotFound):
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
499 message = _("Floating ip not found for project %(project_id)s.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
500
501
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
502 class FloatingIpNotFoundForHost(FloatingIpNotFound):
503 message = _("Floating ip not found for host %(host)s.")
504
505
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
506 class NoMoreFloatingIps(FloatingIpNotFound):
507 message = _("Zero floating ips available.")
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
508
509
89ad3e4 @tr3buchet updated fixed ip and floating ip exceptions
tr3buchet authored
510 class NoFloatingIpsDefined(NotFound):
772a2ce @tr3buchet merged trunk, fixed the floating_ip fixed_ip exception stupidity
tr3buchet authored
511 message = _("Zero floating ips exist.")
05fecdf added new exception more descriptive of not having available floating…
John Tran authored
512
513
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
514 class KeypairNotFound(NotFound):
515 message = _("Keypair %(keypair_name)s not found for user %(user_id)s")
516
517
518 class CertificateNotFound(NotFound):
519 message = _("Certificate %(certificate_id)s not found.")
520
521
522 class ServiceNotFound(NotFound):
523 message = _("Service %(service_id)s could not be found.")
524
525
526 class HostNotFound(NotFound):
527 message = _("Host %(host)s could not be found.")
528
529
530 class ComputeHostNotFound(HostNotFound):
531 message = _("Compute host %(host)s could not be found.")
532
533
534 class HostBinaryNotFound(NotFound):
535 message = _("Could not find binary %(binary)s on host %(host)s.")
536
537
538 class AuthTokenNotFound(NotFound):
539 message = _("Auth token %(token)s could not be found.")
540
541
542 class AccessKeyNotFound(NotFound):
543 message = _("Access Key %(access_key)s could not be found.")
544
545
546 class QuotaNotFound(NotFound):
547 message = _("Quota could not be found")
548
549
550 class ProjectQuotaNotFound(QuotaNotFound):
551 message = _("Quota for project %(project_id)s could not be found.")
552
553
554 class SecurityGroupNotFound(NotFound):
555 message = _("Security group %(security_group_id)s not found.")
556
557
558 class SecurityGroupNotFoundForProject(SecurityGroupNotFound):
559 message = _("Security group %(security_group_id)s not found "
560 "for project %(project_id)s.")
561
562
563 class SecurityGroupNotFoundForRule(SecurityGroupNotFound):
564 message = _("Security group with rule %(rule_id)s not found.")
565
566
bb98913 @tpatil add/remove security groups to/from the servers as server actions
tpatil authored
567 class SecurityGroupExistsForInstance(Invalid):
568 message = _("Security group %(security_group_id)s is already associated"
569 " with the instance %(instance_id)s")
570
571
572 class SecurityGroupNotExistsForInstance(Invalid):
573 message = _("Security group %(security_group_id)s is not associated with"
574 " the instance %(instance_id)s")
575
576
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
577 class MigrationNotFound(NotFound):
578 message = _("Migration %(migration_id)s could not be found.")
579
580
581 class MigrationNotFoundByStatus(MigrationNotFound):
582 message = _("Migration not found for instance %(instance_id)s "
583 "with status %(status)s.")
584
585
586 class ConsolePoolNotFound(NotFound):
587 message = _("Console pool %(pool_id)s could not be found.")
588
589
590 class ConsolePoolNotFoundForHostType(NotFound):
591 message = _("Console pool of type %(console_type)s "
592 "for compute host %(compute_host)s "
593 "on proxy host %(host)s not found.")
594
595
596 class ConsoleNotFound(NotFound):
597 message = _("Console %(console_id)s could not be found.")
598
599
600 class ConsoleNotFoundForInstance(ConsoleNotFound):
601 message = _("Console for instance %(instance_id)s could not be found.")
602
603
604 class ConsoleNotFoundInPoolForInstance(ConsoleNotFound):
605 message = _("Console for instance %(instance_id)s "
606 "in pool %(pool_id)s could not be found.")
607
608
609 class NoInstanceTypesFound(NotFound):
610 message = _("Zero instance types found.")
611
612
613 class InstanceTypeNotFound(NotFound):
614 message = _("Instance type %(instance_type_id)s could not be found.")
615
616
617 class InstanceTypeNotFoundByName(InstanceTypeNotFound):
618 message = _("Instance type with name %(instance_type_name)s "
619 "could not be found.")
620
621
622 class FlavorNotFound(NotFound):
623 message = _("Flavor %(flavor_id)s could not be found.")
624
625
626 class ZoneNotFound(NotFound):
627 message = _("Zone %(zone_id)s could not be found.")
628
629
714fe83 @SandyWalsh get rid of all mention of drivers ... it's filter only now
SandyWalsh authored
630 class SchedulerHostFilterNotFound(NotFound):
631 message = _("Scheduler Host Filter %(filter_name)s could not be found.")
f50c726 @SandyWalsh tests and better driver loading
SandyWalsh authored
632
633
579bbde @rconradharris Merging in Sandy's changes adding Noop Cost Fn with tests
rconradharris authored
634 class SchedulerCostFunctionNotFound(NotFound):
635 message = _("Scheduler cost function %(cost_fn_str)s could"
636 " not be found.")
637
439787e @rconradharris Pep8 fixes
rconradharris authored
638
579bbde @rconradharris Merging in Sandy's changes adding Noop Cost Fn with tests
rconradharris authored
639 class SchedulerWeightFlagNotFound(NotFound):
640 message = _("Scheduler weight flag not found: %(flag_name)s")
641
f50c726 @SandyWalsh tests and better driver loading
SandyWalsh authored
642
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
643 class InstanceMetadataNotFound(NotFound):
644 message = _("Instance %(instance_id)s has no metadata with "
645 "key %(metadata_key)s.")
646
647
d68f6de Rename: intance_type_metadata -> instance_type_extra_specs
Lorin Hochstein authored
648 class InstanceTypeExtraSpecsNotFound(NotFound):
649 message = _("Instance Type %(instance_type_id)s has no extra specs with "
650 "key %(extra_specs_key)s.")
65c2675 Adding accessor methods for instance type metadata
Lorin Hochstein authored
651
652
8681db3 Addressing exception.NotFound across the project
Brian Waldon authored
653 class LDAPObjectNotFound(NotFound):
654 message = _("LDAP object could not be found")
655
656
657 class LDAPUserNotFound(LDAPObjectNotFound):
658 message = _("LDAP user %(user_id)s could not be found.")
659
660
661 class LDAPGroupNotFound(LDAPObjectNotFound):
662 message = _("LDAP group %(group_id)s could not be found.")
663
664
665 class LDAPGroupMembershipNotFound(NotFound):
666 message = _("LDAP user %(user_id)s is not a member of group %(group_id)s.")
667
668
669 class FileNotFound(NotFound):
670 message = _("File %(file_path)s could not be found.")
671
672
673 class NoFilesFound(NotFound):
674 message = _("Zero files could be found.")
675
676
677 class SwitchNotFoundForNetworkAdapter(NotFound):
678 message = _("Virtual switch associated with the "
679 "network adapter %(adapter)s not found.")
680
681
682 class NetworkAdapterNotFound(NotFound):
683 message = _("Network adapter %(adapter)s could not be found.")
684
685
686 class ClassNotFound(NotFound):
687 message = _("Class %(class_name)s could not be found")
688
689
690 class NotAllowed(NovaException):
691 message = _("Action not allowed.")
692
693
694 class GlobalRoleNotAllowed(NotAllowed):
695 message = _("Unable to use global role %(role_id)s")
64f4032 merging trunk
Brian Waldon authored
696
697
ab2a77d @rconradharris Adding backup rotation
rconradharris authored
698 class ImageRotationNotAllowed(NovaException):
699 message = _("Rotation is not allowed for snapshots")
700
701
594d5c7 @jk0 Refactored backup rotate.
jk0 authored
702 class RotationRequiredForBackup(NovaException):
703 message = _("Rotation param is required for backup image_type")
704
705
1378b11 refactoring usage of exception.Duplicate errors
Brian Waldon authored
706 #TODO(bcwaldon): EOL this exception!
707 class Duplicate(NovaException):
708 pass
709
710
711 class KeyPairExists(Duplicate):
712 message = _("Key pair %(key_name)s already exists.")
713
714
715 class UserExists(Duplicate):
716 message = _("User %(user)s already exists.")
717
718
719 class LDAPUserExists(UserExists):
720 message = _("LDAP user %(user)s already exists.")
721
722
723 class LDAPGroupExists(Duplicate):
724 message = _("LDAP group %(group)s already exists.")
725
726
727 class LDAPMembershipExists(Duplicate):
728 message = _("User %(uid)s is already a member of "
729 "the group %(group_dn)s")
730
731
732 class ProjectExists(Duplicate):
733 message = _("Project %(project)s already exists.")
734
735
736 class InstanceExists(Duplicate):
737 message = _("Instance %(name)s already exists.")
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
738
739
c184fa5 fixed reviewer's comment. 1. adding dest-instance-dir deleting operat…
Kei Masumoto authored
740 class InvalidSharedStorage(NovaException):
741 message = _("%(path)s is on shared storage: %(reason)s")
742
743
8e6875e further cleanup of nova/exceptions.py
Brian Waldon authored
744 class MigrationError(NovaException):
745 message = _("Migration error") + ": %(reason)s"
a3ddb45 Created new exception for handling malformed requests
Alex Meade authored
746
747
748 class MalformedRequestBody(NovaException):
cf66a99 mp fixes
Alex Meade authored
749 message = _("Malformed message body: %(reason)s")
927aecb Introduced Loader concept, for paste decouple.
Brian Lamar authored
750
751
752 class PasteConfigNotFound(NotFound):
753 message = _("Could not find paste config at %(path)s")
754
755
756 class PasteAppNotFound(NotFound):
757 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
758
759
760 class CannotResizeToSameSize(NovaException):
761 message = _("When resizing, instances must change size!")
762
763
764 class CannotResizeToSmallerSize(NovaException):
765 message = _("Resizing to a smaller size is not supported.")
b29bc97 @jk0 Check compressed image size and PEP8 cleanup.
jk0 authored
766
767
768 class ImageTooLarge(NovaException):
769 message = _("Image is larger than instance type allows")
Something went wrong with that request. Please try again.