Add v3 api samples for scheduler-hints
Adds api sample tests and api samples for scheduler-hints Partially implements blueprint v3-api-unittests Partially implements blueprint v3-api-specification Change-Id: If7bc47dc92c1e7f33f80ea567688d067c42fa219
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"image_ref" : "http://glance.openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavor_ref" : "http://openstack.example.com/openstack/flavors/1",
|
||||
"os-scheduler-hints:scheduler_hints": {
|
||||
"hypervisor": "xen",
|
||||
"near": "48e6a9f6-30af-47e0-bc04-acaed113bb4e"
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns:os-scheduler-hints="http://docs.openstack.org/compute/ext/scheduler-hints/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="http://glance.openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" flavor_ref="http://openstack.example.com/flavors/1" name="new-server-test">
|
||||
<os-scheduler-hints:scheduler_hints>
|
||||
<hypervisor>xen</hypervisor>
|
||||
<near>a424ff53-f7ef-405c-871f-3f8c08c6e0e9</near>
|
||||
</os-scheduler-hints:scheduler_hints>
|
||||
</server>
|
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"admin_password": "erQXgJ8NBDD4",
|
||||
"id": "4c8b1df3-46f7-4555-98d8-cdb869aaf9ad",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/4c8b1df3-46f7-4555-98d8-cdb869aaf9ad",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/4c8b1df3-46f7-4555-98d8-cdb869aaf9ad",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="2bb7ebcf-e142-4c81-9504-6bf917405f92" admin_password="kW5jziJ3BKd8">
|
||||
<metadata/>
|
||||
<atom:link href="http://openstack.example.com/v3/servers/2bb7ebcf-e142-4c81-9504-6bf917405f92" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/2bb7ebcf-e142-4c81-9504-6bf917405f92" rel="bookmark"/>
|
||||
</server>
|
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"image_ref" : "%(glance_host)s/openstack/images/%(image_id)s",
|
||||
"flavor_ref" : "%(host)s/openstack/flavors/1",
|
||||
"os-scheduler-hints:scheduler_hints": {
|
||||
"hypervisor": "xen",
|
||||
"near": "%(image_near)s"
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns:os-scheduler-hints="http://docs.openstack.org/compute/ext/scheduler-hints/api/v3" xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="%(glance_host)s/openstack/images/%(image_id)s" flavor_ref="%(host)s/flavors/1" name="new-server-test">
|
||||
<os-scheduler-hints:scheduler_hints>
|
||||
<hypervisor>xen</hypervisor>
|
||||
<near>%(image_near)s</near>
|
||||
</os-scheduler-hints:scheduler_hints>
|
||||
</server>
|
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" admin_password="%(password)s">
|
||||
<metadata/>
|
||||
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
|
||||
</server>
|
37
nova/tests/integrated/v3/test_scheduler_hints.py
Normal file
37
nova/tests/integrated/v3/test_scheduler_hints.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# Copyright 2012 Nebula, Inc.
|
||||
# Copyright 2013 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from nova.tests.image import fake
|
||||
from nova.tests.integrated.v3 import api_sample_base
|
||||
|
||||
|
||||
class SchedulerHintsJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
extension_name = "os-scheduler-hints"
|
||||
|
||||
def test_scheduler_hints_post(self):
|
||||
# Get api sample of scheduler hint post request.
|
||||
subs = self._get_regexes()
|
||||
subs.update({'image_id': fake.get_valid_image_id(),
|
||||
'image_near': str(uuid.uuid4())})
|
||||
response = self._do_post('servers', 'scheduler-hints-post-req',
|
||||
subs)
|
||||
self._verify_response('scheduler-hints-post-resp', subs, response, 202)
|
||||
|
||||
|
||||
class SchedulerHintsXmlTest(SchedulerHintsJsonTest):
|
||||
ctype = 'xml'
|
Reference in New Issue
Block a user