Revision c314fcd2

b/ci/new_config
32 32
# Server name to use for our machine
33 33
server_name = Synnefo Deployment
34 34
# Flavor name (reg expression) to use
35
# This is a list of flavor_names (comma seperated) to try
35 36
flavor_name = C8R8...D100drbd
36 37
# Image to use (name must contain this)
37 38
image_name = OldStable
b/ci/utils.py
284 284

  
285 285
    def _find_flavor(self, flavor_name):
286 286
        """Given a flavor_name (reg expression) find a flavor id to use"""
287
        if flavor_name is None:
288
            flavor_name = self.config.get('Deployment', 'flavor_name')
289
        self.logger.debug("Try to find a flavor with name \"%s\"" % flavor_name)
287
        # Get a list of flavor names from config file
288
        flavor_names = self.config.get('Deployment', 'flavor_name').split(",")
289
        if flavor_name is not None:
290
            # If we have a flavor_name to use, add it to our list
291
            flavor_names.insert(0, flavor_name)
290 292

  
291 293
        flavors = self.compute_client.list_flavors()
292
        flavors = [f for f in flavors
293
                   if re.search(flavor_name, f['name']) is not None]
294

  
295
        if flavors:
296
            self.logger.debug("Will use %s with id %s"
297
                              % (flavors[0]['name'], flavors[0]['id']))
298
            return flavors[0]['id']
299
        else:
300
            self.logger.error("No matching flavor found.. aborting")
301
            sys.exit(1)
294
        for flname in flavor_names:
295
            sflname = flname.strip()
296
            self.logger.debug("Try to find a flavor with name \"%s\"" % sflname)
297
            fls = [f for f in flavors
298
                   if re.search(sflname, f['name']) is not None]
299
            if fls:
300
                self.logger.debug("Will use %s with id %s"
301
                                  % (fls[0]['name'], fls[0]['id']))
302
                return fls[0]['id']
303

  
304
        self.logger.error("No matching flavor found.. aborting")
305
        sys.exit(1)
302 306

  
303 307
    def _find_image(self):
304 308
        """Find a suitable image to use

Also available in: Unified diff