def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))

    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)

    if placement_api_enabled():
        disable_package_apache_site()

    git_install(config('openstack-origin-git'))

    _files = os.path.join(charm_dir(), 'files')
    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')
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()),
                fatal=True)
    for r_id in relation_ids('amqp'):
        amqp_joined(relation_id=r_id)
    for r_id in relation_ids('identity-service'):
        identity_joined(rid=r_id)
    for r_id in relation_ids('cloud-compute'):
        for unit in related_units(r_id):
            compute_changed(r_id, unit)
    for r_id in relation_ids('shared-db'):
        db_joined(relation_id=r_id)

    rels = ['shared-db', 'pgsql-nova-db']
    for rname in rels:
        for rid in relation_ids(rname):
            for unit in related_units(rid):
                if rname == 'pgsql-nova-db':
                    leader_init_db_if_ready(skip_acl_check=True,
                                            skip_cells_restarts=True,
                                            db_rid=rid, unit=unit)
                else:
                    leader_init_db_if_ready(db_rid=rid, unit=unit)

    update_nrpe_config()
    update_nova_consoleauth_config()
 def test_determine_packages_base(self, git_requested, subcontext):
     git_requested.return_value = False
     self.relation_ids.return_value = []
     self.os_release.return_value = 'folsom'
     pkgs = utils.determine_packages()
     ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES))
     self.assertEquals(ex, pkgs)
Example #4
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    for r_id in relation_ids('amqp'):
        amqp_joined(relation_id=r_id)
    for r_id in relation_ids('identity-service'):
        identity_joined(rid=r_id)
    for r_id in relation_ids('cloud-compute'):
        for unit in related_units(r_id):
            compute_changed(r_id, unit)
    for r_id in relation_ids('shared-db'):
        db_joined(relation_id=r_id)

    rels = ['shared-db', 'pgsql-nova-db']
    for rname in rels:
        for rid in relation_ids(rname):
            for unit in related_units(rid):
                if rname == 'pgsql-nova-db':
                    leader_init_db_if_ready(skip_acl_check=True,
                                            skip_cells_restarts=True,
                                            db_rid=rid,
                                            unit=unit)
                else:
                    leader_init_db_if_ready(db_rid=rid, unit=unit)

    update_nrpe_config()
    update_nova_consoleauth_config()
Example #5
0
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'),
                                          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'):
        if openstack_upgrade_available('nova-common'):
            status_set('maintenance', 'Running openstack upgrade')
            CONFIGS = do_openstack_upgrade(CONFIGS)
            [
                neutron_api_relation_joined(rid=rid, remote_restart=True)
                for rid in relation_ids('neutron-api')
            ]
            # NOTE(jamespage): Force re-fire of shared-db joined hook
            # to ensure that nova_api database is setup if required.
            [db_joined(relation_id=r_id) for r_id in relation_ids('shared-db')]

    save_script_rc()
    configure_https()
    CONFIGS.write_all()

    # NOTE(jamespage): deal with any changes to the console and serial
    #                  console configuration options
    if not git_install_requested():
        filtered = filter_installed_packages(determine_packages())
        if filtered:
            apt_install(filtered, fatal=True)

    for r_id in relation_ids('identity-service'):
        identity_joined(rid=r_id)
    for rid in relation_ids('zeromq-configuration'):
        zeromq_configuration_relation_joined(rid)
    [cluster_joined(rid) for rid in relation_ids('cluster')]
    [compute_joined(rid=rid) for rid in relation_ids('cloud-compute')]

    update_nrpe_config()

    # If the region value has changed, notify the cloud-compute relations
    # to ensure the value is propagated to the compute nodes.
    if config_value_changed('region'):
        for rid in relation_ids('cloud-compute'):
            for unit in related_units(rid):
                compute_changed(rid, unit)

    update_nova_consoleauth_config()
    update_aws_compat_services()
 def test_determine_packages_base(self, git_requested, subcontext):
     git_requested.return_value = False
     self.relation_ids.return_value = []
     self.os_release.return_value = 'icehouse'
     pkgs = utils.determine_packages()
     ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES))
     self.assertEquals(ex, pkgs)
 def test_determine_packages_base_grizzly_beyond(self, subcontext):
     self.relation_ids.return_value = []
     self.os_release.return_value = 'grizzly'
     pkgs = utils.determine_packages()
     ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES))
     ex.append('nova-conductor')
     self.assertEquals(sorted(ex), sorted(pkgs))
 def test_determine_packages_console(self, git_requested, subcontext):
     git_requested.return_value = False
     self.test_config.set('console-access-protocol', 'spice')
     self.relation_ids.return_value = []
     pkgs = utils.determine_packages()
     console_pkgs = ['nova-spiceproxy', 'nova-consoleauth']
     for console_pkg in console_pkgs:
         self.assertIn(console_pkg, pkgs)
 def test_determine_packages_console(self, subcontext):
     self.test_config.set('console-access-protocol', 'spice')
     self.relation_ids.return_value = []
     self.os_release.return_value = 'diablo'
     pkgs = utils.determine_packages()
     console_pkgs = ['nova-spiceproxy', 'nova-consoleauth']
     for console_pkg in console_pkgs:
         self.assertIn(console_pkg, pkgs)
 def test_determine_packages_base_ocata(self, subcontext):
     self.relation_ids.return_value = []
     self.os_release.return_value = 'ocata'
     self.token_cache_pkgs.return_value = []
     self.enable_memcache.return_value = False
     pkgs = utils.determine_packages()
     ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES))
     self.assertEqual(ex, pkgs)
