xen-drbd

view xen-drbd-start.py @ 21:fc201b0bc6f9

trunk down before making bridge
author igor
date Sun Feb 17 12:23:52 2008 +0200 (2008-02-17)
parents 0b0a886abd08
children 5e499179b5ed
line source
1 #!/usr/bin/python
4 # External variables:
5 # * network
6 # * domain
8 import sys
10 sys.path.append('/etc/xen')
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]
22 vcpus=vcpus_table[domain]
24 disk=[]
25 i=0
26 for disk_description in disk_table[domain]:
27 i+=1
28 if disk_description.find(":") == -1:
29 disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) )
30 else:
31 disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[1],i) )
33 vif=[]
34 vbridges = vbridges_table[domain]
35 x=1
36 for i in vbridges:
37 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
38 x+=1
40 root="/dev/hda1 ro"
41 extra=""
43 def print_config():
44 print "name =", name
45 print "kernel =", kernel
46 print "ramdisk =", ramdisk
47 print "memory =", memory
48 print "vcpus =", vcpus
49 print "disk =", disk
50 print "vif =", vif
51 print "root =", root
52 print "extra =", extra