xen-drbd

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