Exemple #1
0
def setup_env(args):
    """Setup environment"""
    print("Loading configuration for synnefo...")

    conf = Conf(args)
    env.env = Env(conf)

    env.local = args.autoconf
    env.key_inject = args.key_inject
    env.password = env.env.password
    env.user = env.env.user
    env.shell = "/bin/bash -c"
    env.key_filename = args.ssh_key

    if args.disable_colors:
        disable_color()

    if env.env.cms.hostname in \
            [env.env.accounts.hostname, env.env.cyclades.hostname,
             env.env.pithos.hostname]:
        env.cms_pass = True
    else:
        env.cms_pass = False

    if env.env.accounts.hostname in \
            [env.env.cyclades.hostname, env.env.pithos.hostname]:
        env.csrf_disable = True
    else:
        env.csrf_disable = False

    env.roledefs = {
        "nodes": env.env.ips,
        "ips": env.env.ips,
        "accounts": [env.env.accounts.ip],
        "cyclades": [env.env.cyclades.ip],
        "pithos": [env.env.pithos.ip],
        "cms": [env.env.cms.ip],
        "mq": [env.env.mq.ip],
        "db": [env.env.db.ip],
        "mq": [env.env.mq.ip],
        "db": [env.env.db.ip],
        "ns": [env.env.ns.ip],
        "client": [env.env.client.ip],
        "router": [env.env.router.ip],
        "stats": [env.env.stats.ip],
    }

    env.enable_lvm = False
    env.enable_drbd = False
    if ast.literal_eval(env.env.create_extra_disk) and env.env.extra_disk:
        env.enable_lvm = True
        env.enable_drbd = True

    env.roledefs.update({
        "ganeti": env.env.cluster_ips,
        "master": [env.env.master.ip],
    })
Exemple #2
0
def setup_env(args):
    """Setup environment"""
    print("Loading configuration for synnefo...")

    conf = Conf(args)
    env.env = Env(conf)

    env.local = args.autoconf
    env.key_inject = args.key_inject
    env.password = env.env.password
    env.user = env.env.user
    env.shell = "/bin/bash -c"
    env.key_filename = args.ssh_key

    if args.disable_colors:
        disable_color()

    if env.env.cms.hostname in \
            [env.env.accounts.hostname, env.env.cyclades.hostname,
             env.env.pithos.hostname]:
        env.cms_pass = True
    else:
        env.cms_pass = False

    if env.env.accounts.hostname in \
            [env.env.cyclades.hostname, env.env.pithos.hostname]:
        env.csrf_disable = True
    else:
        env.csrf_disable = False

    env.roledefs = {
        "nodes": env.env.ips,
        "ips": env.env.ips,
        "accounts": [env.env.accounts.ip],
        "cyclades": [env.env.cyclades.ip],
        "pithos": [env.env.pithos.ip],
        "cms": [env.env.cms.ip],
        "mq": [env.env.mq.ip],
        "db": [env.env.db.ip],
        "mq": [env.env.mq.ip],
        "db": [env.env.db.ip],
        "ns": [env.env.ns.ip],
        "client": [env.env.client.ip],
        "router": [env.env.router.ip],
        "stats": [env.env.stats.ip],
    }

    env.enable_lvm = False
    env.enable_drbd = False
    if ast.literal_eval(env.env.create_extra_disk) and env.env.extra_disk:
        env.enable_lvm = True
        env.enable_drbd = True

    env.roledefs.update({
        "ganeti": env.env.cluster_ips,
        "master": [env.env.master.ip],
    })
Exemple #3
0
def init(args):
    config.confdir = args.confdir
    config.autoconf = args.autoconf
    # Import all .conf files
    for f in CONF_FILES:
        setattr(config, f, _read_config(f))

    # This is done here in order to have easy access
    # to configuration options
    evaluate(config, **config.deploy.defaults())
    evaluate(config, **config.vcluster.defaults())
    evaluate(config, **config.synnefo.defaults())

    # Override conf file settings if
    # --templates-dir and --state-dir args are passed
    if args.template_dir:
        config.template_dir = args.template_dir
    if args.state_dir:
        config.state_dir = args.state_dir

    config.dry_run = args.dry_run
    config.force = args.force
    config.ssh_key = args.ssh_key
    config.mem = args.mem
    config.vnc = args.vnc
    config.smp = args.smp
    config.passgen = args.passgen

    config.jsonfile = "/tmp/service.json"
    config.ganeti_dir = os.path.join(config.shared_dir, "ganeti")
    config.images_dir = os.path.join(config.shared_dir, "images")
    config.archip_dir = os.path.join(config.shared_dir, "archip")
    config.src_dir = os.path.join(config.shared_dir, "src")

    # debian_base_url is given in config
    # Here we set some config vars that will be frequently used
    config.debian_base_name = "debian_base.diskdump"
    config.debian_base_image = os.path.join(config.images_dir,
                                            config.debian_base_name)

    if args.disable_colors:
        disable_color()

    config.testing_vm = getbool(config.testing_vm)
    config.use_local_packages = getbool(config.use_local_packages)

    config.net = ipaddr.IPNetwork(config.subnet)
    config.all_nodes = config.nodes.sections()
    config.all_ips = [get_node_info(node).ip
                      for node in config.all_nodes]
