Browse Source

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>
Doug Hellmann 1 year ago
parent
commit
86eae49158
1 changed files with 17 additions and 2 deletions
  1. 17
    2
      downpour/resolver.py

+ 17
- 2
downpour/resolver.py View File

@@ -241,18 +241,33 @@ class Resolver:
241 241
             image = self.cloud.get_image(server.image.id)
242 242
         yield from self.image(image)
243 243
 
244
+        flavor = self.cloud.get_flavor(server.flavor.id)
245
+
244 246
         server_data = {
245 247
             'name': server.name,
246 248
             'state': 'present',
247
-            # Attach to the networks by name.
248
-            'nics': list(server.networks.keys()),
249 249
             'image': image.name,
250
+            # FIXME(dhellmann): Need to be more flexible about
251
+            # specifying the flavor. Input parameter? Use RAM? Use
252
+            # flavor_include?
253
+            'flavor': flavor.name,
254
+            # 'flavor_ram': flavor.ram,
250 255
         }
256
+
251 257
         key_name = key_name or server.key_name
252 258
         if key_name:
253 259
             server_data['key_name'] = key_name
260
+
254 261
         if vol_names:
255 262
             server_data['volumes'] = vol_names
263
+
264
+        # Attach to the networks by name.
265
+        nics = []
266
+        for n in server.networks.keys():
267
+            nics.append({'net-name': n})
268
+        if nics:
269
+            server_data['nics'] = nics
270
+
256 271
         yield {
257 272
             'name': 'Creating server {}'.format(server.name),
258 273
             'os_server': server_data,

Loading…
Cancel
Save