def compute_joined(rid=None): # NOTE(james-page) in MAAS environments the actual hostname is a CNAME # record so won't get scanned based on private-address which is an IP # add the hostname configured locally to the relation. settings = { 'hostname': gethostname(), 'private-address': get_relation_ip('migration', cidr_network=config('libvirt-migration-network')), } az = get_availability_zone() if az: relation_set(relation_id=rid, availability_zone=az) if migration_enabled(): auth_type = config('migration-auth-type') settings['migration_auth_type'] = auth_type if auth_type == 'ssh': settings['ssh_public_key'] = public_ssh_key() relation_set(relation_id=rid, **settings) if config('enable-resize'): settings['nova_ssh_public_key'] = public_ssh_key(user='******') relation_set(relation_id=rid, **settings)
def neutron_plugin_joined(relid=None, remote_restart=False): rel_settings = { 'hugepage_number': get_hugepage_number(), 'default_availability_zone': get_availability_zone() } if remote_restart: rel_settings['restart-trigger'] = str(uuid.uuid4()) relation_set(relation_id=relid, **rel_settings)
def neutron_plugin_joined(relid=None, remote_restart=False): rel_settings = { 'hugepage_number': get_hugepage_number(), 'default_availability_zone': get_availability_zone() } if remote_restart: rel_settings['restart-trigger'] = str(uuid.uuid4()) relation_set(relation_id=relid, **rel_settings)
def test_get_az_no_customize_with_env(self, os_environ_get_mock): self.test_config.set('customize-failure-domain', False) self.test_config.set('default-availability-zone', 'nova') def os_environ_get_side_effect(key): return { 'JUJU_AVAILABILITY_ZONE': 'az1', }[key] os_environ_get_mock.side_effect = os_environ_get_side_effect az = utils.get_availability_zone() self.assertEqual('nova', az)
def test_get_az_no_customize_with_env(self, os_environ_get_mock): self.test_config.set('customize-failure-domain', False) self.test_config.set('default-availability-zone', 'nova') def os_environ_get_side_effect(key): return { 'JUJU_AVAILABILITY_ZONE': 'az1', }[key] os_environ_get_mock.side_effect = os_environ_get_side_effect az = utils.get_availability_zone() self.assertEqual('nova', az)