Esempio n. 1
0
def post_series_upgrade():
    log("Running complete series upgrade hook", "INFO")
    # In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm clears the paused and
    # upgrading states.
    clear_unit_paused()
    clear_unit_upgrading()
Esempio n. 2
0
 def series_upgrade_complete(self):
     """Prepare to upgrade series"""
     reactive.clear_flag("charm.series-upgrading")
     reactive.clear_flag("charm.paused")
     os_utils.clear_unit_paused()
     os_utils.clear_unit_upgrading()
     self.run_pause_or_resume('resume')
Esempio n. 3
0
def post_series_upgrade():
    log("Running complete series upgrade hook", "INFO")
    # In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm clears the paused and
    # upgrading states.
    clear_unit_paused()
    clear_unit_upgrading()
Esempio n. 4
0
def post_series_upgrade():
    log("Running complete series upgrade hook", "INFO")
    clear_unit_paused()
    clear_unit_upgrading()
    if not is_unit_paused_set():
        for service in SWIFT_SVCS:
            started = service_start(service)
            if not started:
                raise Exception("{} didn't start cleanly.".format(service))
Esempio n. 5
0
def resume(args):
    """Resume all the swift services.

    @raises Exception if any services fail to start
    """
    for service in args.services:
        started = service_resume(service)
        if not started:
            raise Exception("{} didn't start cleanly.".format(service))
    clear_unit_paused()
    assess_status(CONFIGS, args.services)
Esempio n. 6
0
def resume(args):
    """Resume all the swift services.

    @raises Exception if any services fail to start
    """
    for service in args.services:
        started = service_resume(service)
        if not started:
            raise Exception("{} didn't start cleanly.".format(service))
    clear_unit_paused()
    assess_status(CONFIGS, args.services)
def post_series_upgrade():
    log("Running complete series upgrade hook", "INFO")
    openstack.clear_unit_paused()
    openstack.clear_unit_upgrading()
    _services, _ = get_managed_services_and_ports(services(), [])
    if not openstack.is_unit_paused_set():
        for service in _services:
            service_resume(service)
            started = service_start(service)
            if not started:
                raise Exception("{} didn't start cleanly.".format(service))
Esempio n. 8
0
def resume(args):
    """Resume the ceph-osd units on this local machine only

    @raises subprocess.CalledProcessError should the osd units fails to resume.
    @raises OSError if the unit can't get the local osd ids
    """
    for local_id in get_local_osd_ids():
        cmd = ['ceph', '--id', 'osd-upgrade', 'osd', 'in', str(local_id)]
        check_call(cmd)
    clear_unit_paused()
    assess_status()
Esempio n. 9
0
def series_upgrade_complete():
    log("Running complete series upgrade hook", "INFO")
    clear_unit_paused()
    clear_unit_upgrading()
    config_changed()
    enable_ha_services()
    log("Resuming unit")
    resume_unit()
    clear_series_upgrade_notification()
    log("Setting waiting-unit-upgrade to False", INFO)
    clear_waiting_unit_series_upgrade()
def series_upgrade_complete():
    log("Running complete series upgrade hook", "INFO")
    # NOTE(jamespage): If a newer RMQ version is
    # installed and the old style configuration file
    # is still on disk, remove before re-rendering
    # any new configuration.
    if (os.path.exists(rabbit.RABBITMQ_CONFIG)
            and cmp_pkgrevno('rabbitmq-server', '3.7') >= 0):
        os.remove(rabbit.RABBITMQ_CONFIG)
        rabbit.ConfigRenderer(rabbit.CONFIG_FILES()).write_all()
    clear_unit_paused()
    clear_unit_upgrading()
    rabbit.resume_unit_helper(rabbit.ConfigRenderer(rabbit.CONFIG_FILES()))
Esempio n. 11
0
def resume_unit():
    """Resume services on this unit and update the units status

    @returns None
    """
    node_name = get_hostname()
    messages = []
    leave_standby_mode(node_name)
    if is_in_standby_mode(node_name):
        messages.append("Node still in standby mode")
    if messages:
        raise Exception("Couldn't resume: {}".format("; ".join(messages)))
    else:
        clear_unit_paused()
        set_unit_status()
Esempio n. 12
0
def resume_unit():
    """Resume services on this unit and update the units status

    @returns None
    """
    node_name = get_hostname()
    messages = []
    leave_standby_mode(node_name)
    if is_in_standby_mode(node_name):
        messages.append("Node still in standby mode")
    if messages:
        raise Exception("Couldn't resume: {}".format("; ".join(messages)))
    else:
        clear_unit_paused()
        set_unit_status()
Esempio n. 13
0
def series_upgrade_complete():
    log("Running complete series upgrade hook", "INFO")
    clear_unit_paused()
    clear_unit_upgrading()
    rabbit.resume_unit_helper(rabbit.ConfigRenderer(rabbit.CONFIG_FILES))
Esempio n. 14
0
 def series_upgrade_complete(self):
     """Prepare to upgrade series"""
     os_utils.clear_unit_paused()
     os_utils.clear_unit_upgrading()
     self.run_pause_or_resume('resume')
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())
def series_upgrade_complete():
    log("Running complete series upgrade hook", "INFO")
    clear_unit_paused()
    clear_unit_upgrading()
    rabbit.resume_unit_helper(rabbit.ConfigRenderer(rabbit.CONFIG_FILES))
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)
Esempio n. 18
0
 def series_upgrade_complete(self):
     """Prepare to upgrade series"""
     os_utils.clear_unit_paused()
     os_utils.clear_unit_upgrading()
     self.run_pause_or_resume('resume')
Esempio n. 19
0
def series_upgrade_complete():
    log("Running complete series upgrade hook", "INFO")
    clear_unit_paused()
    clear_unit_upgrading()
    config_changed()
    resume_unit()
Esempio n. 20
0
def series_upgrade_complete():
    log("Running complete series upgrade hook", "INFO")
    clear_unit_paused()
    clear_unit_upgrading()
    config_changed()
    resume_unit()