Пример #1
0
def upload_cfg(redis_shell, dc, access_data):
    ip = access_data['addr'].split(':')[0]
    # DRY: flashlight/genconfig/cloud.yaml.tmpl
    access_data.update(pipeline=True, trusted=True, qos=10, weight=1000000)
    redis_shell.rpush(
        dc + ":srvq",
        "%s|\n    %s" % (ip, yaml.dump({'fallback-' + ip: access_data})))
Пример #2
0
def upload_cfg(redis_shell, dc, access_data):
    ip = access_data['addr'].split(':')[0]
    # DRY: flashlight/genconfig/cloud.yaml.tmpl
    access_data.update(pipeline=True,
                       trusted=True,
                       qos=10,
                       weight=1000000)
    redis_shell.rpush(dc + ":srvq",
                      "%s|\n    %s" % (ip, yaml.dump({'fallback-' + ip: access_data})))
Пример #3
0
def destroy_until_dc(srvq, dc):
    """
    Pop proxies off the server queue, retire them and destroy them, until we
    hit one with the desired DC.

    This is used when we want to quickly start serving a user region from a
    specific datacenter.
    """
    while True:
        entry = redis_shell.rpop(srvq)
        ip, name, cfg = entry.split('|')
        print "popping", name
        next_dc = dc_by_name(name)
        if next_dc == dc:
            print "pushing back", name
            redis_shell.rpush(srvq, entry)
            return
        retire_proxy(name=name, ip=ip, reason="Flushing server queue")
Пример #4
0
def destroy_until_dc(srvq, dc):
    """
    Pop proxies off the server queue, retire them and destroy them, until we
    hit one with the desired DC.

    This is used when we want to quickly start serving a user region from a
    specific datacenter.
    """
    while True:
        entry = redis_shell.rpop(srvq)
        ip, name, cfg = entry.split('|')
        print "popping", name
        next_dc = dc_by_name(name)
        if next_dc == dc:
            print "pushing back", name
            redis_shell.rpush(srvq, entry)
            return
        retire_proxy(name=name, ip=ip, reason="Flushing server queue")
Пример #5
0
def register_vps(redis_shell, dc, name):
    print "Registering VPS", name
    redis_shell.rpush(dc + ':vpss', name)
    redis_shell.incr(dc + ':vpss:version')
Пример #6
0
def register_vps(name):
    print "Registering VPS", name
    redis_shell.rpush(CM + ':vpss', name)
    redis_shell.incr(CM + ':vpss:version')