summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-12-12 19:56:49 +0000
committerGerrit Code Review <review@openstack.org>2012-12-12 19:56:49 +0000
commit46675d85dbb6c3fb7e417eb0c7ad4a4cccb30523 (patch)
tree69544edd58339c683d5e8f0f4a2fca0fc84a13d8 /nova
parent1b3a72492c1ff1d9e596831309137c88bd08706b (diff)
parent15a395f4b5b0c0fc7482f5e9345444871ff69542 (diff)
Merge "Adds API Sample tests for DiskConfig extension."
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/image-get-resp.json.tpl34
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/image-get-resp.xml.tpl12
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/image-list-resp.json.tpl214
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/image-list-resp.xml.tpl71
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.json.tpl57
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.xml.tpl21
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.json.tpl6
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.xml.tpl6
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.json.tpl56
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.xml.tpl19
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-get-resp.json.tpl55
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-get-resp.xml.tpl19
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-post-req.json.tpl17
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-post-req.xml.tpl19
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-post-resp.json.tpl17
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-post-resp.xml.tpl6
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.json.tpl6
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.xml.tpl6
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.json.tpl5
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.xml.tpl5
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.json.tpl55
-rw-r--r--nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.xml.tpl24
-rw-r--r--nova/tests/integrated/test_api_samples.py75
23 files changed, 805 insertions, 0 deletions
diff --git a/nova/tests/integrated/api_samples/OS-DCF/image-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/image-get-resp.json.tpl
new file mode 100644
index 000000000..3c7e80497
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/image-get-resp.json.tpl
@@ -0,0 +1,34 @@
+{
+ "image": {
+ "OS-DCF:diskConfig": "AUTO",
+ "created": "%(timestamp)s",
+ "id": "%(image_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(image_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(image_id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(image_id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/image-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/image-get-resp.xml.tpl
new file mode 100644
index 000000000..a68b578e9
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/image-get-resp.xml.tpl
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<image xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2011-01-01T01:02:03Z" name="fakeimage7" created="2011-01-01T01:02:03Z" minDisk="0" progress="100" minRam="0" id="%(image_id)s" OS-DCF:diskConfig="AUTO">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="auto_disk_config">True</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ <meta key="architecture">x86_64</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(image_id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(image_id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(image_id)s" type="application/vnd.openstack.image" rel="alternate"/>
+</image>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/image-list-resp.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/image-list-resp.json.tpl
new file mode 100644
index 000000000..fc10c3315
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/image-list-resp.json.tpl
@@ -0,0 +1,214 @@
+{
+ "images": [
+ {
+ "OS-DCF:diskConfig": "AUTO",
+ "created": "%(timestamp)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "True",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage7",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ },
+ {
+ "created": "%(timestamp)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ },
+ {
+ "created": "%(timestamp)s",
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(uuid)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(uuid)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ },
+ {
+ "OS-DCF:diskConfig": "MANUAL",
+ "created": "%(timestamp)s",
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(uuid)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(uuid)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "architecture": "x86_64",
+ "auto_disk_config": "False",
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage6",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ },
+ {
+ "created": "%(timestamp)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "%(id)s",
+ "ramdisk_id": null
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ },
+ {
+ "created": "%(timestamp)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ },
+ {
+ "created": "%(timestamp)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/images/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/images/%(id)s",
+ "rel": "bookmark"
+ },
+ {
+ "href": "%(glance_host)s/openstack/images/%(id)s",
+ "rel": "alternate",
+ "type": "application/vnd.openstack.image"
+ }
+ ],
+ "metadata": {
+ "kernel_id": "nokernel",
+ "ramdisk_id": "nokernel"
+ },
+ "minDisk": 0,
+ "minRam": 0,
+ "name": "fakeimage123456",
+ "progress": 100,
+ "status": "ACTIVE",
+ "updated": "%(timestamp)s"
+ }
+ ]
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/image-list-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/image-list-resp.xml.tpl
new file mode 100644
index 000000000..b0d5218b5
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/image-list-resp.xml.tpl
@@ -0,0 +1,71 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<images xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage7" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s" OS-DCF:diskConfig="AUTO">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="auto_disk_config">True</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ <meta key="architecture">x86_64</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage123456" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ <meta key="architecture">x86_64</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage123456" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage6" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s" OS-DCF:diskConfig="MANUAL">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="auto_disk_config">False</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ <meta key="architecture">x86_64</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage123456" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s">
+ <metadata>
+ <meta key="kernel_id">%(id)s</meta>
+ <meta key="ramdisk_id">None</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage123456" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+ <image status="ACTIVE" updated="%(timestamp)s" name="fakeimage123456" created="%(timestamp)s" minDisk="0" progress="100" minRam="0" id="%(id)s">
+ <metadata>
+ <meta key="kernel_id">nokernel</meta>
+ <meta key="ramdisk_id">nokernel</meta>
+ </metadata>
+ <atom:link href="%(host)s/v2/openstack/images/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/images/%(id)s" rel="bookmark"/>
+ <atom:link href="%(glance_host)s/openstack/images/%(id)s" type="application/vnd.openstack.image" rel="alternate"/>
+ </image>
+</images>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.json.tpl
new file mode 100644
index 000000000..acb9bf531
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.json.tpl
@@ -0,0 +1,57 @@
+{
+ "servers": [
+ {
+ "OS-DCF:diskConfig": "AUTO",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(timestamp)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/openstack/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/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"
+ }
+ ]
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.xml.tpl
new file mode 100644
index 000000000..52e1a5203
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/list-servers-detail-get.xml.tpl
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
+ <server status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" OS-DCF:diskConfig="AUTO">
+ <image id="%(uuid)s">
+ <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
+ </image>
+ <flavor id="1">
+ <atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
+ </flavor>
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <addresses>
+ <network id="private">
+ <ip version="4" addr="%(ip)s"/>
+ </network>
+ </addresses>
+ <atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
+ </server>
+</servers>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.json.tpl
new file mode 100644
index 000000000..b239818a8
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "rebuild": {
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.xml.tpl
new file mode 100644
index 000000000..93bfb0d4e
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-req.xml.tpl
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rebuild xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns="http://docs.openstack.org/compute/api/v1.1"
+ imageRef="%(host)s/openstack/images/%(image_id)s"
+ OS-DCF:diskConfig="AUTO" />
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.json.tpl
new file mode 100644
index 000000000..1608b9f6b
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.json.tpl
@@ -0,0 +1,56 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4
+ }
+ ]
+ },
+ "adminPass": "%(password)s",
+ "created": "%(timestamp)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/openstack/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/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"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.xml.tpl
new file mode 100644
index 000000000..b760fe5eb
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-action-rebuild-resp.xml.tpl
@@ -0,0 +1,19 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" adminPass="%(password)s" OS-DCF:diskConfig="AUTO">
+ <image id="%(uuid)s">
+ <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
+ </image>
+ <flavor id="1">
+ <atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
+ </flavor>
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <addresses>
+ <network id="private">
+ <ip version="4" addr="%(ip)s"/>
+ </network>
+ </addresses>
+ <atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
+</server>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-get-resp.json.tpl
new file mode 100644
index 000000000..25e51a878
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-get-resp.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(timestamp)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/openstack/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/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"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-get-resp.xml.tpl
new file mode 100644
index 000000000..2671e2b51
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-get-resp.xml.tpl
@@ -0,0 +1,19 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" OS-DCF:diskConfig="AUTO">
+ <image id="%(uuid)s">
+ <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
+ </image>
+ <flavor id="1">
+ <atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
+ </flavor>
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <addresses>
+ <network id="private">
+ <ip version="4" addr="%(ip)s"/>
+ </network>
+ </addresses>
+ <atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
+</server>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-post-req.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-post-req.json.tpl
new file mode 100644
index 000000000..81b89adf2
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-post-req.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server" : {
+ "OS-DCF:diskConfig": "AUTO",
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-post-req.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-post-req.xml.tpl
new file mode 100644
index 000000000..f92614984
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-post-req.xml.tpl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="%(host)s/openstack/images/%(image_id)s" flavorRef="%(host)s/openstack/flavors/1" name="new-server-test">
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <personality>
+ <file path="/etc/banner.txt">
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+ </file>
+ </personality>
+</server>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-post-resp.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-post-resp.json.tpl
new file mode 100644
index 000000000..7c8371f16
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-post-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-post-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-post-resp.xml.tpl
new file mode 100644
index 000000000..1309e6dfe
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-post-resp.xml.tpl
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" adminPass="%(password)s" OS-DCF:diskConfig="AUTO">
+ <metadata/>
+ <atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
+</server>
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.json.tpl
new file mode 100644
index 000000000..a290485e1
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.json.tpl
@@ -0,0 +1,6 @@
+{
+ "resize": {
+ "flavorRef": "3",
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.xml.tpl
new file mode 100644
index 000000000..aa0b0b67a
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-resize-post-req.xml.tpl
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resize xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns="http://docs.openstack.org/compute/api/v1.1"
+ OS-DCF:diskConfig="AUTO"
+ flavorRef="3" />
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.json.tpl
new file mode 100644
index 000000000..4ac22820d
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.json.tpl
@@ -0,0 +1,5 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.xml.tpl
new file mode 100644
index 000000000..808884698
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-req.xml.tpl
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns="http://docs.openstack.org/compute/api/v1.1"
+ OS-DCF:diskConfig="AUTO" />
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.json.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.json.tpl
new file mode 100644
index 000000000..25e51a878
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.json.tpl
@@ -0,0 +1,55 @@
+{
+ "server": {
+ "OS-DCF:diskConfig": "AUTO",
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "addresses": {
+ "private": [
+ {
+ "addr": "%(ip)s",
+ "version": 4
+ }
+ ]
+ },
+ "created": "%(timestamp)s",
+ "flavor": {
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "hostId": "%(hostid)s",
+ "id": "%(id)s",
+ "image": {
+ "id": "%(uuid)s",
+ "links": [
+ {
+ "href": "%(host)s/openstack/images/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/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"
+ }
+}
diff --git a/nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.xml.tpl
new file mode 100644
index 000000000..3d565b0b3
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-DCF/server-update-put-resp.xml.tpl
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s"
+ hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake"
+ tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s"
+ OS-DCF:diskConfig="AUTO">
+ <image id="%(uuid)s">
+ <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
+ </image>
+ <flavor id="1">
+ <atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
+ </flavor>
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <addresses>
+ <network id="private">
+ <ip version="4" addr="%(ip)s"/>
+ </network>
+ </addresses>
+ <atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
+</server>
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index 6648fa896..9d1551dae 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -1896,3 +1896,78 @@ class FlavorManageSampleJsonTests(ApiSampleTestBase):
class FlavorManageSampleXmlTests(FlavorManageSampleJsonTests):
ctype = "xml"
+
+
+class DiskConfigJsonTest(ServersSampleBase):
+ extension_name = ("nova.api.openstack.compute.contrib.disk_config."
+ "Disk_config")
+
+ def test_list_servers_detail(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/detail')
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ subs['id'] = uuid
+ return self._verify_response('list-servers-detail-get',
+ subs, response)
+
+ def test_get_server(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s' % uuid)
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ return self._verify_response('server-get-resp', subs, response)
+
+ def test_update_server(self):
+ uuid = self._post_server()
+ response = self._do_put('servers/%s' % uuid,
+ 'server-update-put-req', {})
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ return self._verify_response('server-update-put-resp',
+ subs, response)
+
+ def test_resize_server(self):
+ self.flags(allow_resize_to_same_host=True)
+ uuid = self._post_server()
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-resize-post-req', {})
+ self.assertEqual(response.status, 202)
+ # NOTE(tmello): Resize does not return response body
+ # Bug #1085213.
+ self.assertEqual(response.read(), "")
+
+ def test_rebuild_server(self):
+ uuid = self._post_server()
+ subs = {
+ 'image_id': fake.get_valid_image_id(),
+ 'host': self._get_host(),
+ }
+ response = self._do_post('servers/%s/action' % uuid,
+ 'server-action-rebuild-req', subs)
+ self.assertEqual(response.status, 202)
+ subs = self._get_regexes()
+ subs['hostid'] = '[a-f0-9]+'
+ return self._verify_response('server-action-rebuild-resp',
+ subs, response)
+
+ def test_get_image(self):
+ image_id = fake.get_valid_image_id()
+ response = self._do_get('images/%s' % image_id)
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ subs['image_id'] = image_id
+ return self._verify_response('image-get-resp', subs, response)
+
+ def test_list_images(self):
+ response = self._do_get('images/detail')
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ return self._verify_response('image-list-resp', subs, response)
+
+
+class DiskConfigXmlTest(DiskConfigJsonTest):
+ ctype = 'xml'