Remove accessips attribute from V2.1 POST server resp

In case of v2.1, if "os-access-ips" extension is enabled then server
POST response contain access ips attribute which does not match
with V2 response. V2 server POST response never have access ips attribute.

V2.1 must be identical with V2 and must not contain any new attributes in
response. This commit remove these extra attributes from V2.1 API.

V2 server POST response-
{
    "server": {
        "OS-DCF:diskConfig": "AUTO",
        "adminPass": "ahW3PjQNAu6r",
        "id": "e726f5ae-8179-44ba-bbfb-8a0c52b33095",
        "links": [
            {
                "href": "http://openstack.example.com/v2/openstack/
servers/e726f5ae-8179-44ba-bbfb-8a0c52b33095",
                "rel": "self"
            },
            {
                "href": "http://openstack.example.com/openstack/
servers/e726f5ae-8179-44ba-bbfb-8a0c52b33095",
                "rel": "bookmark"
            }
        ],
        "security_groups": [
            {
                "name": "default"
            }
        ]
    }
}

V2.1 server POST response-
{
    "server": {
        "OS-DCF:diskConfig": "AUTO",
        "adminPass": "zPnp2GseTqG4",
        "id": "8195065c-fea4-4d57-b93f-5c5c63fe90e8",
        "links": [
            {
                "href": "http://openstack.example.com/v3/servers/
8195065c-fea4-4d57-b93f-5c5c63fe90e8",
                "rel": "self"
            },
            {
                "href": "http://openstack.example.com/servers/
8195065c-fea4-4d57-b93f-5c5c63fe90e8",
                "rel": "bookmark"
            }
        ],
        "accessIPv4": "",
        "accessIPv6": "",
        "security_groups": [
            {
                "name": "default"
            }
        ]
    }
}

Partially implements blueprint v2-on-v3-api

Change-Id: Ib9197cc9061bbba0c040f237bb52d12a60a976d7
This commit is contained in:
ghanshyam 2015-02-26 15:42:27 +09:00 committed by Ghanshyam Mann
parent 8a77cb1d2e
commit 1c29a25ca5
6 changed files with 2 additions and 23 deletions

View File

@ -13,8 +13,6 @@
"rel": "bookmark"
}
],
"accessIPv4": "",
"accessIPv6": "",
"security_groups": [
{
"name": "default"

View File

@ -11,8 +11,6 @@
"href": "http://openstack.example.com/servers/934760e1-2b0b-4f9e-a916-eac1e69839dc",
"rel": "bookmark"
}
],
"accessIPv4": "1.2.3.4",
"accessIPv6": "fe80::"
]
}
}

View File

@ -30,13 +30,6 @@ class AccessIPsController(wsgi.Controller):
server['accessIPv6'] = (
str(ip_v6) if ip_v6 is not None else '')
@wsgi.extends
def create(self, req, resp_obj, body):
context = req.environ['nova.context']
if authorize(context) and 'server' in resp_obj.obj:
server = resp_obj.obj['server']
self._extend_server(req, server)
@wsgi.extends
def show(self, req, resp_obj, id):
context = req.environ['nova.context']

View File

@ -17,8 +17,6 @@
{
"name": "default"
}
],
"accessIPv4": "",
"accessIPv6": ""
]
}
}

View File

@ -1,7 +1,5 @@
{
"server": {
"accessIPv4": "%(access_ip_v4)s",
"accessIPv6": "%(access_ip_v6)s",
"adminPass": "%(password)s",
"id": "%(id)s",
"links": [

View File

@ -350,12 +350,6 @@ class AccessIPsControllerTestV21(test.NoDBTestCase):
self.assertEqual(resp_obj.obj['server'][access_ips.AccessIPs.v6_key],
'')
def test_create(self):
self._test_with_access_ips(self.controller.create, {'body': {}})
def test_create_without_access_ips(self):
self._test_with_access_ips(self.controller.create, {'body': {}})
def test_show(self):
self._test_with_access_ips(self.controller.show)