def main(argv):
    cli_utils.setup_logging()
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--target_release",
        default='auto', help="Openstack release name to upgrade to or 'auto' "
                             "to have script upgrade based on the lowest value"
                             "across all services")
    options = parser.parse_args()
    target_release = cli_utils.parse_arg(options, 'target_release')
    principle_services = mojo_utils.get_principle_applications()
    current_versions = openstack_utils.get_current_os_versions(
        principle_services)
    if target_release == 'auto':
        # If in auto mode find the lowest value openstack release across all
        # services and make sure all servcies are upgraded to one release
        # higher than the lowest
        lowest_release = mojo_os_utils.get_lowest_os_version(current_versions)
        target_release = mojo_os_utils.next_release(lowest_release)[1]
    # Get a list of services that need upgrading
    needs_upgrade = get_upgrade_targets(target_release, current_versions)
    for application in openstack_utils.UPGRADE_SERVICES:
        if application['name'] not in principle_services:
            continue
        if application['name'] not in needs_upgrade:
            logging.info('Not upgrading {} it is at {} or higher'.format(
                application['name'],
                target_release)
            )
            continue
        logging.info('Upgrading {} to {}'.format(application['name'],
                                                 target_release))
        # Update required relations
        update_relations(application['name'], target_release)
        ubuntu_version = mojo_utils.get_ubuntu_version(application['name'])
        config = {application['type']['origin_setting']:
                  "cloud:{}-{}/proposed"
                  .format(ubuntu_version, target_release)}
        model.set_application_config(application['name'], config)
        # NOTE: For liberty->mitaka upgrade ceilometer-agent gets stuck at
        # 'Services not running that should be: memcached' after nova-compute
        # upgrade, and test would wait forever. Therefore we upgrade
        # ceilometer-agent immediately after nova-compute.
        if application['name'] == 'nova-compute':
            model.set_application_config('ceilometer-agent', config)
        mojo_utils.juju_wait_finished()
Esempio n. 2
0
def main(argv):
    cli_utils.setup_logging()
    parser = argparse.ArgumentParser()
    parser.add_argument("term_method", default='juju', nargs='?')
    options = parser.parse_args()
    term_method = cli_utils.parse_arg(options, 'term_method')
    services = mojo_utils.get_principle_applications()
    for svc in services:
        doomed_service = services.pop(0)
        if mojo_utils.is_crm_clustered(doomed_service):
            mojo_os_utils.delete_crm_leader(doomed_service, method=term_method)
        else:
            mojo_utils.delete_oldest(doomed_service, method=term_method)
        mojo_utils.juju_check_hooks_complete()
        mojo_utils.juju_wait_finished()
        mojo_utils.add_unit(svc, unit_num=1)
        mojo_utils.juju_check_hooks_complete()
        mojo_utils.juju_wait_finished()
def main(argv):
    cli_utils.setup_logging()
    parser = argparse.ArgumentParser()
    parser.add_argument("term_method", default='juju', nargs='?')
    skip_applications = ['neutron-gateway', 'mongodb',
                         'heat', 'rabbitmq-server']
    princ_applications = mojo_utils.get_principle_applications()
    applications = [item for item in princ_applications
                    if item not in skip_applications]
    for svc in applications:
        doomed_application = applications.pop(0)
        mojo_utils.delete_juju_leader(doomed_application)
        mojo_utils.juju_check_hooks_complete()
        mojo_utils.juju_wait_finished()
        check_cluster_status(doomed_application)
        mojo_utils.add_unit(doomed_application, unit_num=1)
        mojo_utils.juju_wait_finished()
        mojo_utils.juju_check_hooks_complete()
        check_crm_status(doomed_application)
def main(argv):
    cli_utils.setup_logging()
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--target_release",
        default='auto', help="Openstack release name to upgrade to or 'auto' "
                             "to have script upgrade based on the lowest value"
                             "across all services")
    options = parser.parse_args()
    target_release = cli_utils.parse_arg(options, 'target_release')
    principle_services = mojo_utils.get_principle_applications()
    current_versions = openstack_utils.get_current_os_versions(
        principle_services)
    if target_release == 'auto':
        # If in auto mode find the lowest value openstack release across all
        # services and make sure all servcies are upgraded to one release
        # higher than the lowest
        lowest_release = mojo_os_utils.get_lowest_os_version(current_versions)
        target_release = mojo_os_utils.next_release(lowest_release)[1]
    # Get a list of services that need upgrading
    needs_upgrade = get_upgrade_targets(target_release, current_versions)
    add_new_charms(target_release)
    mojo_utils.juju_wait_finished()
    for application in openstack_utils.UPGRADE_SERVICES:
        if application['name'] not in principle_services:
            continue
        if application['name'] not in needs_upgrade:
            logging.info('Not upgrading {} it is at {} or higher'.format(
                application['name'],
                target_release)
            )
            continue
        logging.info('Upgrading {} to {}'.format(application['name'],
                                                 target_release))
        # Update required relations
        update_relations(application['name'], target_release)
        ubuntu_version = mojo_utils.get_ubuntu_version(application['name'])
        config = {application['type']['origin_setting']:
                  "cloud:{}-{}/proposed"
                  .format(ubuntu_version, target_release)}
        model.set_application_config(application['name'], config)
        mojo_utils.juju_wait_finished()