xen-drbd

changeset 33:85165c844ac9

fill only linux domains; skip all other
author igor@manas.xt.vpn
date Mon Aug 18 12:29:26 2008 +0300 (2008-08-18)
parents 189e42c31b69
children a428be6d690b
files xen-drbd-install.py
line diff
     1.1 --- a/xen-drbd-install.py	Mon Aug 18 11:48:34 2008 +0300
     1.2 +++ b/xen-drbd-install.py	Mon Aug 18 12:29:26 2008 +0300
     1.3 @@ -34,6 +34,11 @@
     1.4  meta_disk='/dev/%s/meta'%lvm_vg_name
     1.5  drbd_device={}
     1.6  
     1.7 +linux_domains=[]
     1.8 +for dom in domains:
     1.9 +    if domain_types[domains.index(dom)] == 'linux':
    1.10 +        linux_domains.append(dom)
    1.11 +
    1.12  def make_drbd_hash():
    1.13      for dom in domains:
    1.14          for disk in disk_table[dom]:
    1.15 @@ -50,7 +55,7 @@
    1.16          print "pvcreate %s" % (lvm_pv_name)
    1.17      print "vgcreate /dev/%s %s" % (lvm_vg_name, lvm_pv_names)
    1.18      print "lvcreate -L %s -n %s /dev/%s" % (lvm_lv_drbd_meta_size, lvm_lv_drbd_meta_name, lvm_vg_name)
    1.19 -    for dom in domains:
    1.20 +    for dom in linux_domains:
    1.21          for disk in disk_table[dom]:
    1.22              if disk.find(":") == -1:
    1.23                  #if do_print:
    1.24 @@ -160,23 +165,23 @@
    1.25      print "#"
    1.26  
    1.27      print "mkdir -p /domU"
    1.28 -    for dom in domains:
    1.29 +    for dom in linux_domains:
    1.30          print "mkdir -p /domU/%s" % (dom)
    1.31          print "mount /dev/drbd/%s /domU/%s" % (dom,dom)
    1.32  
    1.33  def make_umount():
    1.34 -    for dom in domains:
    1.35 +    for dom in linux_domains:
    1.36          print "umount /domU/%s" % (dom)
    1.37  
    1.38  def make_dns():
    1.39      i=1
    1.40 -    for dom in domains:
    1.41 +    for dom in linux_domains:
    1.42          print "%s A %s.%s" % (dom, ip_network, i)
    1.43          i+=1
    1.44  
    1.45  def make_dns_reverse():
    1.46      i=1
    1.47 -    for dom in domains:
    1.48 +    for dom in linux_domains:
    1.49          print "%s A %s.%s." % (i, dom, domain_name)
    1.50          i+=1
    1.51  
    1.52 @@ -195,7 +200,7 @@
    1.53  
    1.54  def make_etcfstab():
    1.55      i=0
    1.56 -    for dom in domains:
    1.57 +    for dom in linux_domains:
    1.58          i+=1
    1.59          print """
    1.60  cat <<FSTAB > /domU/%s/etc/fstab
    1.61 @@ -206,7 +211,7 @@
    1.62  
    1.63  def make_etcnetworkinterfaces():
    1.64      i=0
    1.65 -    for dom in domains:
    1.66 +    for dom in linux_domains:
    1.67          i+=1
    1.68          print """
    1.69  cat <<INTERFACES > /domU/%s/etc/network/interfaces
    1.70 @@ -225,7 +230,7 @@
    1.71          """ % (dom,ip_address_table[dom],ip_network, ip_network, ip_gateway, domain_name, ip_nameserver)
    1.72  
    1.73  def make_etcresolvconf():
    1.74 -    for dom in domains:
    1.75 +    for dom in linux_domains:
    1.76          print """
    1.77  cat <<RESOLVCONF > /domU/%s/etc/resolv.conf
    1.78  search %s
    1.79 @@ -234,7 +239,7 @@
    1.80          """ % (dom,domain_name,ip_nameserver)
    1.81  
    1.82  def make_etchostname():
    1.83 -    for dom in domains:
    1.84 +    for dom in linux_domains:
    1.85          print """
    1.86  cat <<HOSTNAME > /domU/%s/etc/hostname
    1.87  %s
    1.88 @@ -244,7 +249,7 @@
    1.89  
    1.90  def make_etchosts():
    1.91      i=0
    1.92 -    for dom in domains:
    1.93 +    for dom in linux_domains:
    1.94          i+=1
    1.95          print """
    1.96  cat <<HOSTS > /domU/%s/etc/hosts
    1.97 @@ -261,7 +266,7 @@
    1.98          """ % (dom,ip_address_table[dom],dom,domain_name,dom)
    1.99  
   1.100  def make_rootssh():
   1.101 -    for dom in domains:
   1.102 +    for dom in linux_domains:
   1.103          print """
   1.104  mkdir -p /domU/%s/home/eb/.ssh/
   1.105  chown -R 1000:1000 /domU/%s/home/eb
   1.106 @@ -270,7 +275,7 @@
   1.107          """  % (dom,dom,dom,dom)
   1.108  
   1.109  def make_l3rc():
   1.110 -    for dom in domains:
   1.111 +    for dom in linux_domains:
   1.112          print """
   1.113          cat <<EOF > /domU/%s/root/.l3rc
   1.114  l3cd=/users/igor/xen-drbd-dom0-setup/%s.%s/root