Beispiel #1
0
def cluster(ctx):
    vms = []
    for node in ctx.all_nodes:
        node_info = config.get_info(node=node)
        vnc = _launch_vm(node_info.name, node_info.mac)
        vms.append((node_info, vnc))

    runcmd("reset")
    for vm, port in vms:
        if port:
            vnc = "vncviewer %s:%s" % (get_netinfo()[0],  5900 + port)
        else:
            vnc = "no vnc"
        print "%s: ssh root@%s or %s" % (vm.name, vm.ip, vnc)
Beispiel #2
0
def cluster(ctx):
    vms = []
    for node in ctx.all_nodes:
        node_info = config.get_info(node=node)
        vnc = _launch_vm(node_info.name, node_info.mac)
        vms.append((node_info, vnc))

    runcmd("reset")
    for vm, port in vms:
        if port:
            vnc = "vncviewer %s:%s" % (get_netinfo()[0], 5900 + port)
        else:
            vnc = "no vnc"
        print "%s: ssh root@%s or %s" % (vm.name, vm.ip, vnc)
Beispiel #3
0
def create_dnsmasq_files(ctx):

    print("Customize dnsmasq..")

    hosts = opts = conf = "\n"
    hostsf = os.path.join(config.dns_dir, "dhcp-hostsfile")
    optsf = os.path.join(config.dns_dir, "dhcp-optsfile")
    conff = os.path.join(config.dns_dir, "conf-file")

    for node in ctx.all_nodes:
        info = config.get_info(node=node)
        if ipaddr.IPAddress(info.ip) not in config.net:
            raise Exception("%s's IP outside vcluster's network." % node)
        # serve ip and name to nodes
        hosts += "%s,%s,%s,2m\n" % (info.mac, info.ip, info.name)

    hosts += "52:54:56:*:*:*,ignore\n"

    opts = """
# Netmask
1,{0}
# Gateway
3,{1}
# Nameservers
6,{2}
""".format(config.net.netmask, config.gateway, constants.EXTERNAL_PUBLIC_DNS)

    conf = """
user=dnsmasq
bogus-priv
no-poll
no-negcache
leasefile-ro
bind-interfaces
except-interface=lo
dhcp-fqdn
no-resolv
# disable DNS
port=0
""".format(ctx.ns.ip)

    conf += """
# serve domain and search domain for resolv.conf
domain={5}
interface={0}
dhcp-hostsfile={1}
dhcp-optsfile={2}
dhcp-range={0},{4},static,2m
""".format(config.bridge, hostsf, optsf, info.domain, config.net.network,
           info.domain)

    if config.dry_run:
        print hostsf, hosts
        print optsf, opts
        print conff, conf
    else:
        hostsfile = open(hostsf, "w")
        optsfile = open(optsf, "w")
        conffile = open(conff, "w")

        hostsfile.write(hosts)
        optsfile.write(opts)
        conffile.write(conf)

        hostsfile.close()
        optsfile.close()
        conffile.close()
Beispiel #4
0
def create_dnsmasq_files(ctx):

    print("Customize dnsmasq..")

    hosts = opts = conf = "\n"
    hostsf = os.path.join(config.dns_dir, "dhcp-hostsfile")
    optsf = os.path.join(config.dns_dir, "dhcp-optsfile")
    conff = os.path.join(config.dns_dir, "conf-file")

    for node in ctx.all_nodes:
        info = config.get_info(node=node)
        if ipaddr.IPAddress(info.ip) not in config.net:
            raise Exception("%s's IP outside vcluster's network." % node)
        # serve ip and name to nodes
        hosts += "%s,%s,%s,2m\n" % (info.mac, info.ip, info.name)

    hosts += "52:54:56:*:*:*,ignore\n"

    opts = """
# Netmask
1,{0}
# Gateway
3,{1}
# Nameservers
6,{2}
""".format(config.net.netmask, config.gateway, constants.EXTERNAL_PUBLIC_DNS)

    conf = """
user=dnsmasq
bogus-priv
no-poll
no-negcache
leasefile-ro
bind-interfaces
except-interface=lo
dhcp-fqdn
no-resolv
# disable DNS
port=0
""".format(ctx.ns.ip)

    conf += """
# serve domain and search domain for resolv.conf
domain={5}
interface={0}
dhcp-hostsfile={1}
dhcp-optsfile={2}
dhcp-range={0},{4},static,2m
""".format(config.bridge, hostsf, optsf,
           info.domain, config.net.network, info.domain)

    if config.dry_run:
        print hostsf, hosts
        print optsf, opts
        print conff, conf
    else:
        hostsfile = open(hostsf, "w")
        optsfile = open(optsf, "w")
        conffile = open(conff, "w")

        hostsfile.write(hosts)
        optsfile.write(opts)
        conffile.write(conf)

        hostsfile.close()
        optsfile.close()
        conffile.close()
Beispiel #5
0
 def cluster_info(self):
     return config.get_info(cluster=self.cluster)
Beispiel #6
0
 def node_info(self):
     return config.get_info(node=self.node)
Beispiel #7
0
 def cluster_info(self):
     return config.get_info(cluster=self.cluster)
Beispiel #8
0
 def node_info(self):
     return config.get_info(node=self.node)