Skip to content

Commit

Permalink
disk_config extension now uses OS prefix.
Browse files Browse the repository at this point in the history
Fixes bug 918433

Change-Id: Ia3177b53cd51396a29363eb595e5ca5ac47a5605
  • Loading branch information
rconradharris committed Jan 18, 2012
1 parent 0ed09a3 commit 2cd3b86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions nova/api/openstack/compute/contrib/disk_config.py
Expand Up @@ -24,8 +24,8 @@
from nova import db
from nova import utils

ALIAS = 'RAX-DCF'
XMLNS_DCF = "http://docs.rackspacecloud.com/servers/api/ext/diskConfig/v1.0"
ALIAS = 'OS-DCF'
XMLNS_DCF = "http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
API_DISK_CONFIG = "%s:diskConfig" % ALIAS
INTERNAL_DISK_CONFIG = "auto_disk_config"

Expand Down
18 changes: 11 additions & 7 deletions nova/tests/api/openstack/compute/contrib/test_disk_config.py
Expand Up @@ -35,6 +35,9 @@
FLAGS = flags.FLAGS


API_DISK_CONFIG = 'OS-DCF:diskConfig'


def instance_addresses(context, instance_id):
return None

Expand Down Expand Up @@ -123,8 +126,8 @@ def fake_instance_add_security_group(context, instance_id,
self.app = app

def assertDiskConfig(self, dict_, value):
self.assert_('RAX-DCF:diskConfig' in dict_)
self.assertEqual(dict_['RAX-DCF:diskConfig'], value)
self.assert_(API_DISK_CONFIG in dict_)
self.assertEqual(dict_[API_DISK_CONFIG], value)

def test_show_server(self):
req = fakes.HTTPRequest.blank(
Expand Down Expand Up @@ -181,7 +184,7 @@ def test_create_server_override_auto(self):
'name': 'server_test',
'imageRef': 'cedef40a-ed67-4d10-800e-17455edce175',
'flavorRef': '1',
'RAX-DCF:diskConfig': 'AUTO'
API_DISK_CONFIG: 'AUTO'
}}

req.body = utils.dumps(body)
Expand All @@ -197,7 +200,7 @@ def test_create_server_override_manual(self):
'name': 'server_test',
'imageRef': 'cedef40a-ed67-4d10-800e-17455edce175',
'flavorRef': '1',
'RAX-DCF:diskConfig': 'MANUAL'
API_DISK_CONFIG: 'MANUAL'
}}

req.body = utils.dumps(body)
Expand Down Expand Up @@ -243,10 +246,11 @@ def test_update_server_invalid_disk_config(self):
'/fake/servers/%s' % MANUAL_INSTANCE_UUID)
req.method = 'PUT'
req.content_type = 'application/json'
body = {'server': {'RAX-DCF:diskConfig': 'server_test'}}
body = {'server': {API_DISK_CONFIG: 'server_test'}}
req.body = utils.dumps(body)
res = req.get_response(self.app)
self.assertEqual(res.status_int, 400)
expected_msg = '{"badRequest": {"message": "RAX-DCF:diskConfig must'\
' be either \'MANUAL\' or \'AUTO\'.", "code": 400}}'
expected_msg = ('{"badRequest": {"message": "%s must be either'
' \'MANUAL\' or \'AUTO\'.", "code": 400}}' %
API_DISK_CONFIG)
self.assertEqual(res.body, expected_msg)

0 comments on commit 2cd3b86

Please sign in to comment.