Host Maintenance API v1

Host Maintenance API v1

Admin

These APIs are meant for infrastructure admin who is in charge of triggering the rolling maintenance and upgrade workflows.

Maintenance

POST
/v1/maintenance/

Create maintenance session

Create a new maintenance session. You can specify a list of ‘hosts’ to be maintained or have an empty list to indicate those should be self-discovered. You need to have an initial state for the workflow in ‘state’. ‘workflow’ indicates the name of a Python plug-in to be used in the maintenance.

Planned future functionality

‘download’ can contain a list of URLs from where the needed software changes are downloaded. It can also provide plug-ins to be used.

‘actions’ can contain a list of action plug-ins to be called before maintenance starts, on each host or after the maintenance.

Request

Name In Type Description
hosts body list of strings Hosts to be maintained. An empty list can indicate hosts are to be discovered.
state body string Maintenance workflow state.
maintenance_at body string Maintenance workflow start time.
workflow body string Maintenance workflow to be used.
metadata body dictionary Metadata; like hints to projects
download (Optional) body list of dictionaries

List of needed SW upgrades

New in version > 1

actions body list of dictionaries List of action plug-ins.
actions.plugin body string plug-in name. Default workflow executes same type of plug-ins in an alphabetical order
actions.type body integer

Type of the action plug-in. Default workflow supports:

  • pre: executed before the host specific plug-ins
  • post: executed after the host specific plug-ins
  • host: executed for every host
  • compute: executed for every compute host
  • controller: executed for every controller host
actions.metadata body dictionary Metadata; hints to plug-ins
{
    "hosts": ["overcloud-novacompute-1.opnfvlf.org",
              "overcloud-novacompute-2.opnfvlf.org",
              "overcloud-novacompute-3.opnfvlf.org"],
    "state": "MAINTENANCE",
    "maintenance_at": "2018-02-28 06:06:03",
    "metadata": {"openstack_release": "Queens"},
    "workflow": "default",
    "download": ["https://my.sw.upgrades.com/SW1.tar.gz",
                 "https://my.sw.upgrades.com/ESW1.tar.gz",
                 "https://my.sw.upgrades.com/plugins1.tar.gz"],
    "actions": [
        {"plugin": "prepare", "type": "pre"},
        {"plugin": "esw_upgrade", "type": "host", "metadata": {"upgrade": "ESW1"}},
        {"plugin": "os_upgrade", "type": "host", "metadata": {"upgrade": "SW1"}},
        {"plugin": "finalize", "type": "post"}]
}

Response codes

Success
Code Reason
200 - OK
Name In Type Description
session_id body string uuid
{
    "session_id": "695030ee-1c4d-11e8-a9b0-0242ac110002"
}
Error
Code Reason
404 - Not Found The requested resource could not be found.
POST
/v1/maintenance/{session_id}/

Update maintenance session (planned future functionality)

Update existing maintenance session. This can be used to continue a failed session.

Request

Name In Type Description
session_id (Optional) path string

Session ID

New in version > 1

GET
/v1/maintenance/

Get maintenance sessions

Get all ongoing maintenance sessions.

Response codes

Success
Code Reason
200 - OK
Name In Type Description
session_id body string list of UUID strings
{
    "session_id": ["695030ee-1c4d-11e8-a9b0-0242ac110002"]
}
Error
Code Reason
404 - Not Found The requested resource could not be found.
GET
/v1/maintenance/{session_id}/

Get maintenance session

Get a maintenance session state.

Request

Name In Type Description
session_id (Optional) path string

Session ID

New in version > 1

Response codes

Success
Code Reason
200 - OK
Name In Type Description
state body string Maintenance workflow state.
{
    "state": "MAINTENANCE_DONE"
}
Error
Code Reason
404 - Not Found The requested resource could not be found.
DELETE
/v1/maintenance/{session_id}/

Delete maintenance session

Delete a maintenance session. Usually called after the session is successfully finished.

Success

Code Reason
200 - OK Request was successful.

Error

Code Reason
404 - Not Found The requested resource could not be found.

Future

On top of some expected changes mentioned above, it will also be handy to get detailed information about the steps run already in the maintenance session. This will be helpful when need to figure out any correcting actions to successfully finish a failed session. There is ongoing work to have everything kept in a database and that will be a key feature to enable these changes.

Project

These APIs are meant for projects having instances on top of the infrastructure under corresponding rolling maintenance or upgrade session. Usage of these APIs expects there is an application manager (VNFM) that can interact with Fenix workflow via these APIs. If this is not the case, workflow should have a default behavior for instances owned by projects, that are not interacting with Fenix.

Project

These APIs are generic for any cloud as instance ID should be something that can be matched to virtual machines or containers regardless of the cloud underneath.

GET
/v1/maintenance/{session_id}/{project_id}/

Get project maintenance session

Get project instances belonging to the current state of maintenance session. the Project-manager receives an AODH event alarm telling about different maintenance states. Event data field length is very limited, so instances cannot be given as a list in the event. Instead, there will be an URL given to below API to get a project-specific list of instances.

Request

Name In Type Description
session_id path string uuid
project_id path string uuid

Response codes

Success
Code Reason
200 - OK
Name In Type Description
instance_ids body list of strings List of instance IDs.
{
    "instance_ids": ["109e14d9-6566-42b3-93e4-76605f264d8f",
                     "71285107-f0fc-4428-a8b2-0b3edd64bcad"]
}
Error
Code Reason
404 - Not Found The requested resource could not be found.
PUT
/v1/maintenance/{session_id}/{project_id}/

Input from project to maintenance session

Project having instances on top of the infrastructure handled by a maintenance session might need to make own action for its instances on top of a host going into maintenance next, or reply an admin action to be done. This is, as the host can go down or even be removed and the instances should be then running safely somewhere else. Project manager receives an AODH event alarm telling which instances are affected and when the project is ready, it makes its own action or replies back an action which needs the admin privileges.

Request

Name In Type Description
session_id path string uuid
project_id path string uuid
instance_actions body dictionary instance ID : action string
state body string There can have different values depending on what is the maintenance session state to reply to. In the below example, the maintenance state is ‘PLANNED_MAINTENANCE’ and the reply state is formed by adding ‘ACK_’ or ‘NACK_’ as the prefix to reply value.
{
    "instance_actions": {"109e14d9-6566-42b3-93e4-76605f264d8f": "MIGRATE",
                         "71285107-f0fc-4428-a8b2-0b3edd64bcad": "MIGRATE"},
    "state": "ACK_PLANNED_MAINTENANCE"
}

Response codes

Success
Code Reason
200 - OK Request was successful.
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.