def pre_series_upgrade():
    log("Running prepare series upgrade hook", "INFO")
    # In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm sets the paused and
    # upgrading states.
    set_unit_paused()
    set_unit_upgrading()
def pre_series_upgrade():
    log("Running prepare series upgrade hook", "INFO")
    # In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm sets the paused and
    # upgrading states.
    set_unit_paused()
    set_unit_upgrading()
Beispiel #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()
Beispiel #4
0
def pre_series_upgrade():
    log("Running prepare series upgrade hook", "INFO")
    if not is_unit_paused_set():
        for service in SWIFT_SVCS:
            stopped = service_stop(service)
            if not stopped:
                raise Exception("{} didn't stop cleanly.".format(service))
        set_unit_paused()
    set_unit_upgrading()
def pre_series_upgrade():
    hookenv.log("Running prepare series upgrade hook", "INFO")
    # NOTE: In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm sets the paused and
    # upgrading states.
    set_unit_paused()
    set_unit_upgrading()
    hookenv.status_set(
        "blocked", "Ready for do-release-upgrade and reboot. "
        "Set complete when finished.")
Beispiel #6
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')
def series_upgrade_prepare():
    set_unit_upgrading()
    if not is_unit_paused_set():
        log("Pausing unit for series upgrade.")
        rabbit.pause_unit_helper(rabbit.ConfigRenderer(rabbit.CONFIG_FILES()))
    if is_leader():
        if not leader_get('cluster_series_upgrading'):
            # Inform the entire cluster a series upgrade is occurring.
            # Run the complete-cluster-series-upgrade action on the leader to
            # clear this setting when the full cluster has completed its
            # upgrade.
            leader_set(cluster_series_upgrading=True)
def series_upgrade_prepare():
    set_unit_upgrading()
    if not is_unit_paused_set():
        log("Pausing unit for series upgrade.")
        rabbit.pause_unit_helper(rabbit.ConfigRenderer(rabbit.CONFIG_FILES))
    if is_leader():
        if not leader_get('cluster_series_upgrading'):
            # Inform the entire cluster a series upgrade is occurring.
            # Run the complete-cluster-series-upgrade action on the leader to
            # clear this setting when the full cluster has completed its
            # upgrade.
            leader_set(cluster_series_upgrading=True)
def prepare():
    # Use the pause feature to stop mysql during the duration of the upgrade
    pause_unit_helper(register_configs())
    # Set this unit to series upgrading
    set_unit_upgrading()
    # The leader will "bootstrap" with no wrep peers
    # Non-leaders will point only at the newly upgraded leader until the
    # cluster series upgrade is completed.
    # Set cluster_series_upgrading for the duration of the cluster series
    # upgrade. This will be unset with the action
    # complete-cluster-series-upgrade on the leader node.
    hosts = []

    if not leader_get('cluster_series_upgrade_leader'):
        leader_set(cluster_series_upgrading=True)
        leader_set(cluster_series_upgrade_leader=get_relation_ip('cluster'))
    else:
        hosts = [leader_get('cluster_series_upgrade_leader')]

    # Render config
    render_config(hosts)
def prepare():
    # Use the pause feature to stop mysql during the duration of the upgrade
    pause_unit_helper(register_configs())
    # Set this unit to series upgrading
    set_unit_upgrading()
    # The leader will "bootstrap" with no wrep peers
    # Non-leaders will point only at the newly upgraded leader until the
    # cluster series upgrade is completed.
    # Set cluster_series_upgrading for the duration of the cluster series
    # upgrade. This will be unset with the action
    # complete-cluster-series-upgrade on the leader node.
    hosts = []

    if not leader_get('cluster_series_upgrade_leader'):
        leader_set(cluster_series_upgrading=True)
        leader_set(
            cluster_series_upgrade_leader=get_relation_ip('cluster'))
    else:
        hosts = [leader_get('cluster_series_upgrade_leader')]

    # Render config
    render_config(hosts)
