def test_guard_map_neutron(self):
     self.relation_ids.return_value = []
     self.network_manager.return_value = 'neutron'
     self.os_release.return_value = 'icehouse'
     self.is_relation_made.return_value = False
     self.assertEqual(
         {'neutron-server': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-ec2': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-conductor': ['identity-service', 'amqp', 'shared-db'],
          'nova-objectstore': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db'], },
         utils.guard_map()
     )
     self.network_manager.return_value = 'quantum'
     self.os_release.return_value = 'grizzly'
     self.assertEqual(
         {'quantum-server': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-ec2': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-conductor': ['identity-service', 'amqp', 'shared-db'],
          'nova-objectstore': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db'], },
         utils.guard_map()
     )
 def test_guard_map_nova(self):
     self.relation_ids.return_value = []
     self.os_release.return_value = 'havana'
     self.assertEqual(
         {'nova-api-ec2': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-conductor': ['identity-service', 'amqp', 'shared-db'],
          'nova-objectstore': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db']},
         utils.guard_map()
     )
     self.os_release.return_value = 'essex'
     self.assertEqual(
         {'nova-api-ec2': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-objectstore': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db']},
         utils.guard_map()
     )
 def test_guard_map_nova(self):
     self.relation_ids.return_value = []
     self.os_release.return_value = 'icehouse'
     self.assertEqual(
         {'nova-api-ec2': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-conductor': ['identity-service', 'amqp', 'shared-db'],
          'nova-objectstore': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db']},
         utils.guard_map()
     )
 def test_guard_map_neutron(self):
     self.relation_ids.return_value = []
     self.os_release.return_value = 'icehouse'
     self.get_os_codename_install_source.return_value = 'icehouse'
     self.assertEqual(
         {'nova-api-ec2': ['identity-service', 'amqp', 'shared-db'],
          'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-conductor': ['identity-service', 'amqp', 'shared-db'],
          'nova-objectstore': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db'], },
         utils.guard_map()
     )
     self.os_release.return_value = 'mitaka'
     self.get_os_codename_install_source.return_value = 'mitaka'
     self.assertEqual(
         {'nova-api-os-compute': ['identity-service', 'amqp', 'shared-db'],
          'nova-cert': ['identity-service', 'amqp', 'shared-db'],
          'nova-conductor': ['identity-service', 'amqp', 'shared-db'],
          'nova-scheduler': ['identity-service', 'amqp', 'shared-db'], },
         utils.guard_map()
     )
 def test_guard_map_pgsql(self):
     self.relation_ids.return_value = ['pgsql:1']
     self.os_release.return_value = 'icehouse'
     self.assertEqual(
         {'nova-api-ec2': ['identity-service', 'amqp', 'pgsql-nova-db'],
          'nova-api-os-compute': ['identity-service', 'amqp',
                                  'pgsql-nova-db'],
          'nova-cert': ['identity-service', 'amqp', 'pgsql-nova-db'],
          'nova-conductor': ['identity-service', 'amqp', 'pgsql-nova-db'],
          'nova-objectstore': ['identity-service', 'amqp',
                               'pgsql-nova-db'],
          'nova-scheduler': ['identity-service', 'amqp',
                             'pgsql-nova-db'], },
         utils.guard_map()
     )
    if os.path.isdir(_files):
        for f in os.listdir(_files):
            f = os.path.join(_files, f)
            if os.path.isfile(f):
                log('Installing %s to /usr/bin' % f)
                shutil.copy2(f, '/usr/bin')
    [open_port(port) for port in determine_ports()]
    msg = 'Disabling services into db relation joined'
    log(msg)
    status_set('maintenance', msg)
    disable_services()
    cmd_all_services('stop')


@hooks.hook('config-changed')
@service_guard(guard_map(), CONFIGS,
               active=config('service-guard'))
@restart_on_change(restart_map(), stopstart=True)
@harden()
def config_changed():
    # neutron-server runs if < juno. Neutron-server creates mysql tables
    # which will subsequently cause db migratoins to fail if >= juno.
    # Disable neutron-server if >= juno
    if os_release('nova-common') >= 'juno':
        with open('/etc/init/neutron-server.override', 'wb') as out:
            out.write('manual\n')
    if config('prefer-ipv6'):
        status_set('maintenance', 'configuring ipv6')
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config('database'),
                                          config('database-user'),
Example #7
0
    if os.path.isdir(_files):
        for f in os.listdir(_files):
            f = os.path.join(_files, f)
            if os.path.isfile(f):
                log('Installing %s to /usr/bin' % f)
                shutil.copy2(f, '/usr/bin')
    [open_port(port) for port in determine_ports()]
    msg = 'Disabling services into db relation joined'
    log(msg)
    status_set('maintenance', msg)
    disable_services()
    cmd_all_services('stop')


@hooks.hook('config-changed')
@service_guard(guard_map(), CONFIGS, active=config('service-guard'))
@restart_on_change(restart_map(), stopstart=True)
def config_changed():
    if config('prefer-ipv6'):
        status_set('maintenance', 'configuring ipv6')
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config('database'),
                                          config('database-user'),
                                          relation_prefix='nova')

    global CONFIGS
    if git_install_requested():
        status_set('maintenance', 'Running Git install')
        if config_value_changed('openstack-origin-git'):
            git_install(config('openstack-origin-git'))
    elif not config('action-managed-upgrade'):
Example #8
0
    if os.path.isdir(_files):
        for f in os.listdir(_files):
            f = os.path.join(_files, f)
            if os.path.isfile(f):
                log('Installing %s to /usr/bin' % f)
                shutil.copy2(f, '/usr/bin')
    [open_port(port) for port in determine_ports()]
    msg = 'Disabling services into db relation joined'
    log(msg)
    status_set('maintenance', msg)
    disable_services()
    cmd_all_services('stop')


@hooks.hook('config-changed')
@service_guard(guard_map(), CONFIGS,
               active=config('service-guard'))
@restart_on_change(restart_map(), stopstart=True)
@harden()
def config_changed():
    # neutron-server runs if < juno. Neutron-server creates mysql tables
    # which will subsequently cause db migratoins to fail if >= juno.
    # Disable neutron-server if >= juno
    if os_release('nova-common') >= 'juno':
        with open('/etc/init/neutron-server.override', 'wb') as out:
            out.write('manual\n')
    if config('prefer-ipv6'):
        status_set('maintenance', 'configuring ipv6')
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config('database'),
                                          config('database-user'),