Exemple #1
0
    def test_is_waiting_unit_series_upgrade_set(self, hookdata):
        hook_data = self.MockHookData()
        hookdata.return_value = hook_data
        # false if key is absent
        self.assertFalse(utils.is_waiting_unit_series_upgrade_set())

        # True if waiting-unit-upgrade het been set
        utils.set_waiting_unit_series_upgrade()
        self.assertTrue(utils.is_waiting_unit_series_upgrade_set())

        # False if waiting-unit-upgrade has been cleared
        utils.clear_waiting_unit_series_upgrade()
        self.assertFalse(utils.is_waiting_unit_series_upgrade_set())
def series_upgrade_prepare():
    set_unit_upgrading()
    # HA services are shutdown when the unit receives series upgrade
    # notifications from peers so cannot pause services.
    if not is_unit_paused_set() and not is_waiting_unit_series_upgrade_set():
        pause_unit()
    notify_peers_of_series_upgrade()
Exemple #3
0
def series_upgrade_prepare():
    set_unit_upgrading()
    # HA services are shutdown when the unit receives series upgrade
    # notifications from peers so cannot pause services.
    if not is_unit_paused_set() and not is_waiting_unit_series_upgrade_set():
        pause_unit()
    notify_peers_of_series_upgrade()
    # mark crmsh package as manually installed
    # so it does not get uninstalled on release upgrade
    # from xenial to bionic
    apt_mark('crmsh', 'manual')
Exemple #4
0
def hanode_relation_changed(relid=None):
    ubuntu_rel = lsb_release()['DISTRIB_CODENAME'].lower()
    log("Checking if any units have notified about a series upgrade", INFO)
    series_notifications = get_series_upgrade_notifications(relid)
    for unit, from_release in series_notifications.items():
        # from_release is the release that the peer is currently on and is
        # therefore upgrading from.
        if CompareHostReleases(ubuntu_rel) <= from_release:
            log("Shutting down services for peer upgrade", INFO)
            disable_ha_services()
            log("Setting waiting-unit-upgrade to True", INFO)
            set_waiting_unit_series_upgrade()
        else:
            log("Already series ahead of peer, no shutdown needed", INFO)
    if is_waiting_unit_series_upgrade_set():
        log("Unit is waiting for upgrade", INFO)
    else:
        log("No units have notified a series upgrade", INFO)
        ha_relation_changed()