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:
parent
f96762fd77
commit
86eae49158
@ -241,18 +241,33 @@ class Resolver:
|
|||||||
image = self.cloud.get_image(server.image.id)
|
image = self.cloud.get_image(server.image.id)
|
||||||
yield from self.image(image)
|
yield from self.image(image)
|
||||||
|
|
||||||
|
flavor = self.cloud.get_flavor(server.flavor.id)
|
||||||
|
|
||||||
server_data = {
|
server_data = {
|
||||||
'name': server.name,
|
'name': server.name,
|
||||||
'state': 'present',
|
'state': 'present',
|
||||||
# Attach to the networks by name.
|
|
||||||
'nics': list(server.networks.keys()),
|
|
||||||
'image': image.name,
|
'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
|
key_name = key_name or server.key_name
|
||||||
if key_name:
|
if key_name:
|
||||||
server_data['key_name'] = key_name
|
server_data['key_name'] = key_name
|
||||||
|
|
||||||
if vol_names:
|
if vol_names:
|
||||||
server_data['volumes'] = 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 {
|
yield {
|
||||||
'name': 'Creating server {}'.format(server.name),
|
'name': 'Creating server {}'.format(server.name),
|
||||||
'os_server': server_data,
|
'os_server': server_data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user