igor@0: #!/usr/bin/python igor@0: igor@0: igor@0: # External variables: igor@0: # * network igor@0: # * domain igor@0: igor@0: import sys igor@0: eb@5: sys.path.append('/etc/xen') igor@0: try: igor@0: exec 'from %s import *' % (network) igor@0: except: igor@0: print "Can't find or interpret module %s with topology description" %(network) igor@0: sys.exit(1) igor@0: igor@0: name=domain igor@0: N = domains.index(domain) igor@0: igor@31: if domain_types[N] == 'hvm': igor@31: kernel='hvmloader' igor@31: builder='hvm' igor@31: device_model='qemu-dm' igor@31: boot='c' igor@31: sdl=0 igor@31: vnc=1 igor@31: vncconsole=0 igor@31: stdvga=0 igor@31: serial='pty' igor@0: igor@0: memory=mem_table[domain] igor@4: vcpus=vcpus_table[domain] igor@0: igor@0: disk=[] igor@0: i=0 igor@0: for disk_description in disk_table[domain]: igor@0: i+=1 igor@0: if disk_description.find(":") == -1: igor@0: disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) ) igor@0: else: igor@4: disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[1],i) ) igor@0: igor@0: vif=[] igor@0: vbridges = vbridges_table[domain] igor@0: x=1 igor@0: for i in vbridges: igor@31: if domain_types[N] == 'hvm': igor@31: vif.append('type=ioemu, bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) igor@31: else: igor@31: vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) igor@31: x+=1 igor@31: igor@0: igor@0: root="/dev/hda1 ro" igor@0: extra="" igor@0: igor@0: def print_config(): igor@31: if domain_types[N] == 'hvm': igor@31: print "name = \"%s\""% name igor@31: print "kernel = \"%s\""% kernel igor@31: print "builder = \"%s\""% builder igor@31: print "memory = %s"% memory igor@31: print "device_model=\"%s\"" % device_model igor@31: print "vcpus = %s"% vcpus igor@31: print "disk =", disk igor@31: print "vif =", vif igor@31: print "boot=\"%s\""%boot igor@31: print "sdl=%s"%sdl igor@31: print "vnc=%s"%vnc igor@31: print "vncconsole=%s"%vncconsole igor@31: print "stdvga=%s"%stdvga igor@31: print "serial=\"%s\""%serial igor@31: else: igor@31: print "name = \"%s\""% name igor@31: print "kernel = \"%s\""% kernel igor@31: print "ramdisk = \"%s\""% ramdisk igor@31: print "memory = %s"% memory igor@31: print "vcpus = %s"% vcpus igor@31: print "disk =", disk igor@31: print "vif =", vif igor@31: print "root = \"%s\""% root igor@31: print "extra = \"%s\""% extra igor@31: # else: igor@0: