summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-09-02 12:52:02 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2011-09-02 12:52:02 -0700
commitcc3bd1da5edc368871d2c8de0e498ab2649ae0dd (patch)
tree6b45106f9f16b0e1d2323d8863693df653d50adc /nova
parente5527e712c17baa0b526cdd8dd04f6c4a7434b82 (diff)
downloadnova-cc3bd1da5edc368871d2c8de0e498ab2649ae0dd.tar.gz
nova-cc3bd1da5edc368871d2c8de0e498ab2649ae0dd.tar.xz
nova-cc3bd1da5edc368871d2c8de0e498ab2649ae0dd.zip
revert description changes, use metadata['description'] if it is set to populate field in db
Diffstat (limited to 'nova')
-rw-r--r--nova/api/openstack/create_instance_helper.py9
-rw-r--r--nova/api/openstack/schemas/v1.1/server.rng1
-rw-r--r--nova/api/openstack/servers.py6
-rw-r--r--nova/api/openstack/views/servers.py1
-rw-r--r--nova/tests/api/openstack/test_servers.py28
5 files changed, 7 insertions, 38 deletions
diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py
index ff3be4a01..289f87921 100644
--- a/nova/api/openstack/create_instance_helper.py
+++ b/nova/api/openstack/create_instance_helper.py
@@ -161,6 +161,10 @@ class CreateInstanceHelper(object):
'config_drive': config_drive,
'password': password}
+ # NOTE(vish): This is solely for compatibility with anything
+ # that is using the display description field.
+ metadata = server_dict.get('metadata') or {}
+ display_description = metadata.get('description') or ''
return (extra_values,
create_method(context,
inst_type,
@@ -168,10 +172,9 @@ class CreateInstanceHelper(object):
kernel_id=kernel_id,
ramdisk_id=ramdisk_id,
display_name=name,
- display_description=server_dict.\
- get('description', ''),
+ display_description=display_description,
key_name=key_name,
- metadata=server_dict.get('metadata', {}),
+ metadata=metadata,
access_ip_v4=server_dict.get('accessIPv4'),
access_ip_v6=server_dict.get('accessIPv6'),
injected_files=injected_files,
diff --git a/nova/api/openstack/schemas/v1.1/server.rng b/nova/api/openstack/schemas/v1.1/server.rng
index 203728f48..ef835e408 100644
--- a/nova/api/openstack/schemas/v1.1/server.rng
+++ b/nova/api/openstack/schemas/v1.1/server.rng
@@ -3,7 +3,6 @@
<attribute name="name"> <text/> </attribute>
<attribute name="userId"> <text/> </attribute>
<attribute name="tenantId"> <text/> </attribute>
- <attribute name="description"> <text/> </attribute>
<attribute name="id"> <text/> </attribute>
<attribute name="uuid"> <text/> </attribute>
<attribute name="updated"> <text/> </attribute>
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 7f5463e70..46a111cf5 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -185,9 +185,6 @@ class Controller(object):
self.helper._validate_server_name(name)
update_dict['display_name'] = name.strip()
- if 'description' in body['server']:
- description = body['server']['description']
- update_dict['display_description'] = description.strip()
if 'accessIPv4' in body['server']:
access_ipv4 = body['server']['accessIPv4']
update_dict['access_ip_v4'] = access_ipv4.strip()
@@ -881,7 +878,6 @@ class ServerXMLSerializer(wsgi.XMLDictSerializer):
node.setAttribute('uuid', str(server['uuid']))
node.setAttribute('hostId', str(server['hostId']))
node.setAttribute('name', server['name'])
- node.setAttribute('description', server['description'])
node.setAttribute('created', str(server['created']))
node.setAttribute('updated', str(server['updated']))
node.setAttribute('status', server['status'])
@@ -997,7 +993,7 @@ def create_resource(version='1.0'):
"attributes": {
"server": ["id", "imageId", "name", "flavorId", "hostId",
"status", "progress", "adminPass", "flavorRef",
- "imageRef", "userId", "tenantId", "description"],
+ "imageRef", "userId", "tenantId"],
"link": ["rel", "type", "href"],
},
"dict_collections": {
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index 98ccd817a..ac09b5864 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -68,7 +68,6 @@ class ViewBuilder(object):
'name': inst['display_name'],
'user_id': inst.get('user_id', ''),
'tenant_id': inst.get('project_id', ''),
- 'description': inst.get('display_description', ''),
'status': common.status_from_state(vm_state, task_state)}
# Return the metadata as a dictionary
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py
index d5de1aa3c..45ad6e5a8 100644
--- a/nova/tests/api/openstack/test_servers.py
+++ b/nova/tests/api/openstack/test_servers.py
@@ -2268,34 +2268,6 @@ class ServersTest(test.TestCase):
self.assertEqual(res_dict['server']['id'], 1)
self.assertEqual(res_dict['server']['name'], 'server_test')
- def test_update_server_description_v1_1(self):
- DESC = 'updated_desc'
-
- def server_update(context, id, params):
- # assert that parameter conversion from description
- # to display_description worked correctly
- self.assertEqual(params.get('display_description'), DESC)
- return stub_instance(1,
- name='server_test',
- description=params['display_description'])
-
- self.stubs.Set(nova.db.api, 'instance_get',
- return_server_with_attributes(name='server_test',
- description=DESC))
-
- self.stubs.Set(nova.db.api, 'instance_update',
- server_update)
-
- req = webob.Request.blank('/v1.1/fake/servers/1')
- req.method = 'PUT'
- req.content_type = 'application/json'
- req.body = json.dumps({'server': {'description': DESC}})
- res = req.get_response(fakes.wsgi_app())
- self.assertEqual(res.status_int, 200)
- res_dict = json.loads(res.body)
- self.assertEqual(res_dict['server']['id'], 1)
- self.assertEqual(res_dict['server']['description'], DESC)
-
def test_update_server_access_ipv4_v1_1(self):
self.stubs.Set(nova.db.api, 'instance_get',
return_server_with_attributes(access_ipv4='0.0.0.0'))