diff --git a/doc/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json b/doc/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json
new file mode 100644
index 000000000000..9cdcf5840576
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json
@@ -0,0 +1,69 @@
+{
+ "availability_zone_info": [
+ {
+ "hosts": {
+ "cells": {
+ "nova-cells": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "cert": {
+ "nova-cert": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "conductor": {
+ "nova-conductor": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "consoleauth": {
+ "nova-consoleauth": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "network": {
+ "nova-network": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "scheduler": {
+ "nova-scheduler": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ }
+ },
+ "zone_name": "internal",
+ "zone_state": {
+ "available": true
+ }
+ },
+ {
+ "hosts": {
+ "compute": {
+ "nova-compute": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ }
+ },
+ "zone_name": "nova",
+ "zone_state": {
+ "available": true
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-availability-zone/availability-zone-detail-resp.xml b/doc/v3/api_samples/os-availability-zone/availability-zone-detail-resp.xml
new file mode 100644
index 000000000000..57fcc5309813
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/availability-zone-detail-resp.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-availability-zone/availability-zone-list-resp.json b/doc/v3/api_samples/os-availability-zone/availability-zone-list-resp.json
new file mode 100644
index 000000000000..5f82a67da59c
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/availability-zone-list-resp.json
@@ -0,0 +1,11 @@
+{
+ "availability_zone_info": [
+ {
+ "hosts": null,
+ "zone_name": "nova",
+ "zone_state": {
+ "available": true
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-availability-zone/availability-zone-list-resp.xml b/doc/v3/api_samples/os-availability-zone/availability-zone-list-resp.xml
new file mode 100644
index 000000000000..27c2a461f257
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/availability-zone-list-resp.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-availability-zone/server-post-req.json b/doc/v3/api_samples/os-availability-zone/server-post-req.json
new file mode 100644
index 000000000000..037728476493
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/server-post-req.json
@@ -0,0 +1,17 @@
+{
+ "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",
+ "os-availability-zone:availability_zone" : "test"
+ "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-availability-zone/server-post-req.xml b/doc/v3/api_samples/os-availability-zone/server-post-req.xml
new file mode 100644
index 000000000000..55b703d5d535
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/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-availability-zone/server-post-resp.json b/doc/v3/api_samples/os-availability-zone/server-post-resp.json
new file mode 100644
index 000000000000..df24e0d2b922
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/server-post-resp.json
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "admin_password": "a2apKsfp7Rom",
+ "id": "e88c3898-e971-42e5-8325-b7ff921efb15",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/e88c3898-e971-42e5-8325-b7ff921efb15",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/e88c3898-e971-42e5-8325-b7ff921efb15",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/os-availability-zone/server-post-resp.xml b/doc/v3/api_samples/os-availability-zone/server-post-resp.xml
new file mode 100644
index 000000000000..6a3681090268
--- /dev/null
+++ b/doc/v3/api_samples/os-availability-zone/server-post-resp.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/integrated_helpers.py b/nova/tests/integrated/integrated_helpers.py
index 82d0bde3740c..eaf60495134b 100644
--- a/nova/tests/integrated/integrated_helpers.py
+++ b/nova/tests/integrated/integrated_helpers.py
@@ -78,10 +78,16 @@ class _IntegratedTestBase(test.TestCase):
nova.tests.image.fake.stub_out_image_service(self.stubs)
self.flags(scheduler_driver='nova.scheduler.'
'chance.ChanceScheduler')
+ self._setup_services()
+ self._start_api_service()
- # set up services
+ self.api = self._get_test_client()
+
+ self.useFixture(cast_as_call.CastAsCall(self.stubs))
+
+ def _setup_services(self):
self.conductor = self.start_service('conductor',
- manager=CONF.conductor.manager)
+ manager=CONF.conductor.manager)
self.compute = self.start_service('compute')
self.cert = self.start_service('cert')
self.consoleauth = self.start_service('consoleauth')
@@ -89,12 +95,6 @@ class _IntegratedTestBase(test.TestCase):
self.scheduler = self.start_service('scheduler')
self.cells = self.start_service('cells', manager=CONF.cells.manager)
- self._start_api_service()
-
- self.api = self._get_test_client()
-
- self.useFixture(cast_as_call.CastAsCall(self.stubs))
-
def tearDown(self):
self.osapi.stop()
nova.tests.image.fake.FakeImageService_reset()
diff --git a/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl
new file mode 100644
index 000000000000..4b085fa7fea4
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.json.tpl
@@ -0,0 +1,69 @@
+{
+ "availability_zone_info": [
+ {
+ "hosts": {
+ "consoleauth": {
+ "nova-consoleauth": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "cert": {
+ "nova-cert": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "conductor": {
+ "nova-conductor": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "cells": {
+ "nova-cells": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "scheduler": {
+ "nova-scheduler": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ },
+ "network": {
+ "nova-network": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ }
+ },
+ "zone_name": "internal",
+ "zone_state": {
+ "available": true
+ }
+ },
+ {
+ "hosts": {
+ "compute": {
+ "nova-compute": {
+ "active": true,
+ "available": true,
+ "updated_at": null
+ }
+ }
+ },
+ "zone_name": "nova",
+ "zone_state": {
+ "available": true
+ }
+ }
+ ]
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.xml.tpl
new file mode 100644
index 000000000000..a4f084b1891b
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-detail-resp.xml.tpl
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl
new file mode 100644
index 000000000000..b826cf498594
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.json.tpl
@@ -0,0 +1,11 @@
+{
+ "availability_zone_info": [
+ {
+ "hosts": null,
+ "zone_name": "nova",
+ "zone_state": {
+ "available": true
+ }
+ }
+ ]
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.xml.tpl
new file mode 100644
index 000000000000..b47ce26d7723
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/availability-zone-list-resp.xml.tpl
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl
new file mode 100644
index 000000000000..39b6986b9f71
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-req.json.tpl
@@ -0,0 +1,17 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "image_ref" : "%(host)s/openstack/images/%(image_id)s",
+ "flavor_ref" : "%(host)s/openstack/flavors/1",
+ "os-availability-zone:availability_zone": "nova",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-req.xml.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-req.xml.tpl
new file mode 100644
index 000000000000..a2382b01751c
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/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-availability-zone/server-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-resp.json.tpl
new file mode 100644
index 000000000000..7af0df5ec057
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "admin_password": "%(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-availability-zone/server-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-resp.xml.tpl
new file mode 100644
index 000000000000..59e7ae5a99ff
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/os-availability-zone/server-post-resp.xml.tpl
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/test_availability_zone.py b/nova/tests/integrated/v3/test_availability_zone.py
new file mode 100644
index 000000000000..23a4ff06bbd5
--- /dev/null
+++ b/nova/tests/integrated/v3/test_availability_zone.py
@@ -0,0 +1,53 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+# 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 oslo.config import cfg
+
+from nova.tests.integrated.v3 import test_servers
+
+CONF = cfg.CONF
+CONF.import_opt('manager', 'nova.cells.opts', group='cells')
+
+
+class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
+ extension_name = "os-availability-zone"
+
+ def _setup_services(self):
+ self.conductor = self.start_service('conductor',
+ host='conductor', manager=CONF.conductor.manager)
+ self.compute = self.start_service('compute', host='compute')
+ self.cert = self.start_service('cert', host='cert')
+ self.consoleauth = self.start_service('consoleauth',
+ host='consoleauth')
+ self.network = self.start_service('network', host='network')
+ self.scheduler = self.start_service('scheduler', host='scheduler')
+ self.cells = self.start_service('cells', host='cells',
+ manager=CONF.cells.manager)
+
+ def test_availability_zone_list(self):
+ response = self._do_get('os-availability-zone')
+ self._verify_response('availability-zone-list-resp', {}, response, 200)
+
+ def test_availability_zone_detail(self):
+ response = self._do_get('os-availability-zone/detail')
+ self._verify_response('availability-zone-detail-resp', {}, response,
+ 200)
+
+ def test_availability_zone_post(self):
+ self._post_server()
+
+
+class AvailabilityZoneXmlTest(AvailabilityZoneJsonTest):
+ ctype = "xml"