xen-drbd
view xen-drbd-start.py @ 0:b6dc3480caae
xen-drbd merge
author | igor |
---|---|
date | Thu Sep 27 18:56:29 2007 +0300 (2007-09-27) |
parents | |
children | 0b0a886abd08 |
line source
1 #!/usr/bin/python
4 # External variables:
5 # * network
6 # * domain
8 import sys
10 sys.path.append('/root')
11 try:
12 exec 'from %s import *' % (network)
13 except:
14 print "Can't find or interpret module %s with topology description" %(network)
15 sys.exit(1)
17 name=domain
18 N = domains.index(domain)
21 memory=mem_table[domain]
23 disk=[]
24 i=0
25 for disk_description in disk_table[domain]:
26 i+=1
27 if disk_description.find(":") == -1:
28 disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) )
29 else:
30 disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[0],i) )
32 vif=[]
33 vbridges = vbridges_table[domain]
34 x=1
35 for i in vbridges:
36 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
37 x+=1
39 root="/dev/hda1 ro"
40 extra=""
42 def print_config():
43 print "name =", name
44 print "kernel =", kernel
45 print "ramdisk =", ramdisk
46 print "memory =", memory
47 print "disk =", disk
48 print "vif =", vif
49 print "root =", root
50 print "extra =", extra