API: Metadata Service Callbacks

Registered by John Garbutt

New metadata service API to allow guest instances to set (but not overwrite) server metadata.

This allows in-guest services to communicate externally through the Openstack API.

We already allow posts to set-password, this extends it to a more general mechanism.

To ensure its safe and not for high amounts of traffic:
* add a namespace to all keys, "from-server:"
* only set metadata keys that are not already set
* i.e. it is a single write only API

Use case 1:
* add a script in cloud-init to report back to the metadata service when cloud-init has completed
* user can poll server metadata to see when their server setup is complete

Use case 2:
* you want to build an in guest agent to reset networking
* agent can poll server metadata
* when a special key is added to reset networking, the network config can be re-run
* when its complete, the success or error code is returned using the above new API

More discussion from the Icehouse summit here:
https://etherpad.openstack.org/IcehouseNovaMetadataService

Sample API to add/update metadata through Metadata Service

The metadata keys added will be prefixed with 'from_server_' to avoid accidentally overwriting the keys added by the user through Nova API.

POST http://169.254.169.254/openstack/latest/metadata
Normal Response Code 200
An overLimit(413) fault might be thrown if the operation exceeds quota

JSON Request
{
    "meta": {
        "key_1": "value1",
        "key_2": "value2",
    }
}

JSON Response
{
    "availability_zone": "nova",
    "hostname": "test.novalocal",
    "launch_index": 0,
    "meta": {
        "priority": "low",
        "role": "webserver",

        "from_server_key_1": "value1",
        "from_server_key_2": "value2",

    },
    "name": "test",
    "public_keys": {
        "mykey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDYVEprvtYJXVOBN0XNKVVRNCRX6BlnNbI+USLGais1sUWPwtSg7z9K9vhbYAPUZcq8c/s5S9dg5vTHbsiyPCIDOKyeHba4MUJq8Oh5b2i71/3BISpyxTBH/uZDHdslW2a+SrPDCeuMMoss9NFhBdKtDkdG9zyi0ibmCP6yMdEX8Q== Generated by Nova\n"
    },
    "uuid": "d8e02d56-2648-49a3-bf97-6be8f1204f38"
}

Blueprint information

Status:
Started
Approver:
John Garbutt
Priority:
Medium
Drafter:
Claxton Correya
Direction:
Needs approval
Assignee:
Aneesh Puliyedath Udumbath
Definition:
Drafting
Series goal:
None
Implementation:
Needs Code Review
Milestone target:
None
Started by
Claxton Correya

Related branches

Sprints

Whiteboard

Sponsor: johnthetubaguy

added whiteboard into description, this seems to represent what was agreed at the summit, Approved --johnthetubaguy

Gerrit topic: https://review.openstack.org/#q,topic:bp/metadata-service-callbacks,n,z

Addressed by: https://review.openstack.org/70961 <-- merged
    Refactoring metadata/base

Addressed by: https://review.openstack.org/71496
    Adding update_metadata API to metadata service

Apologies, this missed the deadline for Feature Freeze. Please rebase patches as soon as Juno opens, and we will try to get this in during that period. --johnthetubaguy (5th March 2014)

Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)Sponsor: johnthetubaguy

added whiteboard into description, this seems to represent what was agreed at the summit, Approved --johnthetubaguy

Gerrit topic: https://review.openstack.org/#q,topic:bp/metadata-service-callbacks,n,z

Addressed by: https://review.openstack.org/70961 <-- merged
    Refactoring metadata/base

Addressed by: https://review.openstack.org/71496
    Adding update_metadata API to metadata service

Apologies, this missed the deadline for Feature Freeze. Please rebase patches as soon as Juno opens, and we will try to get this in during that period. --johnthetubaguy (5th March 2014)

Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)

Marking this blueprint as definition: Drafting. If you are still working on this, please re-submit via nova-specs. If not, please mark as obsolete, and add a quick comment to describe why. --johnthetubaguy (20th April 2014)Sponsor: johnthetubaguy

added whiteboard into description, this seems to represent what was agreed at the summit, Approved --johnthetubaguy

Gerrit topic: https://review.openstack.org/#q,topic:bp/metadata-service-callbacks,n,z

Addressed by: https://review.openstack.org/70961 <-- merged
    Refactoring metadata/base

Addressed by: https://review.openstack.org/71496
    Adding update_metadata API to metadata service

Apologies, this missed the deadline for Feature Freeze. Please rebase patches as soon as Juno opens, and we will try to get this in during that period. --johnthetubaguy (5th March 2014)

Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)Sponsor: johnthetubaguy

added whiteboard into description, this seems to represent what was agreed at the summit, Approved --johnthetubaguy

Gerrit topic: https://review.openstack.org/#q,topic:bp/metadata-service-callbacks,n,z

Addressed by: https://review.openstack.org/70961 <-- merged
    Refactoring metadata/base

Addressed by: https://review.openstack.org/71496
    Adding update_metadata API to metadata service

Apologies, this missed the deadline for Feature Freeze. Please rebase patches as soon as Juno opens, and we will try to get this in during that period. --johnthetubaguy (5th March 2014)

Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)

Marking this blueprint as definition: Drafting. If you are still working on this, please re-submit via nova-specs. If not, please mark as obsolete, and add a quick comment to describe why. --johnthetubaguy (20th April 2014)

Marking this blueprint as definition: Drafting. If you are still working on this, please re-submit via nova-specs. If not, please mark as obsolete, and add a quick comment to describe why. --johnthetubaguy (20th April 2014)

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.