Allow discover-tempest-config to run with no nova or glance endpoint
The TripleO undercloud will soon have no nova or glance due to blueprint nova-less-deploy, however it is still required to run tempest tests via a discover-tempest-config generated config. Currently this fails due to always attempting to list existing flavors and images. This change only runs flavor and image code if those endpoints are available. Change-Id: Icffce84638e0db099626d5a86a84f44472943a69 Story: 2006527 Task: 36573
This commit is contained in:
		@@ -526,19 +526,23 @@ def config_tempest(**kwargs):
 | 
				
			|||||||
    if kwargs.get('create', False) and kwargs.get('test_accounts') is None:
 | 
					    if kwargs.get('create', False) and kwargs.get('test_accounts') is None:
 | 
				
			||||||
        users = Users(clients.projects, clients.roles, clients.users, conf)
 | 
					        users = Users(clients.projects, clients.roles, clients.users, conf)
 | 
				
			||||||
        users.create_tempest_users()
 | 
					        users.create_tempest_users()
 | 
				
			||||||
    flavors = Flavors(clients.flavors, kwargs.get('create', False), conf,
 | 
					 | 
				
			||||||
                      kwargs.get('flavor_min_mem', C.DEFAULT_FLAVOR_RAM),
 | 
					 | 
				
			||||||
                      kwargs.get('flavor_min_disk', C.DEFAULT_FLAVOR_DISK),
 | 
					 | 
				
			||||||
                      no_rng=kwargs.get('no_rng', False))
 | 
					 | 
				
			||||||
    flavors.create_tempest_flavors()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    image = services.get_service('image')
 | 
					    if services.is_service(**{"type": "compute"}):
 | 
				
			||||||
    image.set_image_preferences(kwargs.get('image_disk_format',
 | 
					        flavors = Flavors(clients.flavors, kwargs.get('create', False), conf,
 | 
				
			||||||
                                           C.DEFAULT_IMAGE_FORMAT),
 | 
					                          kwargs.get('flavor_min_mem', C.DEFAULT_FLAVOR_RAM),
 | 
				
			||||||
                                kwargs.get('non_admin', False),
 | 
					                          kwargs.get('flavor_min_disk', C.DEFAULT_FLAVOR_DISK),
 | 
				
			||||||
                                no_rng=kwargs.get('no_rng', False),
 | 
					                          no_rng=kwargs.get('no_rng', False))
 | 
				
			||||||
                                convert=kwargs.get('convert_to_raw', False))
 | 
					        flavors.create_tempest_flavors()
 | 
				
			||||||
    image.create_tempest_images(conf)
 | 
					
 | 
				
			||||||
 | 
					    if services.is_service(**{"type": "image"}):
 | 
				
			||||||
 | 
					        image = services.get_service('image')
 | 
				
			||||||
 | 
					        image.set_image_preferences(kwargs.get('image_disk_format',
 | 
				
			||||||
 | 
					                                               C.DEFAULT_IMAGE_FORMAT),
 | 
				
			||||||
 | 
					                                    kwargs.get('non_admin', False),
 | 
				
			||||||
 | 
					                                    no_rng=kwargs.get('no_rng', False),
 | 
				
			||||||
 | 
					                                    convert=kwargs.get('convert_to_raw',
 | 
				
			||||||
 | 
					                                                       False))
 | 
				
			||||||
 | 
					        image.create_tempest_images(conf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    has_neutron = services.is_service(**{"type": "network"})
 | 
					    has_neutron = services.is_service(**{"type": "network"})
 | 
				
			||||||
    network = services.get_service("network")
 | 
					    network = services.get_service("network")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,11 +65,16 @@ class OrchestrationService(Service):
 | 
				
			|||||||
                        "heat_tempest_plugin cannot be set!")
 | 
					                        "heat_tempest_plugin cannot be set!")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def post_configuration(self, conf, is_service):
 | 
					    def post_configuration(self, conf, is_service):
 | 
				
			||||||
        conf.set('heat_plugin', 'minimal_instance_type',
 | 
					        compute_options = conf.options('compute')
 | 
				
			||||||
                 conf.get('compute', 'flavor_ref'))
 | 
					        if 'flavor_ref' in compute_options:
 | 
				
			||||||
        conf.set('heat_plugin', 'instance_type',
 | 
					            conf.set('heat_plugin', 'minimal_instance_type',
 | 
				
			||||||
                 conf.get('compute', 'flavor_ref_alt'))
 | 
					                     conf.get('compute', 'flavor_ref'))
 | 
				
			||||||
        conf.set('heat_plugin', 'minimal_image_ref',
 | 
					        if 'flavor_ref_alt' in compute_options:
 | 
				
			||||||
                 conf.get('compute', 'image_ref'))
 | 
					            conf.set('heat_plugin', 'instance_type',
 | 
				
			||||||
        conf.set('heat_plugin', 'image_ref',
 | 
					                     conf.get('compute', 'flavor_ref_alt'))
 | 
				
			||||||
                 conf.get('compute', 'image_ref_alt'))
 | 
					        if 'image_ref' in compute_options:
 | 
				
			||||||
 | 
					            conf.set('heat_plugin', 'minimal_image_ref',
 | 
				
			||||||
 | 
					                     conf.get('compute', 'image_ref'))
 | 
				
			||||||
 | 
					        if 'image_ref_alt' in compute_options:
 | 
				
			||||||
 | 
					            conf.set('heat_plugin', 'image_ref',
 | 
				
			||||||
 | 
					                     conf.get('compute', 'image_ref_alt'))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user