cinder/cinder/message/defined_messages.py
Eric Harney de584713d9 Disallow unmanaging encrypted volumes
Unmanaging encrypted volumes is problematic because
unmanage assumes that you will be able to manage the
volume again for later use, but, we have no mechanism
currently to keep track of the encryption key which
would be required for using an encrypted volume again.

While this may work out ok when using the conf_key
manager, this patch does not distinguish between conf_key
and barbican deployments.

Closes-Bug: #1731518
Change-Id: I7506fa36962404c80f1cc9c6370693728e5393a7
2017-11-29 10:43:32 -05:00

51 lines
1.9 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Event ID and user visible message mapping.
Event IDs are used to look up the message to be displayed for an API Message
object. All defined messages should be appropriate for any API user to see
and not contain any sensitive information. A good rule-of-thumb is to be very
general in error messages unless the issue is due to a bad user action, then be
specific.
"""
from cinder.i18n import _
class EventIds(object):
UNKNOWN_ERROR = 'VOLUME_000001'
UNABLE_TO_ALLOCATE = 'VOLUME_000002'
ATTACH_READONLY_VOLUME = 'VOLUME_000003'
IMAGE_FROM_VOLUME_OVER_QUOTA = 'VOLUME_000004'
UNMANAGE_ENCRYPTED_VOLUME_UNSUPPORTED = 'VOLUME_000005'
event_id_message_map = {
EventIds.UNKNOWN_ERROR: _("An unknown error occurred."),
EventIds.UNABLE_TO_ALLOCATE: _(
"No storage could be allocated for this volume "
"request. You may be able to try another size or"
" volume type."),
EventIds.ATTACH_READONLY_VOLUME: _(
"A readonly volume must be attached as readonly."),
EventIds.IMAGE_FROM_VOLUME_OVER_QUOTA: _(
"Failed to copy volume to image as image quota has been met. Please "
"delete images or have your limit increased, then try again."),
EventIds.UNMANAGE_ENCRYPTED_VOLUME_UNSUPPORTED: _(
"Unmanaging encrypted volumes is not supported."),
}
def get_message_text(event_id):
return event_id_message_map[event_id]