Jump to: navigation, search

ServicePluginDocumentation

Services Extension Documentation

Description

The services extension for Nova is a tool to provide additional visibility into a running Nova installation, providing metrics, version, and configuration information.

Installation

Server-Side (Nova)

To use the service plugin, you must install the server-side extension into the nova/api/openstack/compute/contrib directory and then restart the API server.

Client-Side (Novaclient)

To use the service plugin from novaclient, you must install the novaclient extension. The easiest way to do this is to run:


pip install rax_services_python_novaclient_ext


Novaclient Extension Usage

Listing Available Services

$ nova service-list

+----+-----------+---------+----------+--------------+---------------------+
| ID |   topic   |   host  | disabled | report_count |      updated_at     |
+----+-----------+---------+----------+--------------+---------------------+
| 1  | compute   | squeeze | False    | 704782       | 2012-02-01 19:14:28 |
| 2  | scheduler | squeeze | False    | 714968       | 2012-02-01 19:14:34 |
| 3  | network   | squeeze | False    | 714983       | 2012-02-01 19:14:26 |
| 4  | console   | squeeze | False    | 0            | None                |
+----+-----------+---------+----------+--------------+---------------------+


Showing Basic Service Info

This shows information common to all services.


$ nova service-show 1

+--------------+------------------------------------------+
|   Property   |                  Value                   |
+--------------+------------------------------------------+
| disabled     | False                                    |
| host         | squeeze                                  |
| href         | http://10.127.4.222:8774/v1.1/services/1 |
| id           | 1                                        |
| report_count | 704789                                   |
| topic        | compute                                  |
| updated_at   | 2012-02-01 19:15:39                      |
+--------------+------------------------------------------+


Show Additional Service Details

This will show any information specific to a particular service-type. For example, the compute service will include hypervisor information.


$ nova service-details 1

+------------------------+-------+
|        Property        | Value |
+------------------------+-------+
| cpu_info               | 8     |
| hypervisor_type        | xen   |
| hypervisor_version     | 0     |
| local_gb               | 265   |
| local_gb_used          | 23    |
| memory_mb              | 32767 |
| memory_mb_used         | 2216  |
| memory_mb_used_servers | 256   |
| vcpus                  | 0     |
| vcpus_used             | 0     |
+------------------------+-------+


List Servers Belonging to Compute Resource

nova service-servers 1
+--------------------------------------+------------+--------+-------------------+
|                  ID                  |    Name    | Status |      Networks     |
+--------------------------------------+------------+--------+-------------------+
| 855f28fd-1d89-4a7d-b5a5-f4dd54e83550 | apple      | ACTIVE | private=10.0.0.34 |
| dae7b332-de5d-4fdd-a82b-1354e5b69f88 | dewberry   | ACTIVE | private=10.0.0.37 |
| f057f9ca-77db-445c-9867-77da79006232 | cherry     | ACTIVE | private=10.0.0.36 |
| f64687c3-9f93-46a0-81b8-be65d8286a69 | blackberry | ACTIVE | private=10.0.0.35 |
+--------------------------------------+------------+--------+-------------------+


Show Service Configuration Information

This will show Nova's FLAG settings.


$ nova service-config 1

+------------------------+-------+
|        Property        | Value |
+------------------------+-------+
| flag                   | 0     |
+------------------------+-------+


Show Service Version

$ nova service-version 1
2012.1-dev


Disable Service

nova service-disable 1


Enable Service

nova service-enable 1


API

Preface

To aid readability of these docs, the JSON response is run through a pretty-printer. The command used is:

alias ppjson="python -mjson.tool"


If you'd like XML returned instead of JSON, you can supply a Content-Type header on the request. With curl add:


-H "Content-Type: application/xml"


The XML output can be pretty printed using:


alias ppxml='python -c "import sys, xml.dom.minidom; print xml.dom.minidom.parseString(sys.stdin.read()).toprettyxml()"'


Listing Available Services

GET /services


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services | ppjson

> GET /v1.1/openstack/services HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 710
< Date: Wed, 08 Feb 2012 18:34:17 GMT
< 
{
    "services": [
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/1", 
            "id": 1, 
            "report_count": 764419, 
            "topic": "compute", 
            "updated_at": "2012-02-08 18:34:10"
        }, 
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/2", 
            "id": 2, 
            "report_count": 775038, 
            "topic": "scheduler", 
            "updated_at": "2012-02-08 18:34:14"
        }, 
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/3", 
            "id": 3, 
            "report_count": 775054, 
            "topic": "network", 
            "updated_at": "2012-02-08 18:34:10"
        }, 
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/4", 
            "id": 4, 
            "report_count": 0, 
            "topic": "console", 
            "updated_at": null
        }
    ]
}


