Merge "Fix element miss in client request body"

This commit is contained in:
Jenkins 2014-03-21 15:52:23 +00:00 committed by Gerrit Code Review
commit 1d86d86bc8
2 changed files with 21 additions and 1 deletions

View File

@ -121,6 +121,26 @@ class ServersTest(utils.TestCase):
cs.assert_called('POST', '/servers')
self.assertIsInstance(s, servers.Server)
def test_create_server_return_reservation_id(self):
s = cs.servers.create(
name="My server",
image=1,
flavor=1,
reservation_id=True
)
expected_body = {
'server': {
'name': 'My server',
'image_ref': '1',
'flavor_ref': '1',
'os-multiple-create:min_count': 1,
'os-multiple-create:max_count': 1,
'os-multiple-create:return_reservation_id': True,
}
}
cs.assert_called('POST', '/servers', expected_body)
self.assertIsInstance(s, servers.Server)
def test_update_server(self):
s = cs.servers.get(1234)

View File

@ -409,7 +409,7 @@ class ServerManager(base.BootingManagerWithFind):
body["server"]["metadata"] = meta
if reservation_id:
body["server"][
"os-multiple-create:reservation_id"] = reservation_id
"os-multiple-create:return_reservation_id"] = reservation_id
if key_name:
body["server"]["key_name"] = key_name
if scheduler_hints: