ia64/xen-unstable

changeset 435:9d017b39d2bf

bitkeeper revision 1.217 (3eba1d1aDFDJBD7-4CxJgolbh-GlMA)

Merge with IAP's extra args
author tlh20@elite.cl.cam.ac.uk
date Thu May 08 09:02:18 2003 +0000 (2003-05-08)
parents cc46db262f46 3972b49a8ed2
children 7532e5590c1f f51904cbaf32
files tools/domctl/domctl tools/domctl/domctl.xml tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Defaults.java
line diff
     1.1 --- a/tools/domctl/domctl	Wed May 07 17:01:06 2003 +0000
     1.2 +++ b/tools/domctl/domctl	Thu May 08 09:02:18 2003 +0000
     1.3 @@ -1,4 +1,4 @@
     1.4 -#!/bin/bash -x
     1.5 +#!/bin/bash 
     1.6  
     1.7  if [ -z "$DEFAULTS_FILE" ] ; then DEFAULTS_FILE=domctl.xml ; fi
     1.8  if [ -z "$DEFAULTS_PATH" ] ; then DEFAULTS_PATH=.:/etc ; fi
     1.9 @@ -7,25 +7,27 @@ if [ -z "$IFCONFIG" ] ; then IFCONFIG=/s
    1.10  if [ -z "$ROUTE" ] ; then ROUTE=/sbin/route ; fi
    1.11  if [ -z "$JAVA" ] ; then JAVA=java ; fi
    1.12  
    1.13 -if [ ! -x "$IFCONFIG" ]; then
    1.14 -  echo Could not find executable $IFCONFIG
    1.15 -  exit 1
    1.16 -fi
    1.17 +if [ "$1" = "new" ] ; then
    1.18 +  if [ ! -x "$IFCONFIG" ]; then  
    1.19 +    echo Could not find executable $IFCONFIG
    1.20 +    exit 1
    1.21 +  fi
    1.22  
    1.23 -if [ ! -x "$ROUTE" ]; then
    1.24 -  echo Could not find executable $ROUTE
    1.25 -  exit 1
    1.26 -fi
    1.27 +  if [ ! -x "$ROUTE" ]; then
    1.28 +    echo Could not find executable $ROUTE
    1.29 +    exit 1
    1.30 +  fi
    1.31  
    1.32 -# Try to determine dom0 network settings to avoid hard-coding
    1.33 -# particular machines in the defaults file
    1.34 -LOCAL_IP=$(/sbin/ifconfig $QUERY_DEV | grep 'inet addr' | tr ':' '\t' | awk '{print $3}')
    1.35 -LOCAL_MASK=$(/sbin/ifconfig $QUERY_DEV | grep 'Mask' | tr ':' '\t' | awk '{print $7}')
    1.36 -LOCAL_ROUTE=$(/sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}')
    1.37 +  # Try to determine dom0 network settings to avoid hard-coding
    1.38 +  # particular machines in the defaults file
    1.39 +  LOCAL_IP=$(/sbin/ifconfig $QUERY_DEV | grep 'inet addr' | tr ':' '\t' | awk '{print $3}')
    1.40 +  LOCAL_MASK=$(/sbin/ifconfig $QUERY_DEV | grep 'Mask' | tr ':' '\t' | awk '{print $7}')
    1.41 +  LOCAL_ROUTE=$(/sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}')
    1.42 +fi
    1.43  
    1.44  
    1.45  #ARGS="-DTEST -DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH -DLOCAL_IP=$LOCAL_IP -DLOCAL_MASK=$LOCAL_MASK -DLOCAL_ROUTE=$LOCAL_ROUTE"
    1.46  ARGS="-DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH -DLOCAL_IP=$LOCAL_IP -DLOCAL_MASK=$LOCAL_MASK -DLOCAL_ROUTE=$LOCAL_ROUTE"
    1.47  
    1.48  
    1.49 -$JAVA $ARGS -jar domctl.jar $*
    1.50 +$JAVA $ARGS -jar $(dirname $0)/domctl.jar $*
     2.1 --- a/tools/domctl/domctl.xml	Wed May 07 17:01:06 2003 +0000
     2.2 +++ b/tools/domctl/domctl.xml	Thu May 08 09:02:18 2003 +0000
     2.3 @@ -10,6 +10,6 @@
     2.4  <nw_mask>=</nw_mask>
     2.5  <nw_nfs_server>128.232.32.20</nw_nfs_server>
     2.6  <nw_nfs_root>/usr/groups/srgboot/moonraider/roots/root+</nw_nfs_root>
     2.7 -<max_domain_number>2</max_domain_number>
     2.8 +<max_domain_number>10</max_domain_number>
     2.9  <xi_tools_dir>/tools/internal/</xi_tools_dir>
    2.10  </domctl_defaults>
     3.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java	Wed May 07 17:01:06 2003 +0000
     3.2 +++ b/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java	Thu May 08 09:02:18 2003 +0000
     3.3 @@ -13,7 +13,7 @@ public class CommandNew extends Command
     3.4      String image = getStringParameter(args, 'i', d.domainImage);
     3.5      String initrd = getStringParameter (args, 'r', d.domainInitRD);
     3.6      int vifs = getIntParameter(args, 'v', d.domainVIFs);
     3.7 -    String bargs = getStringParameter (args, 'a', d.args);
     3.8 +    String bargs = getStringParameter (args, 'a', d.args) + " ";
     3.9      String root_dev = getStringParameter (args, 'd', d.rootDevice);
    3.10      String nfs_root_path = getStringParameter (args, 'f', d.NWNFSRoot);
    3.11      String nw_ip = getStringParameter (args, '4', d.NWIP);
    3.12 @@ -23,11 +23,12 @@ public class CommandNew extends Command
    3.13      String nw_host = getStringParameter (args, 'h', d.NWHost);
    3.14      String domain_ip = "";
    3.15      int rc = 0;
    3.16 -    int domain_id;
    3.17 +    int domain_id = -1;
    3.18      DataInputStream dis;
    3.19      int idx;
    3.20      int i;
    3.21  
    3.22 +    d.describe ();
    3.23  
    3.24      try
    3.25        {
    3.26 @@ -60,19 +61,25 @@ public class CommandNew extends Command
    3.27  	  return reportError ("Cannot configure more than " + 
    3.28  			      d.MaxDomainNumber + " domains");
    3.29  	}
    3.30 -	
    3.31 +
    3.32  	/* Set up boot parameters to pass to xi_build. */
    3.33 -        bargs += " ";
    3.34  	if (root_dev.equals ("/dev/nfs")) {
    3.35  	  if (vifs == 0) {
    3.36  	    return reportError ("Cannot use NFS root without VIFs configured");
    3.37  	  }
    3.38 +	  if (nfs_root_path == null) {
    3.39 +	    return reportError ("No NFS root specified");
    3.40 +	  }
    3.41 +	  if (nw_nfs_server == null) {
    3.42 +	    return reportError ("No NFS server specified");
    3.43 +	  }
    3.44  	  bargs = (bargs + 
    3.45  		   "root=/dev/nfs " +
    3.46  		   "nfsroot=" + StringPattern.parse(nfs_root_path).resolve(domain_id) +
    3.47  		   " ");
    3.48  	} else {
    3.49 -	  bargs = ("root=" + StringPattern.parse(root_dev).resolve(domain_id) +
    3.50 +	  bargs = (bargs + 
    3.51 +		   "root=" + StringPattern.parse(root_dev).resolve(domain_id) +
    3.52  		   " ");
    3.53  
    3.54  	}
    3.55 @@ -88,10 +95,10 @@ public class CommandNew extends Command
    3.56  	    
    3.57  	  }
    3.58  	  bargs = ("ip=" + domain_ip +
    3.59 -		   ":" + InetAddressPattern.parse(nw_nfs_server).resolve(domain_id) +
    3.60 -		   ":" + InetAddressPattern.parse(nw_gw).resolve(domain_id) + 
    3.61 -		   ":" + InetAddressPattern.parse(nw_mask).resolve(domain_id) +
    3.62 -		   ":" + nw_host + 
    3.63 +		   ":" + ((nw_nfs_server == null) ? "" : (InetAddressPattern.parse(nw_nfs_server).resolve(domain_id))) +
    3.64 +		   ":" + ((nw_gw == null) ? "" : (InetAddressPattern.parse(nw_gw).resolve(domain_id))) + 
    3.65 +		   ":" + ((nw_mask == null) ? "" : InetAddressPattern.parse(nw_mask).resolve(domain_id)) +
    3.66 +		   ":" + ((nw_host == null) ? "" : nw_host) + 
    3.67  		   ":eth0:off " + bargs);
    3.68  	}
    3.69  	
    3.70 @@ -151,6 +158,10 @@ public class CommandNew extends Command
    3.71  	rc = -1;
    3.72        }
    3.73  
    3.74 +    if (rc == 0) {
    3.75 +      System.out.println ("Created domain " + domain_id);
    3.76 +    }
    3.77 +
    3.78      return rc;
    3.79    }
    3.80  
     4.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Defaults.java	Wed May 07 17:01:06 2003 +0000
     4.2 +++ b/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Defaults.java	Thu May 08 09:02:18 2003 +0000
     4.3 @@ -24,8 +24,7 @@ public class Defaults
     4.4    String NWNFSServer;
     4.5    String NWNFSRoot;
     4.6  
     4.7 -  int MaxDomainNumber;
     4.8 -
     4.9 +  int MaxDomainNumber = Integer.MAX_VALUE;
    4.10    String args = "";
    4.11  
    4.12    String XIToolsDir;
    4.13 @@ -35,7 +34,6 @@ public class Defaults
    4.14    public Defaults ()
    4.15    {
    4.16      File f = Settings.getDefaultsFile ();
    4.17 -    System.out.println ("f=" + f);
    4.18  
    4.19      try
    4.20        {
    4.21 @@ -52,22 +50,24 @@ public class Defaults
    4.22  	e.printStackTrace();
    4.23  	System.exit(1);
    4.24        }
    4.25 +  }
    4.26  
    4.27 +  public void describe () {
    4.28      System.out.println ("Domain defaults:");
    4.29 -    System.out.println ("   name        " + domainName);
    4.30 -    System.out.println ("   size        " + domainSizeKB);
    4.31 -    System.out.println ("   vifs        " + domainVIFs);
    4.32 -    System.out.println ("   domainImage " + domainImage);
    4.33 -    System.out.println ("   domainInitRD " + domainInitRD);
    4.34 -    System.out.println ("   rootDevice " + rootDevice);
    4.35 -    System.out.println ("   NWIP " + NWIP);
    4.36 -    System.out.println ("   NWGW " + NWGW);
    4.37 -    System.out.println ("   NWMask " + NWMask);
    4.38 +    System.out.println ("   name            " + domainName);
    4.39 +    System.out.println ("   size            " + domainSizeKB);
    4.40 +    System.out.println ("   vifs            " + domainVIFs);
    4.41 +    System.out.println ("   domainImage     " + domainImage);
    4.42 +    System.out.println ("   domainInitRD    " + domainInitRD);
    4.43 +    System.out.println ("   rootDevice      " + rootDevice);
    4.44 +    System.out.println ("   NWIP            " + NWIP);
    4.45 +    System.out.println ("   NWGW            " + NWGW);
    4.46 +    System.out.println ("   NWMask          " + NWMask);
    4.47      System.out.println ("   MaxDomainNumber " + MaxDomainNumber);
    4.48 -    System.out.println ("   NWNFSServer " + NWNFSServer);
    4.49 -    System.out.println ("   NWNFSRoot " + NWNFSRoot);
    4.50 -    System.out.println ("   XIToolsDir " + XIToolsDir);
    4.51 -    System.out.println ("   args " + args);
    4.52 +    System.out.println ("   NWNFSServer     " + NWNFSServer);
    4.53 +    System.out.println ("   NWNFSRoot       " + NWNFSRoot);
    4.54 +    System.out.println ("   XIToolsDir      " + XIToolsDir);
    4.55 +    System.out.println ("   args            " + args);
    4.56    }
    4.57  
    4.58    /***********************************************************************/