diff --git a/doc/v3/api_samples/os-config-drive/server-config-drive-get-resp.json b/doc/v3/api_samples/os-config-drive/server-config-drive-get-resp.json
new file mode 100644
index 000000000000..d31c241f1a99
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/server-config-drive-get-resp.json
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "mac_addr": "aa:bb:cc:dd:ee:ff",
+ "type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "2013-09-22T02:33:23Z",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "host_id": "1642bbdbd61a0f1c513b4bb6e418326103172698104bfa278eca106b",
+ "id": "7838ff1b-b71f-48b9-91e9-7c08de20b249",
+ "image": {
+ "id": "70a599e0-31e7-49b7-b260-868f441e862b",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/7838ff1b-b71f-48b9-91e9-7c08de20b249",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/7838ff1b-b71f-48b9-91e9-7c08de20b249",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "os-config-drive:config_drive": "",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "2013-09-22T02:33:25Z",
+ "user_id": "fake"
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/server-config-drive-get-resp.xml b/doc/v3/api_samples/os-config-drive/server-config-drive-get-resp.xml
new file mode 100644
index 000000000000..cb99b4be4705
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/server-config-drive-get-resp.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+ Apache1
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/server-post-req.json b/doc/v3/api_samples/os-config-drive/server-post-req.json
new file mode 100644
index 000000000000..d41985a1bc39
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/server-post-req.json
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "image_ref" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "flavor_ref" : "http://openstack.example.com/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/server-post-req.xml b/doc/v3/api_samples/os-config-drive/server-post-req.xml
new file mode 100644
index 000000000000..598839cf6a3a
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/server-post-req.xml
@@ -0,0 +1,19 @@
+
+
+
+ Apache1
+
+
+
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/server-post-resp.json b/doc/v3/api_samples/os-config-drive/server-post-resp.json
new file mode 100644
index 000000000000..b603a543df06
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/server-post-resp.json
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "admin_pass": "h2cx3Lm47BJc",
+ "id": "f0318e69-11eb-4aed-9840-59b6c72beee8",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/f0318e69-11eb-4aed-9840-59b6c72beee8",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/f0318e69-11eb-4aed-9840-59b6c72beee8",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/server-post-resp.xml b/doc/v3/api_samples/os-config-drive/server-post-resp.xml
new file mode 100644
index 000000000000..f425e2abec6b
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/server-post-resp.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json b/doc/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json
new file mode 100644
index 000000000000..97b96e7a7dd1
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json
@@ -0,0 +1,58 @@
+{
+ "servers": [
+ {
+ "addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "mac_addr": "aa:bb:cc:dd:ee:ff",
+ "type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "2013-09-22T02:33:17Z",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "host_id": "1ed067c90341cd9d94bbe5da960922b56f107262cdc75719a0d97b78",
+ "id": "f0318e69-11eb-4aed-9840-59b6c72beee8",
+ "image": {
+ "id": "70a599e0-31e7-49b7-b260-868f441e862b",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "key_name": null,
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/f0318e69-11eb-4aed-9840-59b6c72beee8",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/f0318e69-11eb-4aed-9840-59b6c72beee8",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "os-config-drive:config_drive": "",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "2013-09-22T02:33:19Z",
+ "user_id": "fake"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-config-drive/servers-config-drive-details-resp.xml b/doc/v3/api_samples/os-config-drive/servers-config-drive-details-resp.xml
new file mode 100644
index 000000000000..cf0a576c3864
--- /dev/null
+++ b/doc/v3/api_samples/os-config-drive/servers-config-drive-details-resp.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+ Apache1
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl
new file mode 100644
index 000000000000..76bf0d28ecb5
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "os-config-drive:config_drive": "%(cdrive)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "mac_addr": "aa:bb:cc:dd:ee:ff",
+ "type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(timestamp)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "host_id": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(glance_host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(timestamp)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.xml.tpl
new file mode 100644
index 000000000000..9d622b035917
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/server-config-drive-get-resp.xml.tpl
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+ Apache1
+
+
+
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl
new file mode 100644
index 000000000000..1dcb63e3b2ae
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "image_ref" : "%(host)s/openstack/images/%(image_id)s",
+ "flavor_ref" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-req.xml.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-req.xml.tpl
new file mode 100644
index 000000000000..ddb5ea78c4b5
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-req.xml.tpl
@@ -0,0 +1,19 @@
+
+
+
+ Apache1
+
+
+
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+
+
+
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl
new file mode 100644
index 000000000000..6c3100fbec86
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "admin_pass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-resp.xml.tpl
new file mode 100644
index 000000000000..3470373e171f
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/server-post-resp.xml.tpl
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl
new file mode 100644
index 000000000000..1f612adf34e9
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.json.tpl
@@ -0,0 +1,58 @@
+{
+ "servers": [
+ {
+ "os-config-drive:config_drive": "%(cdrive)s",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "mac_addr": "aa:bb:cc:dd:ee:ff",
+ "type": "fixed",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(timestamp)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "host_id": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(glance_host)s/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/servers/%(id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "metadata": {
+ "My Server Name": "Apache1"
+ },
+ "name": "new-server-test",
+ "progress": 0,
+ "status": "ACTIVE",
+ "tenant_id": "openstack",
+ "updated": "%(timestamp)s",
+ "user_id": "fake",
+ "key_name": null
+ }
+ ]
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.xml.tpl
new file mode 100644
index 000000000000..9ca93b883d3c
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-config-drive/servers-config-drive-details-resp.xml.tpl
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+ Apache1
+
+
+
+
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/test_config_drive.py b/nova/tests/integrated/v3/test_config_drive.py
new file mode 100644
index 000000000000..59c3cfde8af8
--- /dev/null
+++ b/nova/tests/integrated/v3/test_config_drive.py
@@ -0,0 +1,52 @@
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from nova.tests.api.openstack import fakes
+from nova.tests.image import fake
+from nova.tests.integrated.v3 import test_servers
+
+
+class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase):
+ extension_name = 'os-config-drive'
+
+ def setUp(self):
+ super(ConfigDriveSampleJsonTest, self).setUp()
+ fakes.stub_out_networking(self.stubs)
+ fakes.stub_out_rate_limiting(self.stubs)
+ fake.stub_out_image_service(self.stubs)
+
+ def test_config_drive_show(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ # config drive can be a string for True or empty value for False
+ subs['cdrive'] = '.*'
+ self._verify_response('server-config-drive-get-resp', subs,
+ response, 200)
+
+ def test_config_drive_detail(self):
+ self._post_server()
+ response = self._do_get('servers/detail')
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ # config drive can be a string for True or empty value for False
+ subs['cdrive'] = '.*'
+ self._verify_response('servers-config-drive-details-resp',
+ subs, response, 200)
+
+
+class ConfigDriveSampleXmlTest(ConfigDriveSampleJsonTest):
+ ctype = 'xml'