xentaur

view xentaur.py @ 61:6471afbee150

*** empty log message ***
author igor
date Mon Dec 03 08:36:13 2007 +0200 (2007-12-03)
parents e7b9761c03e8
children e838c1223b89
line source
1 #!/usr/bin/python
2 # vim: set fileencoding=utf-8 :
4 import sys,os,time
6 xentaur_path=os.environ['HOME']+"/xentaur"
8 sys.path.append('/etc/xen')
9 sys.path.append(xentaur_path)
11 #network='snrs_ipsec_rsa_1'
12 node_object={}
13 link_object={}
14 bridge_object={}
16 network='mini'
17 domain='dyn1'
18 #network='snrs'
19 #domain='dyn1'
20 from xendomain import *
22 bridges_turned_down=[]
24 from IPython.Shell import IPShellEmbed
27 screenrc=os.environ['HOME']+"/.screenrc_xentaur"
29 def run(program, *args):
30 pid = os.fork()
31 if not pid:
32 os.execvp(program, (program,) + args)
33 return os.wait()[0]
35 def run_command(line):
36 #cmds=line.split()
37 #run(cmds[0],*cmds[1:])
38 run("/bin/sh", "-c", line)
40 def run_command_return_stdout(line):
41 p = os.popen(line)
42 output = p.read()
43 p.close()
44 return output
46 ################################################################################
47 #Xentaur command-line commands
49 ## Start
51 def start_bridges():
52 unbound_bridges=set(bridges)-set(real_bridges)
53 script=""
54 script="\n".join(map(lambda x: "sudo brctl show | awk '{print $1}' | grep -qx "+x+" || sudo brctl addbr "+x, unbound_bridges))
55 script+="\n"+"\n".join(map(lambda x: "sudo brctl stp "+x+" off", unbound_bridges))
56 script+="\n"+"\n".join(map(lambda x: "sudo ip link set "+x+" up", unbound_bridges))
58 print """#!/bin/sh
59 # create unbound bridges
60 %s
61 """ % (script)
63 def start_domain(domain):
64 print "sudo xm create "+xentaur_path+"/xendomain.py "+" domain="+domain+" network="+network+" && sleep 1 && sudo xm sched-credit -d $(sudo xm list | grep "+domain+" | awk '{print $2}') -c 10 && sleep 1"
66 def start_domains(doms=domains):
67 for domain in doms:
68 if not domain in real_nodes:
69 start_domain(domain)
71 def start_all():
72 graph()
73 screen()
74 start_bridges()
75 start_domains()
77 ## Stop
79 def stop_domain(domain,wait=0):
80 if wait:
81 print "sudo xm shutdown -w "+domain
82 else:
83 print "sudo xm shutdown "+domain
85 def stop_domains(doms=domains, wait=0):
86 for domain in doms:
87 if not domain in real_nodes:
88 stop_domain(domain,wait)
90 def stop_bridges():
91 ###FIXME###
92 return 0
94 def stop_all(wait=0):
95 stop_domains(domains, wait)
96 stop_bridges()
98 def restart_all():
99 stop_all(1)
100 start_all()
102 ####################################################
104 def create_objects():
105 create_node_objects()
106 create_bridge_objects()
107 create_link_objects()
109 def create_node_objects():
110 for dom in domains:
111 node_object[dom]=Node(dom)
113 def create_bridge_objects():
114 for bridge in bridges:
115 bridge_object[bridge]=Bridge(bridge)
117 def create_link_objects():
119 for node, bridges_raw in vbridges_table.iteritems():
120 interface=0
121 j=0
122 for this_bridge in bridges_raw:
123 int_label=""
124 if this_bridge.find(':') != -1:
125 res = this_bridge.split(':')
126 this_bridge= res[0]
127 bridges_raw[j] = this_bridge
128 int_label = res[1]
129 if not [ node, bridges_raw.index(this_bridge), this_bridge ] in temporary_links:
130 name="%s %s %s" % (node,interface,this_bridge)
131 link_object[name]=Link(name,node,interface,this_bridge,int_label)
132 interface+=1
133 vbridges_table[node]=bridges_raw
135 for node, bridges_raw in bridge_bridge_table.iteritems():
136 interface=0
137 j=0
138 for this_bridge in bridges_raw:
139 int_label=""
140 if this_bridge.find(':') != -1:
141 res = this_bridge.split(':')
142 this_bridge= res[0]
143 bridges_raw[j] = this_bridge
144 int_label = res[1]
145 if not [ node, bridges_raw.index(this_bridge), this_bridge ] in temporary_links:
146 name="%s %s %s" % (node,interface,this_bridge)
147 link_object[name]=Link(name,node,interface,this_bridge,int_label)
148 interface+=1
149 bridge_bridge_table[node]=bridges_raw
151 for node,interface,bridge in temporary_links:
152 name="%s %s %s" % (node,interface,bridge)
153 link_object[name]=Link(name,node,interface,this_bridge)
155 for node,interface,bridge in broken_links:
156 name="%s %s %s" % (node,interface,bridge)
157 link_object[name]=Link(name,node,interface,this_bridge)
160 ####################################################
162 def screen():
163 wait_seconds=1
164 screens=[]
165 for domain in domains:
166 screens.append("screen -t %s %s sh -c 'while true; do %s ; echo Retrying in %s secods...; sleep %s ; clear; done'" %
167 (domain,domains.index(domain)+1,node_object[domain].console_string(),wait_seconds,wait_seconds))
168 screenlist="\n".join(screens)
170 hardstatus='hardstatus string "%{rk}Xentaur%{bk}@%H %{gk}%c %{yk}%d.%m %{wk}%?%-Lw%?%{bw}%n*%f%t%?(%u)%?%{wk}%?%+Lw%?"'
172 f=open(screenrc, "w");
173 f.write("""
174 hardstatus on
175 hardstatus alwayslastline
176 %s
178 screen -t console 0 sh -c 'while true; do cd %s; ./xentaur.py shell ; echo Retrying in %s secods...; sleep %s ; clear; done'
179 #screen -t xentaur - sh -c 'while true; do bash ; echo Retrying in %s secods...; sleep %s ; clear; done'
180 %s
181 """ % (hardstatus,xentaur_path,wait_seconds,wait_seconds,wait_seconds,wait_seconds,screenlist))
182 f.close()
183 print "# GNU Screen config file is written to: %s" % screenrc
185 def graph():
186 nodelist=""
187 bridgelist=""
188 linklist=""
189 physicallist=""
190 networklist=""
192 nodelist=";\n ".join(map(lambda node: node_object[node].graphviz_string(),nodes))
193 if nodelist: nodelist += ";"
194 bridgelist=";\n ".join(map(lambda bridge: bridge_object[bridge].graphviz_string(),bridges))
195 if bridgelist: bridgelist += ";"
196 linklist=";\n ".join(map(lambda link: link_object[link].graphviz_string(),link_object.keys()))
197 if linklist: linklist += ";"
199 f = open(network+".dot", "w");
200 f.write ("""
201 graph G {
202 edge [len=1.25];
203 splines=true;
204 // nodes
205 // node [shape=plaintext,color=white,shapefile="shapes/cisco.bmp/router.png"];
206 %s
208 // bridges
209 // node [shape=none,shapefile="shapes/all/switch.png"];
210 %s
212 // physical
213 node [shape=rectangle,color=blue];
214 %s
216 // networks (not bridges, not physical)
217 node [shape=rectangle,color=green];
218 %s
220 // links (between nodes and bridges)
221 %s
223 };
224 """ % (nodelist, bridgelist, physicallist, networklist, linklist))
225 f.close()
226 run_command("neato -Tpng -o %s.png %s.dot "%(network,network))
227 run_command("neato -Tjpg -o %s.jpg %s.dot "%(network,network))
228 run_command("neato -Tsvg -o %s.svg %s.dot "%(network,network))
229 run_command("neato -Tcmapx -o %s.cmapx -NURL=http://google.com %s.dot "%(network,network))
230 print "# Network map is written to files: %s.{png,svg,jpg,dot}" % network
232 def autoredraw():
233 graph()
235 def shell():
236 autoredraw()
237 ipshell = IPShellEmbed()
238 ipshell()
240 def version():
241 print """
242 Xentaur 0.1-PRE
244 ,--,
245 _ ___/ /\\|
246 ,;`( )__, ) ~
247 // .// '--;
248 ' / \ |
250 """
251 # print "Xentaur 0.1-PRE"
252 # print "(Godzilla-mutant) _"
253 # print " / * \\"
254 # print " / .-"
255 # print " / |"
256 # print " | \\ \\\\ \\"
257 # print " _ -------| \\ \\\\ \\"
258 # print " / / \\_\\ -"
259 # print "/ |\\ | |"
260 # print "| | \\ .-----. | \\ |"
261 # print " | / \\ \\ \\ \\"
262 # print " \\/|.\\ \\ \\ \\ \\"
263 # print " \\| - . \\_\\ \\_\\"
264 # print "-----------------------------------------------"
267 def info():
268 version()
270 print "Network name: ", network
271 print "-----------------------------------------------"
272 print
273 print "Nodes: ", len(domains)
274 print " * virtual nodes: ", len(domains)-len(real_nodes)
275 print " * real nodes:", len(real_nodes)
276 print
277 print "Bridges:", len(bridges)
278 print " * virtual bridges:", len(bridges)-len(real_bridges)-len(cross_bridges)
279 print " * real switches:", len(real_bridges)
280 print " * direct links:", len(cross_bridges)
282 def show_usage():
283 print """Usage:
284 xentaur <command> [<argument>]
286 Commands:
287 start-all -- start bridges and domains
288 start-domains -- start domains only
289 start-bridges -- start bridges only
290 stop-all -- stop bridges and domains
291 stop-domains -- stop domains only
292 stop-bridges -- stop bridges only (domains have to be stopped already)
293 restart-all -- restart bridges and domains
295 start <domain> -- start the <domain>
296 stop <domain> -- stop the <domain>
298 graph -- generate network scheme (result is in <network>.{png,jpg,svg})
299 screen -- generate GNU Screen config file (~/.screenrc_xentaur)
300 shell -- run Xentaur shell
302 """
304 def save():
305 print "network =", xen_config_name
306 print "domains =", domains
307 print "domain_types =", domain_types
308 print "bridges =", bridges
309 print "vbridges_table =", vbridges_table
310 print "hidden_bridges =", hidden_bridges
311 print "broken_links =", broken_links
312 print "temporary_links =", temporary_links
313 print "bridges_turned_down =", bridges_turned_down
315 #-----------------------------------------------------------------------
316 # CLASSES
318 class Bridge:
319 def __init__ (self,name):
320 self.name=name
321 def up(self):
322 bridge_up(self.name)
323 def down(self):
324 bridge_down(self.name)
325 def show(self):
326 show_bridge(self.name)
327 def dump_start(self,filter=""):
328 dump_start(self.name,filter)
330 def is_hidden(self):
331 return self.name in hidden_bridges
332 def is_real(self):
333 return self.name in real_bridges
334 def is_turned_down(self):
335 return self.name in bridges_turned_down
336 def is_cross(self):
337 return self.name in cross_bridges
339 def graphviz_string(self):
340 if self.is_hidden():
341 return ""
342 elif self.is_cross():
343 return "%s [shape=circle,height=0.03,color=black,fillcolor=black,style=filled,label=\"\"]" % (self.name)
344 elif self.is_real():
345 return "%s [color=white,shape=none,shapefile=\"shapes/all/real_switch.png\"]" % (self.name)
346 elif self.is_turned_down():
347 return "%s [color=white,shape=none,shapefile=\"shapes/all/switch_turned_down.png\"]" % (self.name)
348 else:
349 return "%s [color=white,shape=none,shapefile=\"shapes/all/switch.png\"]" % (self.name)
352 class Node:
353 def __init__ (self,name):
354 self.name=name
355 self.type=domain_types[domains.index(name)]
356 def start(self):
357 return ""
358 def stop(self):
359 return ""
360 def start_commandline(self):
361 return ""
362 def get_domain_id(self):
363 return get_domain_id(self.name)
364 def graphviz_string(self):
365 return self.name+" [color=white,shape=plaintext,label=\" "+self.name+"\",shapefile=\"shapes/all/"+\
366 domain_types[domains.index(self.name)]+".png\",fontcolor=black,fontsize=16,target=\"http://google.com\"]"
367 def console_string(self):
368 if self.type == 'quagga' or self.type == 'xenomips':
369 return "sudo xm console "+self.name
370 elif self.name in real_bridges or self.name in real_nodes:
371 return "echo Press enter to connect; read line; "+connection_table[self.name]
374 class Link:
375 def __init__ (self,name,node,interface,bridge,label=""):
376 self.name=name
377 self.node=node
378 self.interface=interface
379 self.bridge=bridge
380 self.label=label
382 def is_temporary(self):
383 return [self.node,self.interface,self.bridge] in temporary_links
385 def is_broken(self):
386 return ([self.node,self.interface,self.bridge] in broken_links)
388 def graphviz_string(self):
389 if self.is_temporary():
390 return self.node+" -- "+self.bridge+" [taillabel=\"fa"+str(self.interface)+"/0\",color=blue,len=10,w=5,weight=5]"
391 if self.is_broken():
392 return self.node+" -- "+self.bridge+" [taillabel=\"fa"+str(self.interface)+"/0\",style=dashed]"
394 ip="\\n.%s.%s" % (bridges.index(self.bridge)+1, domains.index(self.node)+1)
395 if domain_types[domains.index(self.node)] == 'xenomips':
396 int_name="fa"+str(self.interface)+"/0"
397 else:
398 int_name="eth"+str(self.interface)
399 if self.label != "":
400 int_name = self.label
401 return self.node+" -- "+self.bridge+" [taillabel=\""+int_name+ip+"\",fontsize=14,fontname=fixed]"
404 #-----------------------------------------------------------------------
405 # DOMAINS
407 def get_domain_id(domain):
408 return run_command_return_stdout("sudo xm list | awk '{if ($1 == \"'%s'\") print $2}'" % domain).rstrip("\n")
411 #-----------------------------------------------------------------------
412 # BRIDGES and IFACES
414 def bridge_down(bridge):
415 """
416 Turn the bridge <bridge> down
417 """
418 if bridge in real_bridges:
419 print "Bridge %s is a real bridge" % (bridge)
420 return -1
421 if bridge in bridges_turned_down:
422 print "Bridge %s is turned down already" % (bridge)
423 else:
424 bridges_turned_down.append(bridge)
425 run_command("sudo ip link set %s down" % bridge)
426 autoredraw()
428 def bridge_up(bridge):
429 """
430 Turn the bridge <bridge> up
431 """
432 if bridge in real_bridges:
433 print "Bridge %s is a real bridge" % (bridge)
434 return -1
435 if not (bridge in bridges_turned_down):
436 print "Bridge %s is turned up already" % (bridge)
437 else:
438 bridges_turned_down.remove(bridge)
439 run_command("sudo ip link set %s up" % bridge)
440 autoredraw()
442 def show_bridge(bridge):
443 """
444 Show the state of the bridge <bridge>
445 """
446 if bridge in real_bridges:
447 print "Bridge %s is a real bridge" % (bridge)
448 return -1
449 run_command("sudo ip link show %s" % bridge)
452 def int_disconnect(domain, int_number):
453 """
454 Disconnect the interface with the number <int_number>
455 of the domain <domain> from the bridge to which
456 it is connected
457 """
458 dom_id=get_domain_id(domain)
459 bridge=vbridges_table[domain][int_number]
460 if not bridge:
461 print "Interface %s of the %s domain is not connected" % (int_number, domain)
462 return 1
463 run_command("sudo brctl delif %s vif%s.%s" % (bridge, dom_id, int_number))
464 vbridges_table[domain][int_number]=''
465 if [ domain, int_number, bridge ] in temporary_links:
466 temporary_links.remove([ domain, int_number, bridge ])
467 else:
468 broken_links.append([ domain, int_number, bridge ])
469 autoredraw()
471 def int_connect(domain, int_number, bridge):
472 """
473 Connect the interface with the number <int_number>
474 of the domain <domain> to the bridge <bridge>
475 """
476 if bridge in real_bridges:
477 print "Bridge %s is a real bridge" % (bridge)
478 return -1
480 dom_id=get_domain_id(domain)
481 if vbridges_table[domain][int_number]:
482 print "Interface %s of the %s domain is connected already to the %s bridge" % (int_number, domain, vbridges_table[domain][int_number])
483 return 1
484 run_command("sudo brctl addif %s vif%s.%s" % (bridge, dom_id, int_number))
485 vbridges_table[domain][int_number]=bridge
486 if [ domain, int_number, bridge ] in broken_links:
487 broken_links.remove([ domain, int_number, bridge ])
488 else:
489 temporary_links.append([ domain, int_number, bridge ])
490 autoredraw()
492 def int_reconnect(domain, int_number, bridge):
493 """
494 Reconnect the interface with the number <int_number>
495 of the domain <domain> from the bridge to which
496 it is connected to the bridge <bridge>
497 """
498 if bridge in real_bridges:
499 print "Bridge %s is a real bridge" % (bridge)
500 return -1
502 int_disconnect(domain, int_number)
503 int_connect(domain, int_number, bridge)
505 def show_int(domain, int_number):
506 """
507 Show information about the interface <int_nuber>
508 of the domain <domain>
509 """
510 return vbridges_table[domain][int_number]
513 def dump_start(bridge, filter=""):
514 if bridge in real_bridges:
515 print "Bridge %s is a real bridge" % (bridge)
516 return -1
517 try:
518 print "Writing dump... (press Ctrl-C to stop)"
519 run_command("sudo tcpdump -w xentaur.dump -i %s %s > /dev/null 2>&1 " % (bridge,filter))
520 except:
521 print "Done.\n Dump is written to xentaur.dump"
522 return 0
524 def dump_stop():
525 return 0
528 #-----------------------------------------------------------------------
529 # CONFIGURATION TEMPLATES
532 def configure_ip_addresses(doms=domains):
534 cisco_set_ip_on_int="""
535 \n\n\n
536 int fa%s/0
537 no ip address
538 ip address %s 255.255.255.0
539 no shutdown
540 exit
541 """
543 quagga_set_ip_on_int="""
544 int eth%s
545 no ip address
546 ip address %s/24
547 no shutdown
548 exit
549 """
551 for dom in doms:
552 i=domains.index(dom)+1
553 if domain_types[domains.index(dom)] == 'quagga':
554 command = quagga_set_ip_on_int
555 write_to(i,"\nconf t\n")
556 j=0
557 for br in vbridges_table[dom]:
558 write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)))
559 j+=1
560 write_to(i,"\nend\n")
561 else:
562 command = cisco_set_ip_on_int
563 write_to(i,"\nena\nconf t\n")
564 j=0
565 for br in vbridges_table[dom]:
566 write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)))
567 j+=1
568 write_to(i,"\nend\n")
569 return 0
571 def configure_no_ip_addresses(doms=domains):
573 cisco_set_ip_on_int="""
574 \n\n\n
575 int fa%s/0
576 no ip address %s 255.255.255.0
577 exit
578 """
580 quagga_set_ip_on_int="""
581 int eth%s
582 no ip address %s/24
583 exit
584 """
586 for dom in doms:
587 i=domains.index(dom)+1
588 if domain_types[domains.index(dom)] == 'quagga':
589 command = quagga_set_ip_on_int
590 write_to(i,"\nconf t\n")
591 j=0
592 for br in vbridges_table[dom]:
593 write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)))
594 j+=1
595 write_to(i,"\nend\n")
596 else:
597 command = cisco_set_ip_on_int
598 write_to(i,"\nena\nconf t\n")
599 j=0
600 for br in vbridges_table[dom]:
601 write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)))
602 j+=1
603 write_to(i,"\nend\n")
604 return 0
606 def configure_ospf(doms=domains):
607 for dom in doms:
608 if domain_types[domains.index(dom)] == 'quagga':
609 write_to(dom,"\n\nconf t\nrouter ospf\nnetwork 192.168.0.0/16 area 0\nend\n")
610 else:
611 write_to(dom,"\n\nena\nconf t\nrouter ospf 1\nnetwork 192.168.0.0 0.0.255.255 area 0\nend\n")
612 return 0
614 def configure_hostname(doms=domains):
615 for dom in doms:
616 if domain_types[domains.index(dom)] == 'quagga':
617 write_to(dom,"\n\nconf t\nhostname %s\nend\n" % dom)
618 else:
619 write_to(dom,"\n\nena\nconf t\nhostname %s\nend\n" % dom)
620 return 0
622 def configure_logging_synchronous(doms=domains):
623 for dom in domains:
624 if domain_types[domains.index(dom)] == 'quagga':
625 0
626 else:
627 write_to(dom,"\n\nena\nconf t\nline console 0\nlogging synchronous\nend\n")
628 return 0
630 def configure_exec_timeout_0(doms=domains):
631 for dom in domains:
632 if domain_types[domains.index(dom)] == 'quagga':
633 0
634 else:
635 write_to(dom,"\n\nena\nconf t\nline console 0\nexec-timeout 0\nend\n")
636 return 0
638 def configure_no_cdp_log_mismatch_duplex(doms=domains):
639 for dom in filter_by_type(domains,'xenomips'):
640 write_to(dom,"\n\nena\nconf t\nno cdp log mismatch duplex\nend\n")
642 def configure_save(doms=domains):
643 write_to(doms,"\nwr\n")
645 def configure_root(doms=domains):
646 write_to(doms,"root\n")
648 #-----------------------------------------------------------------------
651 def add_domain(name,type):
652 domains.append(name)
653 domain_types.append(type)
655 def brake_link(domain,bridge):
656 broken_links.append([domain,bridge])
658 wt_timeout=0.5
659 def write_to(screen,string,return_to_screen=""):
660 """
661 write_to(screen,string):
663 Type *string* to the specified screen(s).
664 Screen may be specified with the number *screen*,
665 with array of numbers,
666 with array of names.
668 """
669 screen_numbers=[] # number of the screens to write to
670 if type(screen) == list:
671 screen_numbers=map(lambda x: domains.index(x)+1, screen)
672 elif type(screen) == int:
673 screen_numbers=[screen]
674 else:
675 screen_numbers=[domains.index(screen)+1]
677 for screen_number in screen_numbers:
678 run_command("screen -X select "+str(screen_number))
679 time.sleep(wt_timeout)
680 for line in string.splitlines():
681 f=open('/tmp/xentaurbuf', 'w')
682 f.write(line+"\n")
683 f.close()
684 run_command("screen -X readreg p /tmp/xentaurbuf")
685 time.sleep(wt_timeout)
686 run_command("nohup screen -X paste p >& /dev/null")
687 time.sleep(wt_timeout)
689 if return_to_screen != "":
690 run_command("screen -X select %s" % (return_to_screen))
691 time.sleep(wt_timeout)
693 def filter_by_type(doms,type):
694 """
695 filter_by_type(doms,type)
697 Return only domains of *doms* that have specified *type*
698 """
699 return filter(lambda x: domain_types[domains.index(x)]==type,domains)
701 #-----------------------------------------------------------------------
703 cisco_fa01_up="""
704 ena
705 conf t
706 int fa0/0
707 duplex half
708 no shutdown
709 exit
710 int fa1/0
711 duplex half
712 no shutdown
713 exit
714 exit
715 exit
716 """
718 cisco_set_ip_on_int="""
719 interface fa%s/0
720 no ip address
721 ip address %s 255.255.255.0
722 exit
723 """
725 nodes=domains
727 create_objects()
730 if len(sys.argv) == 2:
731 if sys.argv[1] == 'start-all':
732 start_all()
733 elif sys.argv[1] == 'start-domains':
734 start_domains()
735 elif sys.argv[1] == 'start-bridges':
736 start_bridges()
737 elif sys.argv[1] == 'stop-all':
738 stop_all()
739 elif sys.argv[1] == 'stop-domains':
740 stop_domains()
741 elif sys.argv[1] == 'stop-bridges':
742 stop_bridges()
743 elif sys.argv[1] == 'restart-all':
744 restart_all()
745 elif sys.argv[1] == 'screen':
746 screen()
747 elif sys.argv[1] == 'graph':
748 graph()
749 elif sys.argv[1] == 'shell':
750 shell()
751 elif sys.argv[1] == 'info':
752 info()
753 else:
754 show_usage()
755 sys.exit(1)
756 elif len(sys.argv) == 3:
757 if sys.argv[1] == 'start':
758 start_domain(sys.argv[2])
759 elif sys.argv[1] == 'stop':
760 stop_domain(sys.argv[2])
761 elif sys.argv[1] == 'restart':
762 stop_domain(sys.argv[2])
763 start_domain(sys.argv[2])
764 else:
765 show_usage()
766 sys.exit(1)
767 else:
768 show_usage()
769 sys.exit(1)
771 sys.exit(0)