~ubuntu-branches/ubuntu/utopic/cinder/utopic

« back to all changes in this revision

Viewing changes to cinder/exception.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Adam Gandelman, Chuck Short
  • Date: 2013-09-08 21:09:46 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20130908210946-3dbzq1jy5uji4wad
Tags: 1:2013.2~b3-0ubuntu1
[ James Page ]
* d/control: Switch ceph-common -> python-ceph inline with upstream
  refactoring of Ceph RBD driver, move to Suggests of python-cinder.
  (LP: #1190791). 

[ Adam Gandelman ]
* debian/patches/avoid_paramiko_vers_depends.patch: Dropped, no longer
  required.
* Add minimum requirement python-greenlet (>= 0.3.2).
* Add minimum requirement python-eventlet (>= 0.12.0).
* Add minimum requirement python-paramiko (>= 1.8).

[ Chuck Short ]
* New upstream release.
* debian/patches/skip-sqlachemy-failures.patch: Skip testfailures
  with sqlalchemy 0.8 until they are fixed upstream.
* debian/control: Add python-babel to build-depends.
* debian/control: Add python-novaclient to build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from oslo.config import cfg
30
30
import webob.exc
31
31
 
32
 
from cinder.openstack.common import exception as com_exception
33
32
from cinder.openstack.common import log as logging
 
33
from cinder.openstack.common import processutils
34
34
 
35
35
 
36
36
LOG = logging.getLogger(__name__)
53
53
        super(ConvertedException, self).__init__()
54
54
 
55
55
 
56
 
class ProcessExecutionError(IOError):
57
 
    def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
58
 
                 description=None):
59
 
        self.exit_code = exit_code
60
 
        self.stderr = stderr
61
 
        self.stdout = stdout
62
 
        self.cmd = cmd
63
 
        self.description = description
64
 
 
65
 
        if description is None:
66
 
            description = _('Unexpected error while running command.')
67
 
        if exit_code is None:
68
 
            exit_code = '-'
69
 
        message = _('%(description)s\nCommand: %(cmd)s\n'
70
 
                    'Exit code: %(exit_code)s\nStdout: %(stdout)r\n'
71
 
                    'Stderr: %(stderr)r') % {
72
 
                        'description': description,
73
 
                        'cmd': cmd,
74
 
                        'exit_code': exit_code,
75
 
                        'stdout': stdout,
76
 
                        'stderr': stderr,
77
 
                    }
78
 
        IOError.__init__(self, message)
79
 
 
80
 
 
81
 
Error = com_exception.Error
 
56
class Error(Exception):
 
57
    pass
82
58
 
83
59
 
84
60
class CinderException(Exception):
119
95
                # at least get the core message out if something happened
120
96
                message = self.message
121
97
 
 
98
        # NOTE(luisg): We put the actual message in 'msg' so that we can access
 
99
        # it, because if we try to access the message via 'message' it will be
 
100
        # overshadowed by the class' message attribute
 
101
        self.msg = message
122
102
        super(CinderException, self).__init__(message)
123
103
 
 
104
    def __unicode__(self):
 
105
        return unicode(self.msg)
 
106
 
124
107
 
125
108
class GlanceConnectionFailed(CinderException):
126
109
    message = _("Connection to glance failed") + ": %(reason)s"
156
139
    message = _("Invalid source volume %(reason)s.")
157
140
 
158
141
 
 
142
class InvalidVolumeAttachMode(Invalid):
 
143
    message = _("Invalid attaching mode '%(mode)s' for "
 
144
                "volume %(volume_id)s.")
 
145
 
 
146
 
159
147
class VolumeAttached(Invalid):
160
148
    message = _("Volume %(volume_id)s is still attached, detach volume first.")
161
149
 
188
176
    message = _("Invalid content type %(content_type)s.")
189
177
 
190
178
 
 
179
class InvalidHost(Invalid):
 
180
    message = _("Invalid host") + ": %(reason)s"
 
181
 
 
182
 
191
183
# Cannot be templated as the error syntax varies.
192
184
# msg needs to be constructed when raised.
193
185
class InvalidParameterValue(Invalid):
242
234
                "key %(metadata_key)s.")
243
235
 
244
236
 
 
237
class VolumeAdminMetadataNotFound(NotFound):
 
238
    message = _("Volume %(volume_id)s has no administration metadata with "
 
239
                "key %(metadata_key)s.")
 
240
 
 
241
 
245
242
class InvalidVolumeMetadata(Invalid):
246
243
    message = _("Invalid metadata") + ": %(reason)s"
247
244
 
294
291
    message = _("No target id found for volume %(volume_id)s.")
295
292
 
296
293
 
297
 
class ISCSITargetCreateFailed(CinderException):
298
 
    message = _("Failed to create iscsi target for volume %(volume_id)s.")
299
 
 
300
 
 
301
 
class ISCSITargetAttachFailed(CinderException):
302
 
    message = _("Failed to attach iSCSI target for volume %(volume_id)s.")
303
 
 
304
 
 
305
 
class ISCSITargetRemoveFailed(CinderException):
306
 
    message = _("Failed to remove iscsi target for volume %(volume_id)s.")
307
 
 
308
 
 
309
294
class DiskNotFound(NotFound):
310
295
    message = _("No disk at %(location)s")
311
296
 
409
394
    message = _("Volume Type %(id)s already exists.")
