cinder.message.message_field module

Message Resource, Action, Detail and user visible message.

Use Resource, Action and Detail’s combination to indicate the Event in the format of:


Also, use exception-to-detail mapping to decrease the workload of classifying event in cinder’s task code.

class Action

Bases: object

ALL = (('001', 'schedule allocate volume'), ('002', 'attach volume'), ('003', 'copy volume to image'), ('004', 'update attachment'), ('005', 'copy image to volume'), ('006', 'unmanage volume'), ('007', 'extend volume'), ('008', 'create volume from backend storage'), ('009', 'create snapshot'), ('010', 'delete snapshot'), ('011', 'update snapshot'), ('012', 'update snapshot metadata'), ('013', 'create backup'), ('014', 'delete backup'), ('015', 'restore backup'), ('016', 'reimage volume'))
ATTACH_VOLUME = ('002', 'attach volume')
BACKUP_CREATE = ('013', 'create backup')
BACKUP_DELETE = ('014', 'delete backup')
BACKUP_RESTORE = ('015', 'restore backup')
COPY_IMAGE_TO_VOLUME = ('005', 'copy image to volume')
COPY_VOLUME_TO_IMAGE = ('003', 'copy volume to image')
CREATE_VOLUME_FROM_BACKEND = ('008', 'create volume from backend storage')
EXTEND_VOLUME = ('007', 'extend volume')
REIMAGE_VOLUME = ('016', 'reimage volume')
SCHEDULE_ALLOCATE_VOLUME = ('001', 'schedule allocate volume')
SNAPSHOT_CREATE = ('009', 'create snapshot')
SNAPSHOT_DELETE = ('010', 'delete snapshot')
SNAPSHOT_METADATA_UPDATE = ('012', 'update snapshot metadata')
SNAPSHOT_UPDATE = ('011', 'update snapshot')
UNMANAGE_VOLUME = ('006', 'unmanage volume')
UPDATE_ATTACHMENT = ('004', 'update attachment')
class Detail

Bases: object

ALL = (('001', 'An unknown error occurred.'), ('002', 'Driver is not initialized at present.'), ('003', 'Could not find any available weighted backend.'), ('004', 'Failed to upload volume to image at backend.'), ('005', "Volume's attach mode is invalid."), ('006', 'Not enough quota resource for operation.'), ('007', 'Image used for creating volume exceeds available space.'), ('008', 'Unmanaging encrypted volumes is not supported.'), ('009', 'Compute service failed to extend volume.'), ('010', 'Volume Driver failed to extend volume.'), ('011', 'Image signature verification failed.'), ('012', 'Driver failed to create the volume.'), ('013', 'Snapshot failed to create.'), ('014', 'Volume snapshot update metadata failed.'), ('015', 'Snapshot is busy.'), ('016', 'Snapshot failed to delete.'), ('017', 'Backup status is invalid.'), ('018', 'Backup service is down.'), ('019', 'Failed to get backup device from the volume service.'), ('020', 'Backup driver failed to create backup.'), ('021', 'Failed to attach volume.'), ('022', 'Failed to detach volume.'), ('023', 'Cleanup of temporary volume/snapshot failed.'), ('024', 'Backup failed to schedule. Service not found for creating backup.'), ('025', 'Backup driver failed to delete backup.'), ('026', 'Backup driver failed to restore backup.'), ('027', 'Volume status is invalid.'), ('028', 'Compute service failed to reimage volume.'), ('029', 'The image disk format must be the same as the volume format for the volume type you are requesting.'))
ATTACH_ERROR = ('021', 'Failed to attach volume.')
BACKUP_CREATE_CLEANUP_ERROR = ('023', 'Cleanup of temporary volume/snapshot failed.')
BACKUP_CREATE_DEVICE_ERROR = ('019', 'Failed to get backup device from the volume service.')
BACKUP_CREATE_DRIVER_ERROR = ('020', 'Backup driver failed to create backup.')
BACKUP_DELETE_DRIVER_ERROR = ('025', 'Backup driver failed to delete backup.')
BACKUP_INVALID_STATE = ('017', 'Backup status is invalid.')
BACKUP_RESTORE_ERROR = ('026', 'Backup driver failed to restore backup.')
BACKUP_SCHEDULE_ERROR = ('024', 'Backup failed to schedule. Service not found for creating backup.')
BACKUP_SERVICE_DOWN = ('018', 'Backup service is down.')
DETACH_ERROR = ('022', 'Failed to detach volume.')
DRIVER_FAILED_CREATE = ('012', 'Driver failed to create the volume.')
DRIVER_FAILED_EXTEND = ('010', 'Volume Driver failed to extend volume.')
DRIVER_NOT_INITIALIZED = ('002', 'Driver is not initialized at present.')
EXCEPTION_DETAIL_MAPPINGS = {('002', 'Driver is not initialized at present.'): ['DriverNotInitialized'], ('003', 'Could not find any available weighted backend.'): ['NoValidBackend'], ('005', "Volume's attach mode is invalid."): ['InvalidVolumeAttachMode'], ('006', 'Not enough quota resource for operation.'): ['ImageLimitExceeded', 'BackupLimitExceeded', 'SnapshotLimitExceeded'], ('007', 'Image used for creating volume exceeds available space.'): ['ImageTooBig'], ('015', 'Snapshot is busy.'): ['SnapshotIsBusy']}
FAILED_TO_UPLOAD_VOLUME = ('004', 'Failed to upload volume to image at backend.')
IMAGE_FORMAT_UNACCEPTABLE = ('029', 'The image disk format must be the same as the volume format for the volume type you are requesting.')
NOTIFY_COMPUTE_SERVICE_FAILED = ('009', 'Compute service failed to extend volume.')
NOT_ENOUGH_SPACE_FOR_IMAGE = ('007', 'Image used for creating volume exceeds available space.')
NO_BACKEND_AVAILABLE = ('003', 'Could not find any available weighted backend.')
QUOTA_EXCEED = ('006', 'Not enough quota resource for operation.')
REIMAGE_VOLUME_FAILED = ('028', 'Compute service failed to reimage volume.')
SIGNATURE_VERIFICATION_FAILED = ('011', 'Image signature verification failed.')
SNAPSHOT_CREATE_ERROR = ('013', 'Snapshot failed to create.')
SNAPSHOT_DELETE_ERROR = ('016', 'Snapshot failed to delete.')
SNAPSHOT_IS_BUSY = ('015', 'Snapshot is busy.')
SNAPSHOT_UPDATE_METADATA_FAILED = ('014', 'Volume snapshot update metadata failed.')
UNKNOWN_ERROR = ('001', 'An unknown error occurred.')
UNMANAGE_ENC_NOT_SUPPORTED = ('008', 'Unmanaging encrypted volumes is not supported.')
VOLUME_ATTACH_MODE_INVALID = ('005', "Volume's attach mode is invalid.")
VOLUME_INVALID_STATE = ('027', 'Volume status is invalid.')
class Resource

Bases: object

translate_detail_id(exception, detail)

Get a detail_id to use for a message.

If exception is in the EXCEPTION_DETAIL_MAPPINGS, returns the detail_id of the mapped Detail field. If exception is not in the mapping or is None, returns the detail_id of the passed-in Detail field. Otherwise, returns the detail_id of Detail.UNKNOWN_ERROR.

  • exception – an Exception (or None)

  • detail – a message_field.Detail field (or None)




the detail_id of a message_field.Detail field