Fix element miss in client request body

Currently the client sends a request with wrong element name
'os-multiple-create:reservation_id' in the body.
The correct element should be 'os-multiple-create:return_reservation_id'.
The information can be got in this website.
https://wiki.openstack.org/wiki/NovaAPIv2tov3

Change-Id: I7d2f006ef6dbbcd6b41c8adbeee0c0e048d35448
Closes-Bug: #1281342
This commit is contained in:
Haiwei Xu 2014-02-18 04:09:44 +09:00
parent 7cf73f1942
commit aec2b6172a
2 changed files with 21 additions and 1 deletions
novaclient

@ -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)

@ -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: