xen-drbd

annotate xen-drbd-start.py @ 5:1c7442c793a1

*** empty log message ***
author eb
date Fri Oct 05 16:59:35 2007 +0300 (2007-10-05)
parents 0b0a886abd08
children 5e499179b5ed
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
eb@5 10 sys.path.append('/etc/xen')
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@4 22 vcpus=vcpus_table[domain]
igor@0 23
igor@0 24 disk=[]
igor@0 25 i=0
igor@0 26 for disk_description in disk_table[domain]:
igor@0 27 i+=1
igor@0 28 if disk_description.find(":") == -1:
igor@0 29 disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) )
igor@0 30 else:
igor@4 31 disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[1],i) )
igor@0 32
igor@0 33 vif=[]
igor@0 34 vbridges = vbridges_table[domain]
igor@0 35 x=1
igor@0 36 for i in vbridges:
igor@0 37 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
igor@0 38 x+=1
igor@0 39
igor@0 40 root="/dev/hda1 ro"
igor@0 41 extra=""
igor@0 42
igor@0 43 def print_config():
igor@0 44 print "name =", name
igor@0 45 print "kernel =", kernel
igor@0 46 print "ramdisk =", ramdisk
igor@0 47 print "memory =", memory
igor@4 48 print "vcpus =", vcpus
igor@0 49 print "disk =", disk
igor@0 50 print "vif =", vif
igor@0 51 print "root =", root
igor@0 52 print "extra =", extra
igor@0 53