def openstack_upgrade():
    """Upgrade packages to config-set Openstack version.

    If the charm was installed from source we cannot upgrade it.
    For backwards compatibility a config flag must be set for this
    code to run, otherwise a full service level upgrade will fire
    on config-changed."""

    # If attempting to upgrade from Stein->Train, block until Placement
    # charm is related. Status is set in check_optional_relations().
    release = ch_utils.os_release('nova-common')
    cmp_os_release = ch_utils.CompareOpenStackReleases(release)
    if (cmp_os_release == 'stein' and not hookenv.relation_ids('placement')):
        return

    if (ch_utils.do_action_openstack_upgrade('nova-common',
                                             utils.do_openstack_upgrade,
                                             hooks.CONFIGS)):
        for rid in hookenv.relation_ids('neutron-api'):
            hooks.neutron_api_relation_joined(rid=rid, remote_restart=True)
        # NOTE(thedac): Force re-fire of shared-db joined hook
        # to ensure that nova_api database is setup if required.
        for r_id in hookenv.relation_ids('shared-db'):
            hooks.db_joined(relation_id=r_id)
        hooks.config_changed()
 def test_db_joined_spaces(self):
     self.get_relation_ip.return_value = '192.168.20.1'
     self.unit_get.return_value = 'nova.foohost.com'
     self.is_relation_made.return_value = False
     self.os_release.return_value = 'diablo'
     hooks.db_joined()
     self.relation_set.assert_called_with(nova_database='nova',
                                          nova_username='******',
                                          nova_hostname='192.168.20.1',
                                          relation_id=None)
 def test_db_joined(self):
     self.get_relation_ip.return_value = '10.10.10.10'
     self.is_relation_made.return_value = False
     self.os_release.return_value = 'diablo'
     hooks.db_joined()
     self.relation_set.assert_called_with(nova_database='nova',
                                          nova_username='******',
                                          nova_hostname='10.10.10.10',
                                          relation_id=None)
     self.get_relation_ip.assert_called_with('shared-db', cidr_network=None)
 def test_db_joined_spaces(self):
     self.get_relation_ip.return_value = '192.168.20.1'
     self.unit_get.return_value = 'nova.foohost.com'
     self.is_relation_made.return_value = False
     self.os_release.return_value = 'diablo'
     hooks.db_joined()
     self.relation_set.assert_called_with(nova_database='nova',
                                          nova_username='******',
                                          nova_hostname='192.168.20.1',
                                          relation_id=None)
 def test_db_joined(self):
     self.get_relation_ip.return_value = '10.10.10.10'
     self.is_relation_made.return_value = False
     self.os_release.return_value = 'diablo'
     hooks.db_joined()
     self.relation_set.assert_called_with(nova_database='nova',
                                          nova_username='******',
                                          nova_hostname='10.10.10.10',
                                          relation_id=None)
     self.get_relation_ip.assert_called_with('shared-db',
                                             cidr_network=None)
    def test_db_joined_mitaka(self):
        self.get_relation_ip.return_value = '10.10.10.10'
        self.os_release.return_value = 'mitaka'
        self.is_relation_made.return_value = False
        hooks.db_joined()
        self.relation_set.assert_has_calls([
            call(nova_database='nova',
                 nova_username='******',
                 nova_hostname='10.10.10.10',
                 relation_id=None),
            call(novaapi_database='nova_api',
                 novaapi_username='******',
                 novaapi_hostname='10.10.10.10',
                 relation_id=None),
        ])

        self.get_relation_ip.assert_called_with('shared-db', cidr_network=None)
def openstack_upgrade():
    """Upgrade packages to config-set Openstack version.

    If the charm was installed from source we cannot upgrade it.
    For backwards compatibility a config flag must be set for this
    code to run, otherwise a full service level upgrade will fire
    on config-changed."""

    if (ch_utils.do_action_openstack_upgrade('nova-common',
                                             utils.do_openstack_upgrade,
                                             hooks.CONFIGS)):
        for rid in hookenv.relation_ids('neutron-api'):
            hooks.neutron_api_relation_joined(rid=rid, remote_restart=True)
        # NOTE(thedac): Force re-fire of shared-db joined hook
        # to ensure that nova_api database is setup if required.
        for r_id in hookenv.relation_ids('shared-db'):
            hooks.db_joined(relation_id=r_id)
        hooks.config_changed()
Exemple #8
0
def openstack_upgrade():
    """Upgrade packages to config-set Openstack version.

    If the charm was installed from source we cannot upgrade it.
    For backwards compatibility a config flag must be set for this
    code to run, otherwise a full service level upgrade will fire
    on config-changed."""

    if (ch_utils.do_action_openstack_upgrade('nova-common',
                                             utils.do_openstack_upgrade,
                                             hooks.CONFIGS)):
        for rid in hookenv.relation_ids('neutron-api'):
            hooks.neutron_api_relation_joined(rid=rid, remote_restart=True)
        # NOTE(thedac): Force re-fire of shared-db joined hook
        # to ensure that nova_api database is setup if required.
        for r_id in hookenv.relation_ids('shared-db'):
            hooks.db_joined(relation_id=r_id)
        hooks.config_changed()
    def test_db_joined_mitaka(self):
        self.get_relation_ip.return_value = '10.10.10.10'
        self.os_release.return_value = 'mitaka'
        self.is_relation_made.return_value = False
        hooks.db_joined()
        self.relation_set.assert_has_calls([
            call(nova_database='nova',
                 nova_username='******',
                 nova_hostname='10.10.10.10',
                 relation_id=None),
            call(novaapi_database='nova_api',
                 novaapi_username='******',
                 novaapi_hostname='10.10.10.10',
                 relation_id=None),
        ])

        self.get_relation_ip.assert_called_with('shared-db',
                                                cidr_network=None)