Stop using "nova" in API samples when creating a server
The "availability_zone" parameter for server create in the API reference and the availabilty zone user docs both say that users should not use the default availability zone (nova) yet our server create API samples use "nova" which is...bad. This change fixes the API samples and related tests to use a fake "us-west" availability zone. For any samples that were requesting an AZ when creating a server, those are changed from requesting "nova" to requesting "us-west" and a new AvailabilityZoneFixture is added to stub out the code used to validate the requested AZ and what is shown in server detail responses. Some unused samples are removed from the os-availability-zone directory and the API reference and AZ user docs are updated for formatting and linking to other docs for reference. Change-Id: I3161157f15f05a3ffaaf1b48e7beb6b3e59c5513 Closes-Bug: #1817963
This commit is contained in:
parent
68d4cb44ed
commit
1241e3ec2a
@ -1,5 +1,7 @@
|
||||
.. -*- rst -*-
|
||||
|
||||
.. _os-availability-zone:
|
||||
|
||||
===========================================
|
||||
Availability zones (os-availability-zone)
|
||||
===========================================
|
||||
|
@ -4842,18 +4842,21 @@ os-availability-zone:availability_zone:
|
||||
want your instance to be built. Typically, an admin user will use
|
||||
availability zones to arrange OpenStack compute hosts into logical
|
||||
groups.
|
||||
|
||||
An availability zone provides a form of physical isolation and redundancy from
|
||||
other availability zones. For instance, if some racks in your data center are
|
||||
on a separate power source, you can put servers in those racks in their own availability
|
||||
zone. Availability zones can also help separate different classes of hardware. By
|
||||
segregating resources into availability zones, you can ensure that your application
|
||||
resources are spread across disparate machines to achieve high availability in
|
||||
the event of hardware or other failure.
|
||||
the event of hardware or other failure. See
|
||||
`Availability Zones (AZs) <https://docs.openstack.org/nova/latest/user/aggregates.html#availability-zones-azs>`_ for more information.
|
||||
|
||||
You can list the available availability zones by calling the
|
||||
os-availability-zone API, but you should avoid using the default
|
||||
availability zone when booting the instance. In general, the
|
||||
default availability zone is named ``nova``. This AZ is only shown
|
||||
when listing the availability zones as an admin.
|
||||
:ref:`os-availability-zone` API, but you should avoid using the `default
|
||||
availability zone <https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.default_availability_zone>`_
|
||||
when creating the server. The default availability zone is named ``nova``.
|
||||
This AZ is only shown when listing the availability zones as an admin.
|
||||
in: body
|
||||
required: false
|
||||
type: string
|
||||
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
},
|
||||
"availability_zone": "nova",
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"adminPass": "k4pKvTfcA4gY",
|
||||
"id": "3e45fa2a-5204-466f-a684-c2a8e1c82d7f",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/servers/3e45fa2a-5204-466f-a684-c2a8e1c82d7f",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/3e45fa2a-5204-466f-a684-c2a8e1c82d7f",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"security_groups": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@
|
||||
"user_id": "fake",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -55,7 +55,7 @@
|
||||
"user_id": "fake",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -58,7 +58,7 @@
|
||||
"description": null,
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -59,7 +59,7 @@
|
||||
"description": null,
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "c3f14e9812ad496baf92ccfb3c61e15f",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "http://openstack.example.com/flavors/1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -50,7 +50,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "c3f14e9812ad496baf92ccfb3c61e15f",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -48,7 +48,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "c5f474bf81474f9dbbc404d5b2e4e9b3",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -49,7 +49,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "bc8efe4fdb7148a4bb921a2b03d17de6",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -50,7 +50,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "c3f14e9812ad496baf92ccfb3c61e15f",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "6",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"servers": [
|
||||
{
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "http://openstack.example.com/flavors/1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"servers": [
|
||||
{
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "http://openstack.example.com/flavors/1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "6",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"server": {
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"servers": [
|
||||
{
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "6",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -2,7 +2,7 @@
|
||||
"servers": [
|
||||
{
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "compute",
|
||||
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
|
@ -50,7 +50,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "c3f14e9812ad496baf92ccfb3c61e15f",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
|
@ -50,7 +50,7 @@ between aggregates and availability zones:
|
||||
availability zone
|
||||
- by default a host is part of a default availability zone even if it doesn't
|
||||
belong to an aggregate (the configuration option is named
|
||||
``default_availability_zone``)
|
||||
:oslo.config:option:`default_availability_zone`)
|
||||
|
||||
.. warning:: That last rule can be very error-prone. Since the user can see the
|
||||
list of availability zones, they have no way to know whether the default
|
||||
|
@ -2117,3 +2117,44 @@ class DownCellFixture(fixtures.Fixture):
|
||||
'nova.context.scatter_gather_cells', stub_scatter_gather_cells))
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.context.target_cell', stub_target_cell))
|
||||
|
||||
|
||||
class AvailabilityZoneFixture(fixtures.Fixture):
|
||||
"""Fixture to stub out the nova.availability_zones module
|
||||
|
||||
The list of ``zones`` provided to the fixture are what get returned from
|
||||
``get_availability_zones``.
|
||||
|
||||
``get_instance_availability_zone`` will return the availability_zone
|
||||
requested when creating a server otherwise the instance.availabilty_zone
|
||||
or default_availability_zone is returned.
|
||||
"""
|
||||
def __init__(self, zones):
|
||||
self.zones = zones
|
||||
|
||||
def setUp(self):
|
||||
super(AvailabilityZoneFixture, self).setUp()
|
||||
|
||||
def fake_get_availability_zones(
|
||||
ctxt, get_only_available=False, with_hosts=False):
|
||||
# A 2-item tuple is returned if get_only_available=False.
|
||||
if not get_only_available:
|
||||
return self.zones, []
|
||||
return self.zones
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.availability_zones.get_availability_zones',
|
||||
fake_get_availability_zones))
|
||||
|
||||
def fake_get_instance_availability_zone(ctxt, instance):
|
||||
# If the server was created with a specific AZ, return it.
|
||||
reqspec = objects.RequestSpec.get_by_instance_uuid(
|
||||
ctxt, instance.uuid)
|
||||
requested_az = reqspec.availability_zone
|
||||
if requested_az:
|
||||
return requested_az
|
||||
# Otherwise return the instance.availability_zone if set else
|
||||
# the default AZ.
|
||||
return instance.availability_zone or CONF.default_availability_zone
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.availability_zones.get_instance_availability_zone',
|
||||
fake_get_instance_availability_zone))
|
||||
|
@ -63,6 +63,9 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
|
||||
_additional_fixtures = []
|
||||
sample_dir = None
|
||||
_use_project_id = True
|
||||
# Availability zones for the API samples tests. Can be overridden by
|
||||
# sub-classes. If set, the AvailabilityZoneFilter is not used.
|
||||
availability_zones = ['us-west']
|
||||
|
||||
scenarios = [
|
||||
# test v2 with the v2.1 compatibility stack
|
||||
@ -128,5 +131,23 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
|
||||
self.stub_out('nova.privsep.linux_net.set_device_enabled', fake_noop)
|
||||
self.stub_out('nova.privsep.linux_net.set_device_macaddr', fake_noop)
|
||||
|
||||
if self.availability_zones:
|
||||
self.useFixture(
|
||||
fixtures.AvailabilityZoneFixture(self.availability_zones))
|
||||
|
||||
def _setup_services(self):
|
||||
pass
|
||||
|
||||
def _setup_scheduler_service(self):
|
||||
"""Overrides _IntegratedTestBase._setup_scheduler_service to filter
|
||||
out the AvailabilityZoneFilter prior to starting the scheduler.
|
||||
"""
|
||||
if self.availability_zones:
|
||||
# The test is using fake zones so disable the
|
||||
# AvailabilityZoneFilter which is otherwise enabled by default.
|
||||
enabled_filters = CONF.filter_scheduler.enabled_filters
|
||||
if 'AvailabilityZoneFilter' in enabled_filters:
|
||||
enabled_filters.remove('AvailabilityZoneFilter')
|
||||
self.flags(enabled_filters=enabled_filters,
|
||||
group='filter_scheduler')
|
||||
return super(ApiSampleTestBaseV21, self)._setup_scheduler_service()
|
||||
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
},
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"server": {
|
||||
"adminPass": "%(password)s",
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"security_groups": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@
|
||||
"key_name": null,
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -55,7 +55,7 @@
|
||||
"key_name": null,
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -58,7 +58,7 @@
|
||||
"description": null,
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -59,7 +59,7 @@
|
||||
"description": null,
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "%(name)s",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "%(name)s",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "http://openstack.example.com/flavors/1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -50,7 +50,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"server": {
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -50,7 +50,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "%(name)s",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "6",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -57,7 +57,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -58,7 +58,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "http://openstack.example.com/flavors/1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -54,7 +54,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -55,7 +55,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "http://openstack.example.com/flavors/1",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "%(name)s",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "6",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "us-west",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -57,7 +57,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -58,7 +58,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"name" : "%(name)s",
|
||||
"imageRef" : "%(image_id)s",
|
||||
"flavorRef" : "6",
|
||||
"availability_zone": "nova",
|
||||
"availability_zone": "%(availability_zone)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
|
@ -58,7 +58,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "%(cdrive)s",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
|
@ -50,7 +50,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -51,7 +51,7 @@
|
||||
"name": "new-server-test",
|
||||
"config_drive": "",
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-AZ:availability_zone": "us-west",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
|
||||
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
|
||||
|
@ -19,6 +19,11 @@ class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
|
||||
ADMIN_API = True
|
||||
sample_dir = "os-availability-zone"
|
||||
|
||||
# Do not use the AvailabilityZoneFixture in the base class.
|
||||
# TODO(mriedem): Make this more realistic by creating a "us-west" zone
|
||||
# and putting the "compute" service host in it.
|
||||
availability_zones = []
|
||||
|
||||
def test_availability_zone_list(self):
|
||||
response = self._do_get('os-availability-zone')
|
||||
self._verify_response('availability-zone-list-resp', {}, response, 200)
|
||||
|
@ -74,6 +74,11 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
|
||||
'-[0-9a-f]{4}-[0-9a-f]{12}',
|
||||
'name': 'new-server-test' if name is None else name,
|
||||
}
|
||||
# If the template is requesting an explicit availability zone and
|
||||
# the test is setup to have AZs, use the first one in the list which
|
||||
# should default to "us-west".
|
||||
if self.availability_zones:
|
||||
subs['availability_zone'] = self.availability_zones[0]
|
||||
if extra_subs:
|
||||
subs.update(extra_subs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user