Exemple #4
0
def init(args):
    config.confdir = args.confdir
    config.autoconf = args.autoconf
    # Import all .conf files
    for f in CONF_FILES:
        setattr(config, f, _read_config(f))

    # This is done here in order to have easy access
    # to configuration options
    evaluate(config, **config.deploy.defaults())
    evaluate(config, **config.vcluster.defaults())
    evaluate(config, **config.synnefo.defaults())

    # Override conf file settings if
    # --templates-dir and --state-dir args are passed
    if args.template_dir:
        config.template_dir = args.template_dir
    if args.state_dir:
        config.state_dir = args.state_dir

    config.dry_run = args.dry_run
    config.force = args.force
    config.ssh_key = args.ssh_key
    config.mem = args.mem
    config.vnc = args.vnc
    config.smp = args.smp
    config.passgen = args.passgen

    config.jsonfile = "/tmp/service.json"
    config.ganeti_dir = os.path.join(config.shared_dir, "ganeti")
    config.images_dir = os.path.join(config.shared_dir, "images")
    config.archip_dir = os.path.join(config.shared_dir, "archip")
    config.src_dir = os.path.join(config.shared_dir, "src")

    # debian_base_url is given in config
    # Here we set some config vars that will be frequently used
    config.debian_base_name = "debian_base.diskdump"
    config.debian_base_image = os.path.join(config.images_dir,
                                            config.debian_base_name)

    if args.disable_colors:
        disable_color()

    config.testing_vm = getbool(config.testing_vm)
    config.use_local_packages = getbool(config.use_local_packages)

    config.net = ipaddr.IPNetwork(config.subnet)
    config.all_nodes = config.nodes.sections()
    config.all_ips = [get_node_info(node).ip for node in config.all_nodes]
Exemple #5
0
def setup_env(
    confdir="conf",
    packages="packages",
    templates="files",
    cluster_name="ganeti1",
    autoconf=False,
    disable_colors=False,
    key_inject=False,
):
    """Setup environment"""
    print("Loading configuration for synnefo...")
    print(" * Using config files under %s..." % confdir)
    print(" * Using %s and %s for packages and templates accordingly..." % (packages, templates))

    autoconf = ast.literal_eval(autoconf)
    disable_colors = ast.literal_eval(disable_colors)
    env.key_inject = ast.literal_eval(key_inject)
    conf = Conf.configure(confdir=confdir, cluster_name=cluster_name, autoconf=autoconf)
    env.env = Env(conf)

    env.local = autoconf
    env.password = env.env.password
    env.user = env.env.user
    env.shell = "/bin/bash -c"

    if disable_colors:
        disable_color()

    if env.env.cms.hostname in [env.env.accounts.hostname, env.env.cyclades.hostname, env.env.pithos.hostname]:
        env.cms_pass = True
    else:
        env.cms_pass = False

    if env.env.accounts.hostname in [env.env.cyclades.hostname, env.env.pithos.hostname]:
        env.csrf_disable = True
    else:
        env.csrf_disable = False

    env.roledefs = {
        "nodes": env.env.ips,
        "ips": env.env.ips,
        "accounts": [env.env.accounts.ip],
        "cyclades": [env.env.cyclades.ip],
        "pithos": [env.env.pithos.ip],
        "cms": [env.env.cms.ip],
        "mq": [env.env.mq.ip],
        "db": [env.env.db.ip],
        "mq": [env.env.mq.ip],
        "db": [env.env.db.ip],
        "ns": [env.env.ns.ip],
        "client": [env.env.client.ip],
        "router": [env.env.router.ip],
    }

    env.enable_lvm = False
    env.enable_drbd = False
    if ast.literal_eval(env.env.create_extra_disk) and env.env.extra_disk:
        env.enable_lvm = True
        env.enable_drbd = True

    env.roledefs.update({"ganeti": env.env.cluster_ips, "master": [env.env.master.ip]})