fix flavor and nic handling for servers

Include the flavor by name for now.

Fix the format of the nics value to be a list of mappings of net-name
to the actual names.

Change-Id: I446fa56ad54885fc1b95322c93a3572174ff134c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-05-05 20:13:04 +00:00
parent f96762fd77
commit 86eae49158

View File

@ -241,18 +241,33 @@ class Resolver:
image = self.cloud.get_image(server.image.id)
yield from self.image(image)
flavor = self.cloud.get_flavor(server.flavor.id)
server_data = {
'name': server.name,
'state': 'present',
# Attach to the networks by name.
'nics': list(server.networks.keys()),
'image': image.name,
# FIXME(dhellmann): Need to be more flexible about
# specifying the flavor. Input parameter? Use RAM? Use
# flavor_include?
'flavor': flavor.name,
# 'flavor_ram': flavor.ram,
}
key_name = key_name or server.key_name
if key_name:
server_data['key_name'] = key_name
if vol_names:
server_data['volumes'] = vol_names
# Attach to the networks by name.
nics = []
for n in server.networks.keys():
nics.append({'net-name': n})
if nics:
server_data['nics'] = nics
yield {
'name': 'Creating server {}'.format(server.name),
'os_server': server_data,