Compute API extension os-hypervisors not documented

Bug #1027287 reported by Anne Gentle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack-manuals
Fix Released
High
Anne Gentle

Bug Description

We need a WADL to document the os-hypervisors extension to the Compute API.

It's an admin-only extension. Here's snippets of code that should help document it.

The WADL can go with the other extension WADLs at https://github.com/openstack/openstack-manuals/tree/master/doc/src/docbkx/openstack-api-site/src/wadls/compute-api/src/ext, use one of those as a starting point.

class HypervisorsController(object):
    """The Hypervisors API controller for the OpenStack API."""

    def __init__(self):
        self.api = compute_api.HostAPI()
        super(HypervisorsController, self).__init__()

    def _view_hypervisor(self, hypervisor, detail, servers=None, **kwargs):
        hyp_dict = {
            'id': hypervisor['id'],
            'hypervisor_hostname': hypervisor['hypervisor_hostname'],
            }

        if detail and not servers:
            for field in ('vcpus', 'memory_mb', 'local_gb', 'vcpus_used',
                          'memory_mb_used', 'local_gb_used',
                          'hypervisor_type', 'hypervisor_version',
                          'free_ram_mb', 'free_disk_gb', 'current_workload',
                          'running_vms', 'cpu_info', 'disk_available_least'):
                hyp_dict[field] = hypervisor[field]

            hyp_dict['service'] = {
                'id': hypervisor['service_id'],
                'host': hypervisor['service']['host'],
                }

        if servers:
            hyp_dict['servers'] = [dict(name=serv['name'], uuid=serv['uuid'])
                                   for serv in servers]

...

class Hypervisors(extensions.ExtensionDescriptor):
    """Admin-only hypervisor administration"""

    name = "Hypervisors"
    alias = "os-hypervisors"
    namespace = "http://docs.openstack.org/compute/ext/hypervisors/api/v1.1"
    updated = "2012-06-21T00:00:00+00:00"

    def get_resources(self):
        resources = [extensions.ResourceExtension('os-hypervisors',
                HypervisorsController(),
                collection_actions={'detail': 'GET'},
                member_actions={'uptime': 'GET',
                                'search': 'GET',
                                'servers': 'GET'})]

Tags: compute-api
Anne Gentle (annegentle)
Changed in openstack-manuals:
assignee: nobody → Anne Gentle (annegentle)
Tom Fifield (fifieldt)
Changed in openstack-manuals:
milestone: none → folsom
Anne Gentle (annegentle)
tags: added: compute-api
Revision history for this message
Anne Gentle (annegentle) wrote :
Revision history for this message
Anne Gentle (annegentle) wrote :
Changed in openstack-manuals:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-manuals (master)

Reviewed: https://review.openstack.org/12031
Committed: http://github.com/openstack/openstack-manuals/commit/a7d99fb7b01c7b2bf2970ee799de56db24757482
Submitter: Jenkins
Branch: master

commit a7d99fb7b01c7b2bf2970ee799de56db24757482
Author: annegentle <email address hidden>
Date: Mon Aug 27 18:39:38 2012 -0500

    Adds os-hypervisors doc for api site.

    fix bug 1031837
    fix bug 1027287

    Change-Id: I1116be389a963a70b15c5d5f3282fcd13bd2b18d

Changed in openstack-manuals:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.