summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2012-08-12 10:01:09 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2012-08-12 10:08:47 -0700
commited80ed615762e0ff24235b7d57fa8b356c659e11 (patch)
tree70183b5340c7f5331c144329dac6ff73ea0116e7 /nova/tests
parentd036fdbe0f8112e0345e80a08762e3c1bc7885f1 (diff)
Key auto_disk_config in create server off of ext.
Implements part of blueprint disable-server-extensions Makes sure that auto_disk_config is only accepted in the create server request if the extension is enabled. Note that the extension alias is OS-DCF because it also adds output to the server request. Change-Id: I59fafe769e1e562e6bf9f6db768acc9b0f8d2b93
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/test_servers.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py
index a1db243da..8d5a36168 100644
--- a/nova/tests/api/openstack/compute/test_servers.py
+++ b/nova/tests/api/openstack/compute/test_servers.py
@@ -1790,6 +1790,32 @@ class ServersControllerCreateTest(test.TestCase):
self.stubs.Set(nova.compute.api.API, 'create', create)
self._test_create_extra(params)
+ def test_create_instance_with_disk_config_enabled(self):
+ self.ext_mgr.extensions = {'OS-DCF': 'fake'}
+ # NOTE(vish): the extension converts OS-DCF:disk_config into
+ # auto_disk_config, so we are testing with
+ # the_internal_value
+ params = {'auto_disk_config': True}
+ old_create = nova.compute.api.API.create
+
+ def create(*args, **kwargs):
+ self.assertEqual(kwargs['auto_disk_config'], True)
+ return old_create(*args, **kwargs)
+
+ self.stubs.Set(nova.compute.api.API, 'create', create)
+ self._test_create_extra(params)
+
+ def test_create_instance_with_disk_config_disabled(self):
+ params = {'auto_disk_config': True}
+ old_create = nova.compute.api.API.create
+
+ def create(*args, **kwargs):
+ self.assertEqual(kwargs['auto_disk_config'], False)
+ return old_create(*args, **kwargs)
+
+ self.stubs.Set(nova.compute.api.API, 'create', create)
+ self._test_create_extra(params)
+
def test_create_instance_with_scheduler_hints_enabled(self):
self.ext_mgr.extensions = {'os-scheduler-hints': 'fake'}
hints = {'a': 'b'}