Showing Basic Service Info

GET /services/<ID>


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1 | ppjson
> GET /v1.1/openstack/services/1 HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 190
< Date: Wed, 08 Feb 2012 18:40:10 GMT
< 
{
    "service": {
        "disabled": false, 
        "host": "squeeze", 
        "href": "http://127.0.0.1:8774/v1.1/services/1", 
        "id": 1, 
        "report_count": 764454, 
        "topic": "compute", 
        "updated_at": "2012-02-08 18:40:01"
    }
}


Show Additional Service Details

GET /services/<ID>/details


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1/details | ppjson

> GET /v1.1/openstack/services/1/details HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 221
< Date: Wed, 08 Feb 2012 18:45:18 GMT
< 
{
    "details": {
        "cpu_info": "8", 
        "hypervisor_type": "xen", 
        "hypervisor_version": 0, 
        "local_gb": 229, 
        "local_gb_used": 21, 
        "memory_mb": 32767, 
        "memory_mb_used": 2282, 
        "memory_mb_used_servers": 0, 
        "vcpus": 0, 
        "vcpus_used": 0
    }
}


List Servers Belonging to Compute Resource

GET /services/<ID>/servers


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1/servers | ppjson

> GET /v1.1/openstack/services/1/servers HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 967
< Date: Wed, 08 Feb 2012 18:48:35 GMT
< 
{
    "servers": [
        {
            "accessIPv4": "", 
            "accessIPv6": "", 
            "addresses": {
                "private": [
                    {
                        "addr": "10.0.0.38", 
                        "version": 4
                    }
                ]
            }, 
            "config_drive": "", 
            "created": "2012-02-08T02:53:22Z", 
            "flavor": {
                "id": "1", 
                "links": [
                    {
                        "href": "http://127.0.0.1:8774/openstack/flavors/1", 
                        "rel": "bookmark"
                    }
                ]
            }, 
            "hostId": "aa2e9509e419ded81924c50543bef1c3df387b564abb12a097a49ded", 
            "id": "fb243545-328f-422c-9949-ae35a336030a", 
            "image": {
                "id": "1a6212db-c2b5-46e6-954f-50c685469364", 
                "links": [
                    {
                        "href": "http://127.0.0.1:8774/openstack/images/1a6212db-c2b5-46e6-954f-50c685469364", 
                        "rel": "bookmark"
                    }
                ]
            }, 
            "key_name": "", 
            "links": [
                {
                    "href": "http://127.0.0.1:8774/v1.1/openstack/servers/fb243545-328f-422c-9949-ae35a336030a", 
                    "rel": "self"
                }, 
                {
                    "href": "http://127.0.0.1:8774/openstack/servers/fb243545-328f-422c-9949-ae35a336030a", 
                    "rel": "bookmark"
                }
            ], 
            "metadata": {}, 
            "name": "apple", 
            "progress": 100, 
            "status": "RESIZE", 
            "tenant_id": "openstack", 
            "updated": "2012-02-08T04:59:16Z", 
            "user_id": "rick"
        }
    ]
}


Show Service Configuration Information

GET /services/<ID>/config


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1/config | ppjson
> GET /v1.1/openstack/services/1/config HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 12063
< Date: Wed, 08 Feb 2012 18:51:56 GMT
<
{
    "config": {
        "agent_version_timeout": 300,
        "ajax_console_proxy_port": 8000,
        "ajax_console_proxy_topic": "ajax_proxy",
        "ajax_console_proxy_url": "http://127.0.0.1:8000",
        "ajaxterm_portrange": "10000-12000",  
        "allow_resize_to_same_host": true,
        "allow_same_net_traffic": true,
        "allowed_roles": [
            "cloudadmin",
            "itsec",
            "sysadmin",
            "netadmin",
            "developer"
        ],

... (more) ...


Show Service Version

GET /services/<ID>/version


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1/version | ppjson
> GET /v1.1/openstack/services/1/version HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 37
< Date: Wed, 08 Feb 2012 18:54:32 GMT
< 
{
    "version": {
        "string": "2012.1-dev"
    }
}


Disable Service

POST /services/<ID>/disable

$ curl -v -X POST \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1/disable
> POST /v1.1/openstack/services/1/disable HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Length: 0
< Content-Type: application/json
< Date: Wed, 08 Feb 2012 18:58:21 GMT


Enable Service

POST /services/<ID>/enable

$ curl -v -X POST \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services/1/enable
> POST /v1.1/openstack/services/1/disable HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Length: 0
< Content-Type: application/json
< Date: Wed, 08 Feb 2012 18:58:21 GMT