Steve Baker fafb4b0b86 Add virtual-media-boot to openstack driver
The implementation does the following.

On insert:
- Upload the image directly to glance from the URL (long running)
- Create and attach a new volume the same size as the root disk
- Rebuild the server with the image, replacing the contents of the root
  disk
- Delete the image

On eject:
- Assume the attached volume has been rewritten with a new image (an ISO
  installer or IPA)
- Detach the volume
- Create an image from the volume (long running)
- Rebuild the server with the new image
- Delete the volume
- Delete the image

The long running operations are performed in a background thread task.
Only one long running operation (insert or eject) can be performed
concurrently for each server. If a long running operation fails, the
only way to feed that back to the user is by re-raising the error during
the next insert/eject request for that server.

The documentation is updated to describe OpenStack driver specifics.
Also the Redfish spec has deprecated accessing VirtualMedia via Managers
so the documentation is updated to refer via Systems.

Change-Id: I24ea943325a23a06887a185801211b4a9570e284
2024-03-13 09:41:54 +13:00

62 lines
1.7 KiB
Python

# Copyright 2018 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
class FishyError(Exception):
"""Create generic sushy-tools exception object"""
def __init__(self, msg='Unknown error', code=500):
super().__init__(msg)
self.code = code
class AliasAccessError(FishyError):
"""Node access attempted via an alias, not UUID"""
class NotSupportedError(FishyError):
"""Feature not supported by resource driver"""
def __init__(self, msg='Unsupported'):
super().__init__(msg)
class NotFound(FishyError):
"""Entity not found."""
def __init__(self, msg='Not found', code=404):
super().__init__(msg, code)
class BadRequest(FishyError):
"""Malformed request."""
def __init__(self, msg, code=400):
super().__init__(msg, code)
class FeatureNotAvailable(NotFound):
"""Feature is not available."""
def __init__(self, feature, code=404):
super().__init__(f"Feature {feature} not available", code=code)
class Conflict(FishyError):
"""Conflict with current state of the resource."""
def __init__(self, msg, code=409):
super().__init__(msg, code)