410
395
 
411
396
 
 
397
class VolumeTypeEncryptionExists(Invalid):
 
398
    message = _("Volume type encryption for type %(type_id)s already exists.")
 
399
 
 
400
 
412
401
class MigrationError(CinderException):
413
402
    message = _("Migration error") + ": %(reason)s"
414
403
 
560
549
                " exists for volume id %(volume_id)s")
561
550
 
562
551
 
 
552
class GlanceMetadataNotFound(NotFound):
 
553
    message = _("Glance metadata for volume/snapshot %(id)s cannot be found.")
 
554
 
 
555
 
 
556
class ExportFailure(Invalid):
 
557
    message = _("Failed to export for volume: %(reason)s")
 
558
 
 
559
 
 
560
class MetadataCreateFailure(Invalid):
 
561
    message = _("Failed to create metadata for volume: %(reason)s")
 
562
 
 
563
 
 
564
class MetadataUpdateFailure(Invalid):
 
565
    message = _("Failed to update metadata for volume: %(reason)s")
 
566
 
 
567
 
 
568
class MetadataCopyFailure(Invalid):
 
569
    message = _("Failed to copy metadata to volume: %(reason)s")
 
570
 
 
571
 
563
572
class ImageCopyFailure(Invalid):
564
573
    message = _("Failed to copy image to volume: %(reason)s")
565
574
 
566
575
 
 
576
class BackupInvalidCephArgs(Invalid):
 
577
    message = _("Invalid Ceph args provided for backup rbd operation")
 
578
 
 
579
 
 
580
class BackupOperationError(Invalid):
 
581
    message = _("An error has occurred during backup operation")
 
582
 
 
583
 
 
584
class BackupRBDOperationFailed(Invalid):
 
585
    message = _("Backup RBD operation failed")
 
586
 
 
587
 
567
588
class BackupVolumeInvalidType(Invalid):
568
589
    message = _("Backup volume %(volume_id)s type not recognised.")
569
590
 
582
603
 
583
604
class TransferNotFound(NotFound):
584
605
    message = _("Transfer %(transfer_id)s could not be found.")
 
606
 
 
607
 
 
608
class VolumeMigrationFailed(CinderException):
 
609
    message = _("Volume migration failed") + ": %(reason)s"
 
610
 
 
611
 
 
612
class ProtocolNotSupported(CinderException):
 
613
    message = _("Connect to volume via protocol %(protocol)s not supported.")
 
614
 
 
615
 
 
616
class SSHInjectionThreat(CinderException):
 
617
    message = _("SSH command injection detected") + ": %(command)s"
 
618
 
 
619
 
 
620
class CoraidException(CinderException):
 
621
    message = _('Coraid Cinder Driver exception.')
 
622
 
 
623
 
 
624
class CoraidJsonEncodeFailure(CoraidException):
 
625
    message = _('Failed to encode json data.')
 
626
 
 
627
 
 
628
class CoraidESMBadCredentials(CoraidException):
 
629
    message = _('Login on ESM failed.')
 
630
 
 
631
 
 
632
class CoraidESMReloginFailed(CoraidException):
 
633
    message = _('Relogin on ESM failed.')
 
634
 
 
635
 
 
636
class CoraidESMBadGroup(CoraidException):
 
637
    message = _('Group with name "%(group_name)s" not found.')
 
638
 
 
639
 
 
640
class CoraidESMConfigureError(CoraidException):
 
641
    message = _('ESM configure request failed: %(message)s.')
 
642
 
 
643
 
 
644
class CoraidESMNotAvailable(CoraidException):
 
645
    message = _('Coraid ESM not available with reason: %(reason)s.')
 
646
 
 
647
 
 
648
class QoSSpecsExists(Duplicate):
 
649
    message = _("QoS Specs %(specs_id)s already exists.")
 
650
 
 
651
 
 
652
class QoSSpecsCreateFailed(CinderException):
 
653
    message = _("Failed to create qos_specs: "
 
654
                "%(name)s with specs %(qos_specs)s.")
 
655
 
 
656
 
 
657
class QoSSpecsUpdateFailed(CinderException):
 
658
    message = _("Failed to update qos_specs: "
 
659
                "%(specs_id)s with specs %(qos_specs)s.")
 
660
 
 
661
 
 
662
class QoSSpecsNotFound(NotFound):
 
663
    message = _("No such QoS spec %(specs_id)s.")
 
664
 
 
665
 
 
666
class QoSSpecsAssociateFailed(CinderException):
 
667
    message = _("Failed to associate qos_specs: "
 
668
                "%(specs_id)s with type %(type_id)s.")
 
669
 
 
670
 
 
671
class QoSSpecsDisassociateFailed(CinderException):
 
672
    message = _("Failed to disassociate qos_specs: "
 
673
                "%(specs_id)s with type %(type_id)s.")
 
674
 
 
675
 
 
676
class QoSSpecsKeyNotFound(NotFound):
 
677
    message = _("QoS spec %(specs_id)s has no spec with "
 
678
                "key %(specs_key)s.")
 
679
 
 
680
 
 
681
class InvalidQoSSpecs(Invalid):
 
682
    message = _("Invalid qos specs") + ": %(reason)s"
 
683
 
 
684
 
 
685
class QoSSpecsInUse(CinderException):
 
686
    message = _("QoS Specs %(specs_id)s is still associated with entities.")