def upgrade_charm():
    if is_leader():
        utils.update_service_ips()
    # apply information to base charms
    _notify_nova()
    _notify_neutron()
    _notify_heat()
    _notify_controller()
def upgrade_charm():
    _rebuild_config_from_controller_relation()
    config.save()
    utils.write_configs()
    _update_status()

    if is_leader():
        utils.update_service_ips()
    # apply information to base charms
    _notify_nova()
    _notify_neutron()
    _notify_heat()
    _notify_controller()
Exemplo n.º 3
0
def contrail_controller_changed():
    data = relation_get()

    def _update_config(key, data_key):
        if data_key in data:
            val = data[data_key]
            if val is not None:
                config[key] = val
            else:
                config.pop(key, None)

    _update_config("auth_info", "auth-info")
    _update_config("ssl_ca", "ssl-ca")
    _update_config("api_vip", "api-vip")
    _update_config("api_ip", "private-address")
    _update_config("api_port", "port")
    config.save()
    write_configs()

    status_set("active", "Unit is ready")

    # auth_info can affect endpoints
    changed = update_service_ips()
    if changed and is_leader():
        data = _get_orchestrator_info()
        for rid in relation_ids("contrail-controller"):
            relation_set(relation_id=rid, **data)
def update_status():
    # TODO: try to deploy openstack code again if it was not done

    if not is_leader():
        return
    changed = utils.update_service_ips()
    if changed:
        _notify_controller()
def contrail_controller_changed():
    _rebuild_config_from_controller_relation()
    config.save()
    utils.write_configs()
    _update_status()

    # apply information to base charms
    _notify_nova()
    _notify_neutron()
    _notify_heat()

    # auth_info can affect endpoints
    if is_leader() and utils.update_service_ips():
        _notify_controller()
def contrail_controller_changed():
    data = relation_get()

    def _update_config(key, data_key):
        if data_key in data:
            val = data[data_key]
            if val is not None:
                config[key] = val
            else:
                config.pop(key, None)
        else:
            config.pop(key, None)

    _update_config("auth_info", "auth-info")
    _update_config("auth_mode", "auth-mode")
    _update_config("controller_ips", "controller_ips")

    info = data.get("agents-info")
    if not info:
        config["dpdk"] = False
        log("DPDK for current host is False. agents-info is not provided.")
    else:
        ip = unit_private_ip()
        value = json.loads(info).get(ip, False)
        if not isinstance(value, bool):
            value = yaml.load(value)
        config["dpdk"] = value
        log("DPDK for host {ip} is {dpdk}".format(ip=ip, dpdk=value))

    config.save()
    utils.write_configs()

    # apply information to base charms
    _notify_nova()
    _notify_neutron()
    _notify_heat()

    status_set("active", "Unit is ready")

    # auth_info can affect endpoints
    if is_leader():
        changed = utils.update_service_ips()
        if changed:
            _notify_controller()
def update_status():
    if not is_leader():
        return
    changed = update_service_ips()
    if changed:
        _notify_controller()
def leader_elected():
    utils.update_service_ips()
    _configure_metadata_shared_secret()
    _notify_nova()
    _notify_controller()
def update_status():
    # TODO: try to deploy openstack code again if it was not done
    # update_service_ips can be called only on leader. notify controller only if something was updated
    if is_leader() and utils.update_service_ips():
        _notify_controller()