xen-drbd

diff xen-drbd-install.py @ 43:562d6e064e6f

Install packages into domains (apt_get_install_table)
author igor@manas.xt.vpn
date Tue Sep 23 11:40:23 2008 +0300 (2008-09-23)
parents 263d00b75422
children cbe58da31273
line diff
     1.1 --- a/xen-drbd-install.py	Mon Sep 22 15:06:26 2008 +0300
     1.2 +++ b/xen-drbd-install.py	Tue Sep 23 11:40:23 2008 +0300
     1.3 @@ -218,10 +218,13 @@
     1.4  
     1.5  def make_install_debian():
     1.6      print """
     1.7 -apt-get install debootstrap
     1.8 +apt-get install debootstrap lsof
     1.9  debootstrap %s /domU/%s %s
    1.10  chroot /domU/%s apt-get install -y --force-yes %s
    1.11 -    """ % (debian_release,domains[0],debian_mirror,domains[0],apt_get_install)
    1.12 +kill $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    1.13 +sleep 2
    1.14 +kill -9 $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    1.15 +    """ % (debian_release,domains[0],debian_mirror,domains[0],apt_get_install,domains[0],domains[0])
    1.16  
    1.17  def make_rsync():
    1.18      for dom in domains[1:]:
    1.19 @@ -229,6 +232,19 @@
    1.20  rsync -a /domU/%s/ /domU/%s/
    1.21          """ % (domains[0], dom)
    1.22  
    1.23 +
    1.24 +def make_install_packages():
    1.25 +    for dom in domains:
    1.26 +        try:
    1.27 +            print """
    1.28 +chroot /domU/%s apt-get install -y --force-yes %s
    1.29 +kill $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    1.30 +sleep 2
    1.31 +kill -9 $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    1.32 +            """ % (dom,apt_get_install_table[dom],dom,dom)
    1.33 +        except:
    1.34 +            pass
    1.35 +
    1.36  def make_etcfstab():
    1.37      i=0
    1.38      for dom in linux_domains:
    1.39 @@ -335,6 +351,7 @@
    1.40      make_mount()
    1.41      make_install_debian()
    1.42      make_rsync()
    1.43 +    make_install_packages()
    1.44      make_etc()
    1.45      make_umount()
    1.46