# HG changeset patch # User igor # Date 1190983191 -10800 # Node ID afe3c0992ec3c71e50c745da4f2d3453a5285a39 # Parent d6f7c53b085d2a05a91c6e43512735276d074af5 fixes related to topology file format diff -r d6f7c53b085d -r afe3c0992ec3 xen-drbd-install.py --- a/xen-drbd-install.py Thu Sep 27 23:27:58 2007 +0300 +++ b/xen-drbd-install.py Fri Sep 28 15:39:51 2007 +0300 @@ -4,139 +4,151 @@ network=sys.argv[1] try: - exec 'from %s import domains,disk_table,lvm_vg_name,node1,node1_ip,node2,node2_ip, \ - ip_network, domain_name, ip_nameserver, ip_gateway, apt_get_install, \ - debian_release, debian_mirror, \ - bridges, vlans, management_vlan, trunk, management_ip, management_gw ' % (network) + exec 'from %s import domains,disk_table,lvm_vg_name,node1,node1_ip,node2,node2_ip, \ + ip_network, domain_name, ip_nameserver, ip_gateway, apt_get_install, \ + debian_release, debian_mirror, \ + bridges, vlans, management_vlan, trunk, management_ip, management_gw ' % (network) except: - print "Can't find or interpret module %s with topology description" %(network) - sys.exit(1) + print "Can't find or interpret module %s with topology description" %(network) + sys.exit(1) drbd_base_port=7790 meta_disk='/dev/%s/meta'%lvm_vg_name -drbd_devices=[] +drbd_device={} -def make_lvm(do_print=1): - if do_print: - print "lvcreate -L %s -n %s /dev/%s" % ("10G", "meta", lvm_vg_name) - for dom in domains: - for disk in disk_table[dom]: - if disk.find(":") == -1: - if do_print: - print "lvcreate -L %s -n %s /dev/%s" % (disk, dom, lvm_vg_name) - drbd_devices.append([dom, "/dev/%s/%s" % (lvm_vg_name, dom)]) - else: - if do_print: - print "lvcreate -L %s -n %s /dev/%s" % (disk.split(':')[1], disk.split(':')[0], lvm_vg_name) - drbd_devices.append([disk.split(':')[0], "/dev/%s/%s" % (lvm_vg_name, disk.split(':')[0])]) +def make_drbd_hash(): + for dom in domains: + for disk in disk_table[dom]: + if disk.find(":") == -1: + drbd_device[disk]=dom + else: + drbd_device[disk.split(':')[0]]=disk.split(':')[1] + +def make_lvm(): + if do_print: + print "lvcreate -L %s -n %s /dev/%s" % ("10G", "meta", lvm_vg_name) + for dom in domains: + for disk in disk_table[dom]: + if disk.find(":") == -1: + #if do_print: + # print "lvcreate -L %s -n %s /dev/%s" % (disk, dom, lvm_vg_name) + #drbd_devices.append([dom, "/dev/%s/%s" % (lvm_vg_name, dom)]) + drbd_device[disk]=dom + else: + drbd_device[disk.split(':')[0]]=disk.split(':')[0] + if do_print: + print "lvcreate -L %s -n %s /dev/%s" % (disk.split(':')[1], disk.split(':')[0], lvm_vg_name) + drbd_devices.append([disk.split(':')[0], "/dev/%s/%s" % (lvm_vg_name, disk.split(':')[0])]) def make_drbdconf(): - print "cat < /etc/drbd.conf" - i=0 - for drbd in drbd_devices: - resource=drbd[0] - disk=drbd[1] - drbd_number=i - i+=1 - print """ + print "cat < /etc/drbd.conf" + i=0 + for drbd in drbd_devices: + resource=drbd[0] + disk=drbd[1] + drbd_number=i + i+=1 + print """ resource %s { - protocol C; - net { - allow-two-primaries; - after-sb-0pri discard-least-changes; - after-sb-1pri call-pri-lost-after-sb; - after-sb-2pri call-pri-lost-after-sb; - } - syncer { - rate 5M; - } - on %s - { - device /dev/drbd%s; - disk %s; - address %s:%s; - meta-disk %s[%s]; - } - on %s - { - device /dev/drbd%s; - disk %s; - address %s:%s; - meta-disk %s[%s]; - } + protocol C; + net { + allow-two-primaries; + after-sb-0pri discard-least-changes; + after-sb-1pri call-pri-lost-after-sb; + after-sb-2pri call-pri-lost-after-sb; + } + syncer { + rate 5M; + } + on %s + { + device /dev/drbd%s; + disk %s; + address %s:%s; + meta-disk %s[%s]; + } + on %s + { + device /dev/drbd%s; + disk %s; + address %s:%s; + meta-disk %s[%s]; + } } """ % (resource, node1, drbd_number, disk, node1_ip, i+drbd_base_port, meta_disk, drbd_number, node2, drbd_number, disk, node2_ip, i+drbd_base_port, meta_disk, drbd_number ) - print "DRBD" + print "DRBD" -def make_drbd_links(): - make_lvm(0) - print "mkdir -p /dev/drbd" - i=0 - for drbd in drbd_devices: - drbd_number=i - i+=1 - resource=drbd[0] - disk=drbd[1] - print "ln -sf /dev/drbd%s /dev/drbd/%s" %(drbd_number, resource) +def make_links(): + + + # drbd_devices={ + # 'dev' : 'resource', + # } + + make_drbd_hash() + print "mkdir -p /dev/drbd" + for dev in drbd_device.keys(): + resource=drbd_device[dev] + print "ln -sf /dev/%s /dev/drbd/%s" %(dev, resource) def make_fs(): - for dom in domains: - print "mkfs.ext3 /dev/drbd/"+dom + for dom in domains: + print "mkfs.ext3 /dev/drbd/"+dom def make_mount(): - print "mkdir -p /domU" - for dom in domains: - print "mkdir -p /domU/%s" % (dom) - print "mount /dev/drbd/%s /domU/%s" % (dom,dom) + print "mkdir -p /domU" + for dom in domains: + print "mkdir -p /domU/%s" % (dom) + print "mount /dev/drbd/%s /domU/%s" % (dom,dom) def make_umount(): - for dom in domains: - print "umount /domU/%s" % (dom) + for dom in domains: + print "umount /domU/%s" % (dom) def make_dns(): - i=1 - for dom in domains: - print "%s A %s.%s" % (dom, ip_network, i) - i+=1 + i=1 + for dom in domains: + print "%s A %s.%s" % (dom, ip_network, i) + i+=1 def make_dns_reverse(): - i=1 - for dom in domains: - print "%s A %s.%s." % (i, dom, domain_name) - i+=1 + i=1 + for dom in domains: + print "%s A %s.%s." % (i, dom, domain_name) + i+=1 def make_install_debian(): - print """ + print """ debootstrap %s /domU/%s %s chroot /domU/%s apt-get install -y --force-yes %s - """ % (debian_release,domains[0],debian_mirror,domains[0],apt_get_install) + """ % (debian_release,domains[0],debian_mirror,domains[0],apt_get_install) def make_rsync(): - for dom in domains[1:]: - print """ + for dom in domains[1:]: + print """ rsync -a /domU/%s/ /domU/%s/ - """ % (domains[0], dom) + """ % (domains[0], dom) def make_etcfstab(): - i=0 - for dom in domains: - i+=1 - print """ + i=0 + for dom in domains: + i+=1 + print """ cat < /domU/%s/etc/fstab proc /proc proc defaults 0 0 /dev/hda1 / ext3 defaults,errors=remount-ro 0 1 FSTAB - """ % (dom) + """ % (dom) def make_etcnetworkinterfaces(): - i=0 - for dom in domains: - i+=1 - print """ + i=0 + for dom in domains: + i+=1 + print """ cat < /domU/%s/etc/network/interfaces auto lo eth0 iface lo inet loopback @@ -150,31 +162,31 @@ dns-nameservers %s dns-search %s INTERFACES - """ % (dom,ip_network,i,ip_network, ip_network, ip_gateway, domain_name, ip_nameserver) + """ % (dom,ip_network,i,ip_network, ip_network, ip_gateway, domain_name, ip_nameserver) def make_etcresolvconf(): - for dom in domains: - print """ + for dom in domains: + print """ cat < /domU/%s/etc/resolv.conf search %s nameserver %s RESOLVCONF - """ % (dom,domain_name,ip_nameserver) + """ % (dom,domain_name,ip_nameserver) def make_etchostname(): - for dom in domains: - print """ + for dom in domains: + print """ cat < /domU/%s/etc/hostname %s HOSTNAME - """ % (dom,dom) + """ % (dom,dom) def make_etchosts(): - i=0 - for dom in domains: - i+=1 - print """ + i=0 + for dom in domains: + i+=1 + print """ cat < /domU/%s/etc/hosts 127.0.0.1 localhost 192.168.1.%s %s.%s %s @@ -186,88 +198,100 @@ ff02::2 ip6-allrouters ff02::3 ip6-allhosts HOSTS - """ % (dom,i,dom,domain_name,dom) + """ % (dom,i,dom,domain_name,dom) def make_rootssh(): - for dom in domains: - print """ + for dom in domains: + print """ mkdir -p /domU/%s/root/.ssh/ cp ~/.ssh/id_dsa.pub /domU/%s/root/.ssh/authorized_keys chmod 600 /domU/%s/root/.ssh/authorized_keys - """ % (dom,dom,dom) + """ % (dom,dom,dom) def make_l3rc(): - for dom in domains: - print """ - cat < /domU/%s/root/.l3rc + for dom in domains: + print """ + cat < /domU/%s/root/.l3rc l3cd=/users/igor/xen-drbd-dom0-setup/%s.%s/root EOF - """ % (dom,dom,domain_name) + """ % (dom,dom,domain_name) def make_etc(): - make_etcfstab() - make_etcnetworkinterfaces() - make_etcresolvconf() - make_etchosts() - make_etchostname() - make_rootssh() - make_l3rc() + make_etcfstab() + make_etcnetworkinterfaces() + make_etcresolvconf() + make_etchosts() + make_etchostname() + make_rootssh() + make_l3rc() def make_all_system(): - make_drbd_links() - make_fs() - make_mount() - make_install_debian() - make_rsync() - make_etc() - make_umount() + make_drbd_links() + make_fs() + make_mount() + make_install_debian() + make_rsync() + make_etc() + make_umount() def get_management_ip(): - return management_ip + return management_ip def get_default_gateway(): - return management_gw + return management_gw def make_bridges(): - ip=get_management_ip() - gw=get_default_gateway() - print "ifconfig %s 0.0.0.0" % (trunk) - for bridge in bridges: - vlan=vlans[bridges.index(bridge)] - print "vconfig add %s %s" % (trunk,vlan) - print "/etc/xen/scripts/network-bridge start vifnum=%s bridge=%s netdev=%s.%s" % (bridges.index(bridge)+2,bridge,trunk,vlan) - print "ifconfig %s.%s %s" % (trunk,management_vlan,management_ip) - if management_gw: - print "route add default gw %s" % (management_gw) + ip=get_management_ip() + gw=get_default_gateway() + print "ifconfig %s 0.0.0.0" % (trunk) + + # tagged interfaces + for bridge in bridges: + vlan=vlans[bridges.index(bridge)] + if vlan == 'tagged': + print "/etc/xen/scripts/network-bridge start vifnum=%s bridge=%s netdev=%s" % (bridges.index(bridge)+2,bridge,trunk) + print "ip link set %s up" % (trunk) + + # untagged interfaces + for bridge in bridges: + vlan=vlans[bridges.index(bridge)] + if vlan != 'tagged': + print "vconfig add %s %s" % (trunk,vlan) + print "/etc/xen/scripts/network-bridge start vifnum=%s bridge=%s netdev=%s.%s" % (bridges.index(bridge)+2,bridge,trunk,vlan) + print "ip link set %s.%s up" % (trunk,vlan) + + print "ifconfig %s.%s %s" % (trunk,management_vlan,management_ip) + if management_gw: + print "route add default gw %s" % (management_gw) def show_usage(): - print """ + print """ Usage: - xen-drbd-install (to view) - xen-drbd-install | sh -s (to run) + xen-drbd-install (to view) + xen-drbd-install | sh -s (to run) - is a name of the file, which contains network description + is a name of the file, which contains network description Commands: - make-all - make-bridges - make-links + make-all + make-bridges + make-links """ #make_all_system() if len(sys.argv) > 1: - command = sys.argv[2] - if command == 'make-all': - make_all_system() - if command == 'make-bridges': - make_bridges() - elif command == 'make-links': - make_drbd_links() - else: - show_usage() + command = sys.argv[2] + if command == 'make-all': + make_all_system() + if command == 'make-bridges': + make_bridges() + elif command == 'make-links': + make_links() + else: + show_usage() else: - show_usage() + show_usage() diff -r d6f7c53b085d -r afe3c0992ec3 xen-drbd.py --- a/xen-drbd.py Thu Sep 27 23:27:58 2007 +0300 +++ b/xen-drbd.py Fri Sep 28 15:39:51 2007 +0300 @@ -2,7 +2,7 @@ network='eb' -import sys,os +import sys,os,imp from commands import mkarg @@ -13,226 +13,248 @@ print "Can't find or interpret module %s with topology description" %(network) sys.exit(1) -domain_create_line="xm create xen-drbd-start network="+network+" domain=%s" +xen_drbd_start="xen-drbd-start.py" +domain_create_line="xm create "+xen_drbd_start+" network="+network+" domain=%s" def the_peer_of(node): - if node == node1: - another_node=node2 - else: - another_node=node1 - return another_node + if node == node1: + another_node=node2 + else: + another_node=node1 + return another_node he_is=the_peer_of(i_am) def log_error(error): - print error + print error def run_now(command,node=i_am): - if node == i_am: - line=command+" > /dev/stderr" - else: - line="ssh %s %s < /dev/null > /dev/stderr" % (node,mkarg(command)) - (p, child_stdout, child_stderr) = os.popen3(line) - output = child_stderr.read() - #p = os.popen(line) - #output = p.read() - p.close() - return output + if node == i_am: + line=command+" > /dev/stderr" + else: + line="ssh %s %s < /dev/null > /dev/stderr" % (node,mkarg(command)) + (p, child_stdout, child_stderr) = os.popen3(line) + output = child_stderr.read() + #p = os.popen(line) + #output = p.read() + p.close() + return output def run(command,node=i_am): - run_now(command,node) -# if node == i_am: -# print command -# else: -# print "ssh %s %s < /dev/null > /dev/stderr" % (node,mkarg(command)) + run_now(command,node) +# if node == i_am: +# print command +# else: +# print "ssh %s %s < /dev/null > /dev/stderr" % (node,mkarg(command)) def get_drbd_resources(domain): - disk=[] - for disk_description in disk_table[domain]: - if disk_description.find(":") == -1: - disk.append(domain) - else: - disk.append((disk_description.split(':'))[0]) - return disk - + disk=[] + for disk_description in disk_table[domain]: + if disk_description.find(":") == -1: + disk.append(domain) + else: + disk.append((disk_description.split(':'))[0]) + return disk + def set_drbd_primary(domain, node=i_am): - drbd_resources=get_drbd_resources(domain) - for drbd in drbd_resources: - run("drbdadm primary %s"%(drbd),node) + drbd_resources=get_drbd_resources(domain) + for drbd in drbd_resources: + run("drbdadm primary %s"%(drbd),node) def set_drbd_secondary(domain, node=i_am): - drbd_resources=get_drbd_resources(domain) - for drbd in drbd_resources: - run("drbdadm secondary %s"%(drbd),node) + drbd_resources=get_drbd_resources(domain) + for drbd in drbd_resources: + run("drbdadm secondary %s"%(drbd),node) def get_domain_id(domain,node=i_am): - """ - Returns domain id of the or -1 if the is not running on the - """ - res=run_now("xm list | awk '{if ($1 == \"'%s'\") print $2}'" % domain, node).rstrip("\n") - if not res: - res = -1 - else: - res = int(res) - return res + """ + Returns domain id of the or -1 if the is not running on the + """ + res=run_now("xm list | awk '{if ($1 == \"'%s'\") print $2}'" % domain, node).rstrip("\n") + if not res: + res = -1 + else: + res = int(res) + return res def get_drbd_id(resource,node=i_am): - res=run_now("ls -l /dev/drbd/%s 2> /dev/null | awk '{print $10}' | sed s@/dev/drbd@@" %resource, node).rstrip("\n") - if not res: - res = -1 - else: - res = int(res) - return res + res=run_now("ls -l /dev/drbd/%s 2> /dev/null | awk '{print $10}' | sed s@/dev/drbd@@" %resource, node).rstrip("\n") + if not res: + res = -1 + else: + res = int(res) + return res def get_drbd_state(resource,node=i_am): - res=run_now("drbdadm state %s | sed s@/.*@@" %resource, node).rstrip("\n") - if not res: - res = -1 - return res + res=run_now("drbdadm state %s | sed s@/.*@@" %resource, node).rstrip("\n") + if not res: + res = -1 + return res def get_drbd_cstate(resource,node=i_am): - res=run_now("drbdadm cstate %s " %resource, node).rstrip("\n") - if not res: - res = -1 - return res - + res=run_now("drbdadm cstate %s " %resource, node).rstrip("\n") + if not res: + res = -1 + return res def start_domain(domain,node=i_am): - if (get_domain_id(domain,i_am) != -1): - log_error("Domain %s is running already on the node %s" % (domain,i_am)) - return -1 - if (get_domain_id(domain,he_is) != -1): - log_error("Domain %s is running already on the node %s" % (domain,he_is)) - return -1 - another_node=the_peer_of(node) - set_drbd_secondary(domain,another_node) - set_drbd_primary(domain,node) - run(domain_create_line % domain) + if (get_domain_id(domain,i_am) != -1): + log_error("Domain %s is running already on the node %s" % (domain,i_am)) + return -1 + if (get_domain_id(domain,he_is) != -1): + log_error("Domain %s is running already on the node %s" % (domain,he_is)) + return -1 + another_node=the_peer_of(node) + set_drbd_secondary(domain,another_node) + set_drbd_primary(domain,node) + run(domain_create_line % domain) def migrate_domain_out(domain,node=i_am): - if (get_domain_id(domain,node) == -1): - log_error("Domain %s is not running on the node %s" % (domain,node)) - return -1 - another_node=the_peer_of(node) - print "Migrating the domain <%s> from the node <%s> to the node <%s>" % (domain, node, another_node) - set_drbd_primary(domain,another_node) - run("xm migrate %s %s --live" % (domain,another_node),node) - run("sleep 2") - set_drbd_secondary(domain,node) - print "+ Done" - + if (get_domain_id(domain,node) == -1): + log_error("Domain %s is not running on the node %s" % (domain,node)) + return -1 + another_node=the_peer_of(node) + print "Migrating the domain <%s> from the node <%s> to the node <%s>" % (domain, node, another_node) + set_drbd_primary(domain,another_node) + run("xm migrate %s %s --live" % (domain,another_node),node) + run("sleep 2") + set_drbd_secondary(domain,node) + print "+ Done" + def migrate_domain_in(domain,node=i_am): - migrate_domain_out(domain,the_peer_of(node)) + migrate_domain_out(domain,the_peer_of(node)) def migrate_domain(domain,node): - migrate_domain_in(domain,node) + migrate_domain_in(domain,node) def running_domains(node=i_am): - xm_domains=run_now("xm list | awk '{print $1}'", node).split("\n") - return filter(lambda x: x in xm_domains, domains) + xm_domains=run_now("xm list | awk '{print $1}'", node).split("\n") + return filter(lambda x: x in xm_domains, domains) def migrate_all_out(node=i_am): - for domain in running_domains(node): - migrate_domain_out(domain,node) + for domain in running_domains(node): + migrate_domain_out(domain,node) def migrate_all_in(node=i_am): - for domain in running_domains(the_peer_of(node)): - migrate_domain_in(domain,node) + for domain in running_domains(the_peer_of(node)): + migrate_domain_in(domain,node) def start_all(node=i_am): - for domain in domains: - if not domain in running_domains(node) and not domain in running_domains(the_peer_of(node)): - start_domain(domain,node) + for domain in domains: + if not domain in running_domains(node) and not domain in running_domains(the_peer_of(node)): + start_domain(domain,node) def start_my_domains(node=i_am): - for domain in domain_home[node]: - if not domain in running_domains(node) and not domain in running_domains(the_peer_of(node)): - start_domain(domain,node) + for domain in domain_home[node]: + if not domain in running_domains(node) and not domain in running_domains(the_peer_of(node)): + start_domain(domain,node) def migrate_my_domains_home(node=i_am): - for domain in domain_home[node]: - if not domain in running_domains(node) and domain in running_domains(the_peer_of(node)): - migrate_domain_in(domain,node) - + for domain in domain_home[node]: + if not domain in running_domains(node) and domain in running_domains(the_peer_of(node)): + migrate_domain_in(domain,node) + def migrate_and_start_all(node=i_am): - migrate_my_domains_home(node) - start_my_domains(node) + migrate_my_domains_home(node) + start_my_domains(node) + +def do_import(name, source): + module = imp.new_module(name) + sys.modules[name] = module + exec source in vars(module) + return module + +def load_file(file): + f=open(file) + result=f.read() + return result + +def dump_config(domain): + xen_domain=load_file(xen_drbd_start) + xen_domain="domain=\"%s\"\n" % (domain) + xen_domain + xen_domain="network=\"%s\"\n" % (network) + xen_domain + do_import('xen_domain_module',xen_domain) + import xen_domain_module + xen_domain_module.print_config() def show_usage(): - print """ + print """ Usage: - xen-drbd command [domain] + xen-drbd command [domain] Commands: - start domain - start-all - start-my-domains + start domain + start-all + start-my-domains - migrate-out domain - migrate-in domain - migrate-all-out - migrate-all-in - migrate-my-domains-home + migrate-out domain + migrate-in domain + migrate-all-out + migrate-all-in + migrate-my-domains-home + migrate-and-start-all - migrate-and-start-all - """ + dump-config domain + """ def test(): - print "get_drbd_resources(samba)=",get_drbd_resources("samba") - print "get_domain_id(Domain-0)=",get_domain_id("Domain-0") - print "get_domain_id(samba)=",get_domain_id("samba") - print "get_drbd_id(samba)=",get_drbd_id("samba") - print "get_drbd_id(samba, he_is)=",get_drbd_id("samba",he_is) - print "get_drbd_id(unknown_resource, he_is)=",get_drbd_id("unknown_resource",he_is) - print "get_drbd_state(samba, he_is)=",get_drbd_state("samba") - print "get_drbd_state(samba, he_is)=",get_drbd_state("samba",he_is) - print "get_drbd_cstate(samba)=",get_drbd_cstate("samba") - print "get_drbd_cstate(samba, he_is)=",get_drbd_cstate("samba",he_is) - print "start_domain(samba)" - start_domain("samba") - print "migrate_domain_out(samba)" - migrate_domain_in("samba") + print "get_drbd_resources(samba)=",get_drbd_resources("samba") + print "get_domain_id(Domain-0)=",get_domain_id("Domain-0") + print "get_domain_id(samba)=",get_domain_id("samba") + print "get_drbd_id(samba)=",get_drbd_id("samba") + print "get_drbd_id(samba, he_is)=",get_drbd_id("samba",he_is) + print "get_drbd_id(unknown_resource, he_is)=",get_drbd_id("unknown_resource",he_is) + print "get_drbd_state(samba, he_is)=",get_drbd_state("samba") + print "get_drbd_state(samba, he_is)=",get_drbd_state("samba",he_is) + print "get_drbd_cstate(samba)=",get_drbd_cstate("samba") + print "get_drbd_cstate(samba, he_is)=",get_drbd_cstate("samba",he_is) + print "start_domain(samba)" + start_domain("samba") + print "migrate_domain_out(samba)" + migrate_domain_in("samba") #print "get_domain_id(samba,node2)=",get_domain_id("samba",node2) #sys.exit(0) if len(sys.argv) == 1: - show_usage() - sys.exit(0) + show_usage() + sys.exit(0) command=sys.argv[1] if len(sys.argv) == 3: - domain=sys.argv[2] - if command == 'start': - start_domain(domain) - elif command == 'migrate-out': - migrate_domain_out(domain) - elif command == 'migrate-in': - migrate_domain_in(domain) - else: - show_usage() - sys.exit(0) + domain=sys.argv[2] + if command == 'start': + start_domain(domain) + elif command == 'migrate-out': + migrate_domain_out(domain) + elif command == 'migrate-in': + migrate_domain_in(domain) + elif command == 'dump-config': + dump_config(domain) + else: + show_usage() + sys.exit(0) elif len(sys.argv) == 2: - if command == 'start-all': - start_all() - elif command == 'start-my-domains': - start_my_domains() - elif command == 'migrate-all-out': - migrate_all_out() - elif command == 'migrate-all-in': - migrate_all_in() - elif command == 'migrate-my-domains-home': - migrate_my_domains_home() - elif command == 'migrate-and-start-all': - migrate_and_start_all() - elif command == 'list': - print running_domains() - else: - show_usage() - sys.exit(0) + if command == 'start-all': + start_all() + elif command == 'start-my-domains': + start_my_domains() + elif command == 'migrate-all-out': + migrate_all_out() + elif command == 'migrate-all-in': + migrate_all_in() + elif command == 'migrate-my-domains-home': + migrate_my_domains_home() + elif command == 'migrate-and-start-all': + migrate_and_start_all() + elif command == 'list': + print running_domains() + else: + show_usage() + sys.exit(0)