Simplify and optimize az server output extension.

Displaying two different az results to users is confusing, so just
return the az that the instance is actually in. Also, cache the
result from looking up the az by host for an hour to avoid making
lots of expensive db requests.

DocImpact

Change-Id: Ib39bf94c608874695aab00e61035e64f9594a985
This commit is contained in:
Vishvananda Ishaya
2013-02-07 14:46:08 -08:00
parent 64fcd4de11
commit 80bd1de65a
18 changed files with 54 additions and 59 deletions

View File

@@ -1,7 +1,6 @@
{ {
"server": { "server": {
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"accessIPv4": "", "accessIPv4": "",
"accessIPv6": "", "accessIPv6": "",
"addresses": { "addresses": {

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<server xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-01-30T14:29:20Z" hostId="471e52951e3182954c5a93489dafc3fc38a9ef3e0b62d26dc740460c" name="new-server-test" created="2013-01-30T14:29:19Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="26ea8424-758d-483a-addc-9a5905afc9e6" OS-EXT-AZ:host_availability_zone="nova" OS-EXT-AZ:availability_zone="None"> <server xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-01-30T14:29:20Z" hostId="471e52951e3182954c5a93489dafc3fc38a9ef3e0b62d26dc740460c" name="new-server-test" created="2013-01-30T14:29:19Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="26ea8424-758d-483a-addc-9a5905afc9e6" OS-EXT-AZ:availability_zone="nova">
<image id="70a599e0-31e7-49b7-b260-868f441e862b"> <image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/> <atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image> </image>

View File

@@ -1,8 +1,7 @@
{ {
"servers": [ "servers": [
{ {
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"accessIPv4": "", "accessIPv4": "",
"accessIPv6": "", "accessIPv6": "",
"addresses": { "addresses": {

View File

@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"> <servers xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="2013-01-30T14:29:20Z" hostId="85adf7d0492dedf0a7e3dc44ef7d16186b768ca3df33c4d608e630d9" name="new-server-test" created="2013-01-30T14:29:19Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="a668c72d-2bac-4806-a297-c7c11d97e3b3" OS-EXT-AZ:host_availability_zone="nova" OS-EXT-AZ:availability_zone="None"> <server status="ACTIVE" updated="2013-01-30T14:29:20Z" hostId="85adf7d0492dedf0a7e3dc44ef7d16186b768ca3df33c4d608e630d9" name="new-server-test" created="2013-01-30T14:29:19Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="a668c72d-2bac-4806-a297-c7c11d97e3b3" OS-EXT-AZ:availability_zone="nova">
<image id="70a599e0-31e7-49b7-b260-868f441e862b"> <image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/> <atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image> </image>

View File

@@ -1,8 +1,7 @@
{ {
"server": { "server": {
"OS-DCF:diskConfig": "AUTO", "OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"OS-EXT-SRV-ATTR:host": "b00875071c774b5487d217b82f03dfa2", "OS-EXT-SRV-ATTR:host": "b00875071c774b5487d217b82f03dfa2",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini", "OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001", "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?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:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-02-07T19:01:59Z" hostId="06d1cfd52be5f5d197193db2842978235fd085bd2dfaea32e5068468" name="new-server-test" created="2013-02-07T19:01:58Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="6be39927-53b2-4aee-8593-1c72b3673168" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="b98603db318e495e819601702d16c512" OS-EXT-SRV-ATTR:hypervisor_hostname="fake-mini" OS-EXT-AZ:host_availability_zone="nova" OS-EXT-AZ:availability_zone="None" OS-DCF:diskConfig="AUTO"> <server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-02-07T19:01:59Z" hostId="06d1cfd52be5f5d197193db2842978235fd085bd2dfaea32e5068468" name="new-server-test" created="2013-02-07T19:01:58Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="6be39927-53b2-4aee-8593-1c72b3673168" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="b98603db318e495e819601702d16c512" OS-EXT-SRV-ATTR:hypervisor_hostname="fake-mini" OS-EXT-AZ:availability_zone="nova" OS-DCF:diskConfig="AUTO">
<image id="70a599e0-31e7-49b7-b260-868f441e862b"> <image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/> <atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image> </image>

View File

@@ -2,8 +2,7 @@
"servers": [ "servers": [
{ {
"OS-DCF:diskConfig": "AUTO", "OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"OS-EXT-SRV-ATTR:host": "33924d68ef4e4214bb9bc200178d23b8", "OS-EXT-SRV-ATTR:host": "33924d68ef4e4214bb9bc200178d23b8",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini", "OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001", "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",

View File

@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?> <?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:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1"> <servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="2013-02-07T19:01:59Z" hostId="641edaad8dd6a670afec58a4ce7e908d50379a6060f845236cd063db" name="new-server-test" created="2013-02-07T19:01:58Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="b45edf9d-30f6-41e8-a00b-ef8962376586" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="f7954cfa4a5544278876b1d9224efe48" OS-EXT-SRV-ATTR:hypervisor_hostname="fake-mini" OS-EXT-AZ:host_availability_zone="nova" OS-EXT-AZ:availability_zone="None" OS-DCF:diskConfig="AUTO"> <server status="ACTIVE" updated="2013-02-07T19:01:59Z" hostId="641edaad8dd6a670afec58a4ce7e908d50379a6060f845236cd063db" name="new-server-test" created="2013-02-07T19:01:58Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="b45edf9d-30f6-41e8-a00b-ef8962376586" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="f7954cfa4a5544278876b1d9224efe48" OS-EXT-SRV-ATTR:hypervisor_hostname="fake-mini" OS-EXT-AZ:availability_zone="nova" OS-DCF:diskConfig="AUTO">
<image id="70a599e0-31e7-49b7-b260-868f441e862b"> <image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/> <atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image> </image>

View File

@@ -21,26 +21,35 @@ from nova.api.openstack import extensions
from nova.api.openstack import wsgi from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil from nova.api.openstack import xmlutil
from nova import availability_zones from nova import availability_zones
from nova.common import memorycache
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
# NOTE(vish): azs don't change that often, so cache them for an hour to
# avoid hitting the db multiple times on every request.
AZ_CACHE_SECONDS = 60 * 60
authorize = extensions.soft_extension_authorizer('compute', authorize = extensions.soft_extension_authorizer('compute',
'extended_availability_zone') 'extended_availability_zone')
class ExtendedAZController(wsgi.Controller): class ExtendedAZController(wsgi.Controller):
def __init__(self):
self.mc = memorycache.get_client()
def _get_host_az(self, context, instance): def _get_host_az(self, context, instance):
admin_context = context.elevated() host = instance.get('host')
if instance['host']: if not host:
return availability_zones.get_host_availability_zone( return None
admin_context, instance['host']) cache_key = "azcache-%s" % host
az = self.mc.get(cache_key)
if not az:
elevated = context.elevated()
az = availability_zones.get_host_availability_zone(elevated, host)
self.mc.set(cache_key, az, AZ_CACHE_SECONDS)
return az
def _extend_server(self, context, server, instance): def _extend_server(self, context, server, instance):
key = "%s:availability_zone" % Extended_availability_zone.alias key = "%s:availability_zone" % Extended_availability_zone.alias
server[key] = instance.get('availability_zone', None)
key = "%s:host_availability_zone" % Extended_availability_zone.alias
server[key] = self._get_host_az(context, instance) server[key] = self._get_host_az(context, instance)
@wsgi.extends @wsgi.extends
@@ -81,10 +90,6 @@ class Extended_availability_zone(extensions.ExtensionDescriptor):
def make_server(elem): def make_server(elem):
elem.set('{%s}availability_zone' % Extended_availability_zone.namespace, elem.set('{%s}availability_zone' % Extended_availability_zone.namespace,
'%s:availability_zone' % Extended_availability_zone.alias) '%s:availability_zone' % Extended_availability_zone.alias)
elem.set('{%s}host_availability_zone' %
Extended_availability_zone.namespace,
'%s:host_availability_zone' %
Extended_availability_zone.alias)
class ExtendedAZTemplate(xmlutil.TemplateBuilder): class ExtendedAZTemplate(xmlutil.TemplateBuilder):

View File

@@ -17,6 +17,7 @@ from lxml import etree
import webob import webob
from nova.api.openstack.compute.contrib import extended_availability_zone from nova.api.openstack.compute.contrib import extended_availability_zone
from nova import availability_zones
from nova import compute from nova import compute
from nova import exception from nova import exception
from nova.openstack.common import jsonutils from nova.openstack.common import jsonutils
@@ -29,19 +30,20 @@ UUID3 = '00000000-0000-0000-0000-000000000003'
def fake_compute_get(*args, **kwargs): def fake_compute_get(*args, **kwargs):
inst = fakes.stub_instance(1, uuid=UUID3, host="host-fake") inst = fakes.stub_instance(1, uuid=UUID3, host="get-host")
inst['availability_zone'] = 'az-i'
return inst return inst
def fake_compute_get_all(*args, **kwargs): def fake_compute_get_all(*args, **kwargs):
inst1 = fakes.stub_instance(1, uuid=UUID1, host="host-1") inst1 = fakes.stub_instance(1, uuid=UUID1, host="all-host")
inst2 = fakes.stub_instance(2, uuid=UUID2, host="host-2") inst2 = fakes.stub_instance(2, uuid=UUID2, host="all-host")
inst1['availability_zone'] = 'az-i'
inst2['availability_zone'] = 'az-i'
return [inst1, inst2] return [inst1, inst2]
def fake_get_host_availability_zone(context, host):
return host
class ExtendedServerAttributesTest(test.TestCase): class ExtendedServerAttributesTest(test.TestCase):
content_type = 'application/json' content_type = 'application/json'
prefix = 'OS-EXT-AZ:' prefix = 'OS-EXT-AZ:'
@@ -51,6 +53,8 @@ class ExtendedServerAttributesTest(test.TestCase):
fakes.stub_out_nw_api(self.stubs) fakes.stub_out_nw_api(self.stubs)
self.stubs.Set(compute.api.API, 'get', fake_compute_get) self.stubs.Set(compute.api.API, 'get', fake_compute_get)
self.stubs.Set(compute.api.API, 'get_all', fake_compute_get_all) self.stubs.Set(compute.api.API, 'get_all', fake_compute_get_all)
self.stubs.Set(availability_zones, 'get_host_availability_zone',
fake_get_host_availability_zone)
self.flags( self.flags(
osapi_compute_extension=[ osapi_compute_extension=[
@@ -69,20 +73,16 @@ class ExtendedServerAttributesTest(test.TestCase):
def _get_servers(self, body): def _get_servers(self, body):
return jsonutils.loads(body).get('servers') return jsonutils.loads(body).get('servers')
def assertServerAttributes(self, server, az_instance, az_host): def assertServerAttributes(self, server, az):
self.assertEqual(server.get('%savailability_zone' % self.prefix), self.assertEqual(server.get('%savailability_zone' % self.prefix),
az_instance) az)
self.assertEqual(server.get('%shost_availability_zone' % self.prefix),
az_host)
def test_show(self): def test_show(self):
url = '/v2/fake/servers/%s' % UUID3 url = '/v2/fake/servers/%s' % UUID3
res = self._make_request(url) res = self._make_request(url)
self.assertEqual(res.status_int, 200) self.assertEqual(res.status_int, 200)
self.assertServerAttributes(self._get_server(res.body), self.assertServerAttributes(self._get_server(res.body), 'get-host')
az_instance='az-i',
az_host='nova')
def test_detail(self): def test_detail(self):
url = '/v2/fake/servers/detail' url = '/v2/fake/servers/detail'
@@ -90,9 +90,7 @@ class ExtendedServerAttributesTest(test.TestCase):
self.assertEqual(res.status_int, 200) self.assertEqual(res.status_int, 200)
for i, server in enumerate(self._get_servers(res.body)): for i, server in enumerate(self._get_servers(res.body)):
self.assertServerAttributes(server, self.assertServerAttributes(server, 'all-host')
az_instance='az-i',
az_host='nova')
def test_no_instance_passthrough_404(self): def test_no_instance_passthrough_404(self):

View File

@@ -2,8 +2,7 @@
"server": { "server": {
"updated": "%(timestamp)s", "updated": "%(timestamp)s",
"created": "%(timestamp)s", "created": "%(timestamp)s",
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"accessIPv4": "", "accessIPv4": "",
"accessIPv6": "", "accessIPv6": "",
"addresses": { "addresses": {

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<server xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" 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="%(uuid)s" OS-EXT-AZ:availability_zone="None" OS-EXT-AZ:host_availability_zone="nova"> <server xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" 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="%(uuid)s" OS-EXT-AZ:availability_zone="nova">
<image id="%(uuid)s"> <image id="%(uuid)s">
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/> <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
</image> </image>

View File

@@ -3,8 +3,7 @@
{ {
"updated": "%(timestamp)s", "updated": "%(timestamp)s",
"created": "%(timestamp)s", "created": "%(timestamp)s",
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"accessIPv4": "", "accessIPv4": "",
"accessIPv6": "", "accessIPv6": "",
"addresses": { "addresses": {

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" 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-EXT-AZ:availability_zone="None" OS-EXT-AZ:host_availability_zone="nova"> <servers xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" 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-EXT-AZ:availability_zone="nova">
<image id="%(uuid)s"> <image id="%(uuid)s">
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/> <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
</image> </image>

View File

@@ -1,8 +1,7 @@
{ {
"server": { "server": {
"OS-DCF:diskConfig": "AUTO", "OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"OS-EXT-SRV-ATTR:host": "%(compute_host)s", "OS-EXT-SRV-ATTR:host": "%(compute_host)s",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s", "OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001", "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/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" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s" OS-EXT-AZ:availability_zone="None" OS-EXT-AZ:host_availability_zone="nova" OS-DCF:diskConfig="AUTO"> <server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/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" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s" OS-EXT-AZ:availability_zone="nova" OS-DCF:diskConfig="AUTO">
<image id="%(uuid)s"> <image id="%(uuid)s">
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/> <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
</image> </image>

View File

@@ -2,8 +2,7 @@
"servers": [ "servers": [
{ {
"OS-DCF:diskConfig": "AUTO", "OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": null, "OS-EXT-AZ:availability_zone": "nova",
"OS-EXT-AZ:host_availability_zone": "nova",
"OS-EXT-SRV-ATTR:host": "%(compute_host)s", "OS-EXT-SRV-ATTR:host": "%(compute_host)s",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s", "OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001", "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",

View File

@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"> <servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/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" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s" OS-EXT-AZ:availability_zone="None" OS-EXT-AZ:host_availability_zone="nova" OS-DCF:diskConfig="AUTO"> <server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-AZ="http://docs.openstack.org/compute/ext/extended_availability_zone/api/v2" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-IPS="http://docs.openstack.org/compute/ext/extended_ips/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/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" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="%(hypervisor_hostname)s" OS-EXT-AZ:availability_zone="nova" OS-DCF:diskConfig="AUTO">
<image id="%(uuid)s"> <image id="%(uuid)s">
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/> <atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
</image> </image>