#============================================================================ # This script sets the parameters used when a domain is created using 'xm create'. # # "xm create vminstall=1" will (re)install the domain or # "xm create" will boot the domain # # vminstall is purely a script variable, and has no effect on the the domain # id assigned to the new domain. #============================================================================ execfile("/xen/config/macs.py") # Define script variables here. # xm_vars is defined automatically, use xm_vars.var() to define a variable. # This function checks whether 'vminstall' has been given a value. # It is called automatically by 'xm create'. def vminstall_check(var, val): try: val = int(val) except: val = 0 if val <= 0: val = 0 return val # Define the 'vminstall' variable so that 'xm create' knows about it. xm_vars.var('vminstall', use="Reinstall domain if value > 0.", check=vminstall_check) # Check the defined variables have valid values.. xm_vars.check() try: diskdir except: diskdir = "mapper" # If disk is not defined use old syntax try: disk except: disk=["phy:" + diskdir + "/" + name + ",sda,w"] iparr = ipadres.split(".") if macs.has_key(name): macpub = macs[name] print macpub else: macprefix = "aa:00:00:" macpub = macprefix + "76:" + iparr[2] + ':'+ hex(int(iparr[3])) print macpub vif = [ 'mac='+macpub+', bridge=subnet' + iparr[2] ] if vminstall > 0: # Set if you want dhcp to allocate the IP address. #dhcp = "dhcp" ip = ipadres # Set netmask. netmask="255.255.255.0" # Set default gateway. gateway="157.193." + iparr[2]+".254" # Set the hostname. hostname = name # Set root device. root = "/dev/nfs" # provided by dhcp # The nfs server. nfs_server = '157.193.71.46' # Root directory on the nfs server. #nfs_root = '/srv/fai/nfsroot' #extra = "FAI_ACTION=install boot=nfs root=/dev/nfs nfsroot=/srv/fai/nfsroot-oldwopr,v2 FAI_FLAGS=verbose,sshd,createvt,syslogd,halt HOSTNAME=" + hostname + " SETIPADDR=" + ipadres # dit is voor de nieuwe FAI install, maar heeft nog een BUG! extra = "ip=dhcp root=/dev/nfs nfsroot=/srv/fai/nfsroot boot=live FAI_ACTION=install FAI_FLAGS=verbose,sshd,syslogd,createvt debug" else: root = "/dev/sda1 ro"