xen-drbd
changeset 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 | fc4025aa8287 |
children | 189e42c31b69 |
files | od.py xen-drbd-start.py xen-drbd.py |
line diff
1.1 --- a/od.py Sun Jun 29 15:47:02 2008 +0300 1.2 +++ b/od.py Thu Aug 14 22:04:16 2008 +0300 1.3 @@ -1,5 +1,5 @@ 1.4 1.5 -node1='debian' 1.6 +node1='manas' 1.7 node2='mirror' 1.8 #i_am=node1 1.9 1.10 @@ -15,7 +15,8 @@ 1.11 node1_ip=ip_address[node1] 1.12 node2_ip=ip_address[node2] 1.13 1.14 -domains=[ 'gw', 'igw', 'dns', 'vpn', 'apt', 'pgw', 'ldap', 'mail', 'uucp', 'samba', ] 1.15 +domains= [ 'gw', 'igw', 'dns', 'vpn', 'apt', 'pgw', 'ldap', 'mail', 'uucp', 'samba', 'test'] 1.16 +domain_types= [ 'linux', 'linux', 'linux', 'linux', 'linux', 'linux', 'linux', 'linux', 'linux', 'linux', 'hvm' ] 1.17 1.18 domain_home = { 1.19 node1 : ['dns', 'gw', 'igw', 'pgw', 'ldap', 'mail', 'vpn', 'uucp', 'apt'], 1.20 @@ -36,6 +37,7 @@ 1.21 'vpn' :192, 1.22 'uucp' :128, 1.23 'apt' :128, 1.24 + 'test' :128, 1.25 } 1.26 1.27 vcpus_table={ 1.28 @@ -49,6 +51,7 @@ 1.29 'vpn' :4, 1.30 'uucp' :4, 1.31 'apt' :2, 1.32 + 'test' :2, 1.33 } 1.34 1.35 lvm_vg_name="TURBO" 1.36 @@ -73,6 +76,7 @@ 1.37 'drbd14:samba-nbumail:100G', 1.38 'drbd17:samba-profiles:100G' 1.39 ], 1.40 + 'test' : ['drbd18:test:3G'], 1.41 } 1.42 1.43 bridges=['tagged0', 'xenbr1', 'xenbr256', 'xenbr257', 'xenbr3', 'xenbr4', 'xenbr501'] 1.44 @@ -94,6 +98,7 @@ 1.45 'vpn' : ['xenbr3'], 1.46 'apt' : ['xenbr3'], 1.47 'uucp' : ['xenbr3'], 1.48 + 'test' : ['xenbr3'], 1.49 } 1.50 1.51 # FOR INSTALLATION ONLY
2.1 --- a/xen-drbd-start.py Sun Jun 29 15:47:02 2008 +0300 2.2 +++ b/xen-drbd-start.py Thu Aug 14 22:04:16 2008 +0300 2.3 @@ -17,6 +17,16 @@ 2.4 name=domain 2.5 N = domains.index(domain) 2.6 2.7 +if domain_types[N] == 'hvm': 2.8 + kernel='hvmloader' 2.9 + builder='hvm' 2.10 + device_model='qemu-dm' 2.11 + boot='c' 2.12 + sdl=0 2.13 + vnc=1 2.14 + vncconsole=0 2.15 + stdvga=0 2.16 + serial='pty' 2.17 2.18 memory=mem_table[domain] 2.19 vcpus=vcpus_table[domain] 2.20 @@ -34,20 +44,41 @@ 2.21 vbridges = vbridges_table[domain] 2.22 x=1 2.23 for i in vbridges: 2.24 - vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) 2.25 - x+=1 2.26 + if domain_types[N] == 'hvm': 2.27 + vif.append('type=ioemu, bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) 2.28 + else: 2.29 + vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) 2.30 + x+=1 2.31 + 2.32 2.33 root="/dev/hda1 ro" 2.34 extra="" 2.35 2.36 def print_config(): 2.37 - print "name =", name 2.38 - print "kernel =", kernel 2.39 - print "ramdisk =", ramdisk 2.40 - print "memory =", memory 2.41 - print "vcpus =", vcpus 2.42 - print "disk =", disk 2.43 - print "vif =", vif 2.44 - print "root =", root 2.45 - print "extra =", extra 2.46 + if domain_types[N] == 'hvm': 2.47 + print "name = \"%s\""% name 2.48 + print "kernel = \"%s\""% kernel 2.49 + print "builder = \"%s\""% builder 2.50 + print "memory = %s"% memory 2.51 + print "device_model=\"%s\"" % device_model 2.52 + print "vcpus = %s"% vcpus 2.53 + print "disk =", disk 2.54 + print "vif =", vif 2.55 + print "boot=\"%s\""%boot 2.56 + print "sdl=%s"%sdl 2.57 + print "vnc=%s"%vnc 2.58 + print "vncconsole=%s"%vncconsole 2.59 + print "stdvga=%s"%stdvga 2.60 + print "serial=\"%s\""%serial 2.61 + else: 2.62 + print "name = \"%s\""% name 2.63 + print "kernel = \"%s\""% kernel 2.64 + print "ramdisk = \"%s\""% ramdisk 2.65 + print "memory = %s"% memory 2.66 + print "vcpus = %s"% vcpus 2.67 + print "disk =", disk 2.68 + print "vif =", vif 2.69 + print "root = \"%s\""% root 2.70 + print "extra = \"%s\""% extra 2.71 +# else: 2.72
3.1 --- a/xen-drbd.py Sun Jun 29 15:47:02 2008 +0300 3.2 +++ b/xen-drbd.py Thu Aug 14 22:04:16 2008 +0300 3.3 @@ -141,11 +141,11 @@ 3.4 xm_domains=run_now("xm list | awk '{print $1}'", node).split("\n") 3.5 return filter(lambda x: x in xm_domains, domains) 3.6 3.7 -def migrate_all_out(node=i_am): 3.8 +def migrate_out_all(node=i_am): 3.9 for domain in running_domains(node): 3.10 migrate_domain_out(domain,node) 3.11 3.12 -def migrate_all_in(node=i_am): 3.13 +def migrate_in_all(node=i_am): 3.14 for domain in running_domains(the_peer_of(node)): 3.15 migrate_domain_in(domain,node) 3.16 3.17 @@ -257,10 +257,10 @@ 3.18 start_all() 3.19 elif command == 'start-my-domains': 3.20 start_my_domains() 3.21 - elif command == 'migrate-all-out': 3.22 - migrate_all_out() 3.23 - elif command == 'migrate-all-in': 3.24 - migrate_all_in() 3.25 + elif command == 'migrate-out-all': 3.26 + migrate_out_all() 3.27 + elif command == 'migrate-in-all': 3.28 + migrate_in_all() 3.29 elif command == 'migrate-my-domains-home': 3.30 migrate_my_domains_home() 3.31 elif command == 'migrate-and-start-my-domains':