xen-drbd
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xen-drbd-start.py Thu Sep 27 18:56:29 2007 +0300 1.3 @@ -0,0 +1,51 @@ 1.4 +#!/usr/bin/python 1.5 + 1.6 + 1.7 +# External variables: 1.8 +# * network 1.9 +# * domain 1.10 + 1.11 +import sys 1.12 + 1.13 +sys.path.append('/root') 1.14 +try: 1.15 + exec 'from %s import *' % (network) 1.16 +except: 1.17 + print "Can't find or interpret module %s with topology description" %(network) 1.18 + sys.exit(1) 1.19 + 1.20 +name=domain 1.21 +N = domains.index(domain) 1.22 + 1.23 + 1.24 +memory=mem_table[domain] 1.25 + 1.26 +disk=[] 1.27 +i=0 1.28 +for disk_description in disk_table[domain]: 1.29 + i+=1 1.30 + if disk_description.find(":") == -1: 1.31 + disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) ) 1.32 + else: 1.33 + disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[0],i) ) 1.34 + 1.35 +vif=[] 1.36 +vbridges = vbridges_table[domain] 1.37 +x=1 1.38 +for i in vbridges: 1.39 + vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) 1.40 + x+=1 1.41 + 1.42 +root="/dev/hda1 ro" 1.43 +extra="" 1.44 + 1.45 +def print_config(): 1.46 + print "name =", name 1.47 + print "kernel =", kernel 1.48 + print "ramdisk =", ramdisk 1.49 + print "memory =", memory 1.50 + print "disk =", disk 1.51 + print "vif =", vif 1.52 + print "root =", root 1.53 + print "extra =", extra 1.54 +