xen-drbd
view xen-drbd-start.py @ 31:5e499179b5ed
Добавлена поддержка HVM-доменов; параметры migrate-all-out и migrate-all-in заменены, соответственно, на migrate-out-all и migrate-in-all
author | igor@manas.xt.vpn |
---|---|
date | Thu Aug 14 22:04:16 2008 +0300 (2008-08-14) |
parents | 1c7442c793a1 |
children | 189e42c31b69 |
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)
20 if domain_types[N] == 'hvm':
21 kernel='hvmloader'
22 builder='hvm'
23 device_model='qemu-dm'
24 boot='c'
25 sdl=0
26 vnc=1
27 vncconsole=0
28 stdvga=0
29 serial='pty'
31 memory=mem_table[domain]
32 vcpus=vcpus_table[domain]
34 disk=[]
35 i=0
36 for disk_description in disk_table[domain]:
37 i+=1
38 if disk_description.find(":") == -1:
39 disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) )
40 else:
41 disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[1],i) )
43 vif=[]
44 vbridges = vbridges_table[domain]
45 x=1
46 for i in vbridges:
47 if domain_types[N] == 'hvm':
48 vif.append('type=ioemu, bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
49 else:
50 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
51 x+=1
54 root="/dev/hda1 ro"
55 extra=""
57 def print_config():
58 if domain_types[N] == 'hvm':
59 print "name = \"%s\""% name
60 print "kernel = \"%s\""% kernel
61 print "builder = \"%s\""% builder
62 print "memory = %s"% memory
63 print "device_model=\"%s\"" % device_model
64 print "vcpus = %s"% vcpus
65 print "disk =", disk
66 print "vif =", vif
67 print "boot=\"%s\""%boot
68 print "sdl=%s"%sdl
69 print "vnc=%s"%vnc
70 print "vncconsole=%s"%vncconsole
71 print "stdvga=%s"%stdvga
72 print "serial=\"%s\""%serial
73 else:
74 print "name = \"%s\""% name
75 print "kernel = \"%s\""% kernel
76 print "ramdisk = \"%s\""% ramdisk
77 print "memory = %s"% memory
78 print "vcpus = %s"% vcpus
79 print "disk =", disk
80 print "vif =", vif
81 print "root = \"%s\""% root
82 print "extra = \"%s\""% extra
83 # else: