xen-drbd

changeset 36:44efea4507ac

Virtual disk name can be secified after = sign (e.g.: drbd1=sda1:dns:2G )
author igor@manas.xt.vpn
date Sat Aug 30 11:14:50 2008 +0300 (2008-08-30)
parents cbd4d942d059
children e80bdf496aa2
files eb.py od.py xen-drbd-install.py xen-drbd-start.py
line diff
     1.1 --- a/eb.py	Mon Aug 18 21:27:14 2008 +0300
     1.2 +++ b/eb.py	Sat Aug 30 11:14:50 2008 +0300
     1.3 @@ -57,7 +57,7 @@
     1.4  disk_table={
     1.5  	'gw' 		: ['drbd1'], 
     1.6  	'igw'		: ['drbd2'], 
     1.7 -	'dns'		: ['drbd3'], 
     1.8 +	'dns'		: ['drbd3=sda1'], 
     1.9  	'vpn'		: ['drbd4'],
    1.10  	'apt'		: ['drbd5'],
    1.11  	'proxy'		: ['drbd6'], 
     2.1 --- a/od.py	Mon Aug 18 21:27:14 2008 +0300
     2.2 +++ b/od.py	Sat Aug 30 11:14:50 2008 +0300
     2.3 @@ -63,7 +63,7 @@
     2.4  disk_table={
     2.5      'gw'        : ['drbd1:gw:2G'], 
     2.6      'igw'       : ['drbd2:igw:2G'], 
     2.7 -    'dns'       : ['drbd3:dns:2G'], 
     2.8 +    'dns'       : ['drbd3=sda1:dns:2G'], 
     2.9      'vpn'       : ['drbd4:vpn:2G'],
    2.10      'apt'       : ['drbd5:apt:10G'],
    2.11      'pgw'       : ['drbd6:pgw:2G'],
     3.1 --- a/xen-drbd-install.py	Mon Aug 18 21:27:14 2008 +0300
     3.2 +++ b/xen-drbd-install.py	Sat Aug 30 11:14:50 2008 +0300
     3.3 @@ -43,9 +43,13 @@
     3.4      for dom in domains:
     3.5          for disk in disk_table[dom]:
     3.6              if disk.find(":") == -1:
     3.7 -                drbd_device[disk]=dom
     3.8 +                if disk.find("=") == -1:
     3.9 +                    drbd_device[disk]=dom
    3.10 +                else:
    3.11 +                    drbd_device[disk.split('=')[0]]=dom
    3.12              else:
    3.13 -                drbd_device[disk.split(':')[0]]=disk.split(':')[1]
    3.14 +                disk0=disk.split(':')[0]
    3.15 +                drbd_device[disk0.split('=')[0]]=disk.split(':')[1]
    3.16  
    3.17  def make_lvm():
    3.18      print "###################################################"
     4.1 --- a/xen-drbd-start.py	Mon Aug 18 21:27:14 2008 +0300
     4.2 +++ b/xen-drbd-start.py	Sat Aug 30 11:14:50 2008 +0300
     4.3 @@ -38,17 +38,34 @@
     4.4      for disk_description in disk_table[domain]:
     4.5          i+=1
     4.6          if disk_description.find(":") == -1:
     4.7 -            disk.append('phy:/dev/drbd/%s,hd%s,w' % (domain,letters[i-1]) )
     4.8 +            disk_name=disk_description
     4.9 +            if disk_name.find("=") == -1:
    4.10 +                disk.append('phy:/dev/drbd/%s,hd%s,w' % (domain,letters[i-1]) )
    4.11 +            else:
    4.12 +                disk.append('phy:/dev/drbd/%s,%s,w' % (domain,(disk_name.split("="))[1]) )
    4.13          else:
    4.14 -            disk.append('phy:/dev/drbd/%s,hd%s,w' % ((disk_description.split(':'))[1],letters[i-1]) )
    4.15 +            disk_name=(disk_description.split(':'))[0]
    4.16 +            if disk_name.find("=") == -1:
    4.17 +                disk.append('phy:/dev/drbd/%s,hd%s,w' % ((disk_description.split(':'))[1],letters[i-1]) )
    4.18 +            else:
    4.19 +                disk.append('phy:/dev/drbd/%s,%s,w' % ((disk_description.split(':'))[1],(disk_name.split("="))[1]) )
    4.20 +                
    4.21  else:
    4.22      i=0
    4.23      for disk_description in disk_table[domain]:
    4.24          i+=1
    4.25          if disk_description.find(":") == -1:
    4.26 -            disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) )
    4.27 +            disk_name=disk_description
    4.28 +            if disk_name.find("=") == -1:
    4.29 +                disk.append('phy:/dev/drbd/%s,hda%s,w' % (domain,i) )
    4.30 +            else:
    4.31 +                disk.append('phy:/dev/drbd/%s,%s,w' % (domain,(disk_name.split("="))[1]) )
    4.32          else:
    4.33 -            disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[1],i) )
    4.34 +            disk_name=(disk_description.split(':'))[0]
    4.35 +            if disk_name.find("=") == -1:
    4.36 +                disk.append('phy:/dev/drbd/%s,hda%s,w' % ((disk_description.split(':'))[1],i) )
    4.37 +            else:
    4.38 +                disk.append('phy:/dev/drbd/%s,%s,w' % ((disk_description.split(':'))[1],(disk_name.split("="))[1]) )
    4.39  
    4.40  vif=[]
    4.41  vbridges = vbridges_table[domain]