xen-drbd

changeset 23:6e01df357a6a

automatic hostname in topology
author igor
date Tue Feb 19 12:53:45 2008 +0200 (2008-02-19)
parents 2ecda36e8d0d
children ccf4137ea2a6
files od.py xen-drbd-install.py xen-drbd.py
line diff
     1.1 --- a/od.py	Sun Feb 17 13:32:01 2008 +0200
     1.2 +++ b/od.py	Tue Feb 19 12:53:45 2008 +0200
     1.3 @@ -1,7 +1,11 @@
     1.4  
     1.5  node1='debian'
     1.6  node2='mirror'
     1.7 -i_am=node1
     1.8 +#i_am=node1
     1.9 +
    1.10 +from socket import gethostname; i_am=gethostname()
    1.11 +if i_am != node1 and i_am != node2:
    1.12 +    raise ValueError, "My hostname (%s) should be equal to node1 (%s) or node2 (%s)" % (i_am, node1, node2)
    1.13  
    1.14  ip_address = {
    1.15      node1: '10.0.5.220',
     2.1 --- a/xen-drbd-install.py	Sun Feb 17 13:32:01 2008 +0200
     2.2 +++ b/xen-drbd-install.py	Tue Feb 19 12:53:45 2008 +0200
     2.3 @@ -26,7 +26,7 @@
     2.4  network=sys.argv[1]
     2.5  try:
     2.6      exec 'from %s import * ' % (network)
     2.7 -except:
     2.8 +except ImportError:
     2.9      print "Can't find or interpret module %s with topology description" %(network)
    2.10      sys.exit(1)
    2.11  
     3.1 --- a/xen-drbd.py	Sun Feb 17 13:32:01 2008 +0200
     3.2 +++ b/xen-drbd.py	Tue Feb 19 12:53:45 2008 +0200
     3.3 @@ -1,6 +1,6 @@
     3.4  #!/usr/bin/python
     3.5  
     3.6 -network='eb'
     3.7 +network='od'
     3.8  
     3.9  import sys,os,imp
    3.10  from commands import mkarg
    3.11 @@ -9,7 +9,7 @@
    3.12  sys.path.append('/etc/xen')
    3.13  try:
    3.14          exec 'from %s import *' % (network)
    3.15 -except:
    3.16 +except ImportError:
    3.17          print "Can't find or interpret module %s with topology description" %(network)
    3.18          sys.exit(1)
    3.19