Example #11
0
 def test_determine_packages_console(self, git_requested, subcontext):
     git_requested.return_value = False
     self.test_config.set('console-access-protocol', 'spice')
     self.relation_ids.return_value = []
     pkgs = utils.determine_packages()
     console_pkgs = ['nova-spiceproxy', 'nova-consoleauth']
     for console_pkg in console_pkgs:
         self.assertIn(console_pkg, pkgs)
 def test_determine_packages_serial_console_icehouse(self,
                                                     subcontext):
     self.test_config.set('enable-serial-console', True)
     self.relation_ids.return_value = []
     self.os_release.return_value = 'icehouse'
     pkgs = utils.determine_packages()
     console_pkgs = ['nova-serialproxy', 'nova-consoleauth']
     for console_pkg in console_pkgs:
         self.assertNotIn(console_pkg, pkgs)
 def test_determine_packages_base_icehouse(self, subcontext):
     self.relation_ids.return_value = []
     self.os_release.return_value = 'icehouse'
     self.token_cache_pkgs.return_value = []
     self.enable_memcache.return_value = False
     pkgs = utils.determine_packages()
     ex = list(set(utils.BASE_PACKAGES + utils.BASE_SERVICES))
     # nova-placement-api is purposely dropped unless it's ocata
     ex.remove('nova-placement-api')
     self.assertEqual(ex, pkgs)
Example #14
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    for r_id in relation_ids('amqp'):
        amqp_joined(relation_id=r_id)
    for r_id in relation_ids('identity-service'):
        identity_joined(rid=r_id)
    for r_id in relation_ids('cloud-compute'):
        for unit in related_units(r_id):
            compute_changed(r_id, unit)
    update_nrpe_config()
    update_nova_consoleauth_config()
Example #15
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()),
                fatal=True)
    for r_id in relation_ids('amqp'):
        amqp_joined(relation_id=r_id)
    for r_id in relation_ids('identity-service'):
        identity_joined(rid=r_id)
    for r_id in relation_ids('cloud-compute'):
        for unit in related_units(r_id):
            compute_changed(r_id, unit)
    update_nrpe_config()
    update_nova_consoleauth_config()
def install():
    execd_preinstall()
    plugin = config('quantum-plugin')
    if (plugin == 'n1kv'):
        command = "cp templates/havana/openrc /root/"
        process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
        output = process.communicate()[0]
    configure_installation_source(config('openstack-origin'))
    apt_update()
    apt_install(determine_packages(), fatal=True)

    _files = os.path.join(charm_dir(), 'files')
    if os.path.isdir(_files):
        for f in os.listdir(_files):
            f = os.path.join(_files, f)
            log('Installing %s to /usr/bin' % f)
            shutil.copy2(f, '/usr/bin')
    [open_port(port) for port in determine_ports()]
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))

    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)

    git_install(config('openstack-origin-git'))

    _files = os.path.join(charm_dir(), 'files')
    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')
 def test_determine_packages_quantum(self, subcontext):
     self._resource_map(network_manager='quantum')
     pkgs = utils.determine_packages()
     self.assertIn('quantum-server', pkgs)
Example #19
0
 def test_determine_packages_nova_volume(self, git_requested, subcontext):
     git_requested.return_value = False
     self.relation_ids.return_value = ['nova-volume-service:0']
     pkgs = utils.determine_packages()
     self.assertIn('nova-api-os-volume', pkgs)
Example #20
0
 def test_determine_packages_neutron(self, git_requested, subcontext):
     git_requested.return_value = False
     self.is_relation_made.return_value = False
     self._resource_map(network_manager='neutron')
     pkgs = utils.determine_packages()
     self.assertIn('neutron-server', pkgs)
Example #21
0
 def test_determine_packages_quantum(self, git_requested, subcontext):
     git_requested.return_value = False
     self._resource_map(network_manager='quantum')
     pkgs = utils.determine_packages()
     self.assertIn('quantum-server', pkgs)
 def test_determine_packages_neutron(self, subcontext):
     self._resource_map(network_manager='neutron')
     pkgs = utils.determine_packages()
     self.assertIn('neutron-server', pkgs)