def series_upgrade():

    # Set this unit to series upgrading
    set_unit_upgrading()

    # The leader will "bootstrap" with no wrep peers
    # Non-leaders will point only at the newly upgraded leader until the
    # cluster series upgrade is completed.
    # Set cluster_series_upgrading for the duration of the cluster series
    # upgrade. This will be unset with the action
    # complete-cluster-series-upgrade on the leader node.
    if (leader_get('cluster_series_upgrade_leader') == get_relation_ip(
            'cluster')):
        hosts = []
    else:
        hosts = [leader_get('cluster_series_upgrade_leader')]

    # New series after series upgrade and reboot
    _release = lsb_release()['DISTRIB_CODENAME'].lower()

    if _release == "xenial":
        # Guarantee /var/run/mysqld exists
        _dir = '/var/run/mysqld'
        mkdir(_dir, owner="mysql", group="mysql", perms=0o755)

    # Install new versions of the percona packages
    apt_install(determine_packages())
    service_stop("mysql")

    if _release == "bionic":
        render_config(hosts)

    if _release == "xenial":
        # Move the packaged version empty DB out of the way.
        cmd = [
            "mv", "/var/lib/percona-xtradb-cluster",
            "/var/lib/percona-xtradb-cluster.dpkg"
        ]
        subprocess.check_call(cmd)

        # Symlink the previous versions data to the new
        cmd = ["ln", "-s", "/var/lib/mysql", "/var/lib/percona-xtradb-cluster"]
        subprocess.check_call(cmd)

    # Start mysql temporarily with no wrep for the upgrade
    cmd = ["mysqld"]
    if _release == "bionic":
        cmd.append("--skip-grant-tables")
        cmd.append("--user=mysql")
    cmd.append("--wsrep-provider=none")
    log("Starting mysqld --wsrep-provider='none' and waiting ...")
    proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)

    # Wait for the mysql socket to exist
    check_for_socket(MYSQL_SOCKET, exists=True)

    # Execute the upgrade process
    log("Running mysql_upgrade")
    cmd = ['mysql_upgrade']
    if _release == "xenial":
        cmd.append('-p{}'.format(root_password()))
    subprocess.check_call(cmd)

    # Terminate the temporary mysql
    proc.terminate()

    # Wait for the mysql socket to be removed
    check_for_socket(MYSQL_SOCKET, exists=False)

    # Clear states
    clear_unit_paused()
    clear_unit_upgrading()

    if _release == "xenial":
        # Point at the correct my.cnf
        cmd = [
            "update-alternatives", "--set", "my.cnf",
            "/etc/mysql/percona-xtradb-cluster.cnf"
        ]
        subprocess.check_call(cmd)

    # Render config
    render_config(hosts)

    resume_unit_helper(register_configs())

    # finally update the sstuser if needed.
    # BUG: #1838044
    _sst_password = sst_password()
    if _sst_password:
        configure_sstuser(_sst_password)
Beispiel #12
0
 def series_upgrade_prepare(self):
     """Prepare to upgrade series"""
     reactive.set_flag("charm.series-upgrading")
     reactive.set_flag("charm.paused")
     os_utils.set_unit_upgrading()
     self.run_pause_or_resume('pause')
Beispiel #13
0
def series_upgrade_prepare():
    set_unit_upgrading()
    if not is_unit_paused_set():
        pause_unit()
Beispiel #14
0
 def series_upgrade_prepare(self):
     """Prepare to upgrade series"""
     os_utils.set_unit_upgrading()
     self.run_pause_or_resume('pause')
Beispiel #15
0
def series_upgrade_prepare():
    set_unit_upgrading()
    if not is_unit_paused_set():
        pause_unit()
 def series_upgrade_prepare(self):
     """Prepare to upgrade series"""
     os_utils.set_unit_upgrading()
     self.run_pause_or_resume('pause')
def series_upgrade():

    # Set this unit to series upgrading
    set_unit_upgrading()

    # The leader will "bootstrap" with no wrep peers
    # Non-leaders will point only at the newly upgraded leader until the
    # cluster series upgrade is completed.
    # Set cluster_series_upgrading for the duration of the cluster series
    # upgrade. This will be unset with the action
    # complete-cluster-series-upgrade on the leader node.
    if (leader_get('cluster_series_upgrade_leader') ==
            get_relation_ip('cluster')):
        hosts = []
    else:
        hosts = [leader_get('cluster_series_upgrade_leader')]

    # New series after series upgrade and reboot
    _release = lsb_release()['DISTRIB_CODENAME'].lower()

    if _release == "xenial":
        # Guarantee /var/run/mysqld exists
        _dir = '/var/run/mysqld'
        mkdir(_dir, owner="mysql", group="mysql", perms=0o755)

    # Install new versions of the percona packages
    apt_install(determine_packages())
    service_stop("mysql")

    if _release == "bionic":
        render_config(hosts)

    if _release == "xenial":
        # Move the packaged version empty DB out of the way.
        cmd = ["mv", "/var/lib/percona-xtradb-cluster",
               "/var/lib/percona-xtradb-cluster.dpkg"]
        subprocess.check_call(cmd)

        # Symlink the previous versions data to the new
        cmd = ["ln", "-s", "/var/lib/mysql", "/var/lib/percona-xtradb-cluster"]
        subprocess.check_call(cmd)

    # Start mysql temporarily with no wrep for the upgrade
    cmd = ["mysqld"]
    if _release == "bionic":
        cmd.append("--skip-grant-tables")
        cmd.append("--user=mysql")
    cmd.append("--wsrep-provider=none")
    log("Starting mysqld --wsrep-provider='none' and waiting ...")
    proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)

    # Wait for the mysql socket to exist
    check_for_socket(MYSQL_SOCKET, exists=True)

    # Execute the upgrade process
    log("Running mysql_upgrade")
    cmd = ['mysql_upgrade']
    if _release == "xenial":
        cmd.append('-p{}'.format(root_password()))
    subprocess.check_call(cmd)

    # Terminate the temporary mysql
    proc.terminate()

    # Wait for the mysql socket to be removed
    check_for_socket(MYSQL_SOCKET, exists=False)

    # Clear states
    clear_unit_paused()
    clear_unit_upgrading()

    if _release == "xenial":
        # Point at the correct my.cnf
        cmd = ["update-alternatives", "--set", "my.cnf",
               "/etc/mysql/percona-xtradb-cluster.cnf"]
        subprocess.check_call(cmd)

    # Render config
    render_config(hosts)

    resume_unit_helper(register_configs())