ia64/xen-unstable

changeset 729:5dab2fb654cd

bitkeeper revision 1.433 (3f699687J_HgoywKoa1018zIpJGRrQ)

CommandDomainNew.java, ParseDomainNew.java, Main.java, CommandParser.java:
Expand + in -a and -t, allow spaces
author tlh20@labyrinth.cl.cam.ac.uk
date Thu Sep 18 11:27:03 2003 +0000 (2003-09-18)
parents 37cb4dcb88fb
children 5916b2c0e9e3 63f8f6b56437
files tools/control/src/org/xenoserver/cmdline/CommandParser.java tools/control/src/org/xenoserver/cmdline/Main.java tools/control/src/org/xenoserver/cmdline/ParseDomainNew.java tools/control/src/org/xenoserver/control/CommandDomainNew.java
line diff
     1.1 --- a/tools/control/src/org/xenoserver/cmdline/CommandParser.java	Thu Sep 18 08:19:53 2003 +0000
     1.2 +++ b/tools/control/src/org/xenoserver/cmdline/CommandParser.java	Thu Sep 18 11:27:03 2003 +0000
     1.3 @@ -84,7 +84,7 @@ public abstract class CommandParser {
     1.4       */
     1.5      public int getIntParameter(List args, char key, int def) {
     1.6          String r = getParameter(args, key);
     1.7 -        return (r == null) ? def : (Integer.parseInt(r));
     1.8 +        return (r == null) ? def : (Integer.parseInt(r.trim()));
     1.9      }
    1.10  
    1.11      /**
     2.1 --- a/tools/control/src/org/xenoserver/cmdline/Main.java	Thu Sep 18 08:19:53 2003 +0000
     2.2 +++ b/tools/control/src/org/xenoserver/cmdline/Main.java	Thu Sep 18 11:27:03 2003 +0000
     2.3 @@ -64,8 +64,27 @@ public class Main {
     2.4      Defaults d = new Defaults();
     2.5      int ec = -1;
     2.6      LinkedList arglist = new LinkedList();
     2.7 +    boolean seen_arg = false;
     2.8 +    String collected = null;
     2.9      for ( int i=0; i<args.length; i++ ) {
    2.10 -      arglist.add( args[i] );
    2.11 +      if (!(args[i].startsWith("-"))) {
    2.12 +	if (seen_arg) {
    2.13 +	  collected += " " + args[i];
    2.14 +	} else {
    2.15 +	  arglist.add(args[i]);
    2.16 +	}
    2.17 +      }
    2.18 +      if (args[i].startsWith("-")) {
    2.19 +	if (collected != null) {
    2.20 +	  arglist.add ( collected );
    2.21 +	  collected = null;
    2.22 +	}
    2.23 +	collected = args[i];
    2.24 +	seen_arg = true;
    2.25 +      }
    2.26 +    }
    2.27 +    if (collected != null) {
    2.28 +      arglist.add( collected );
    2.29      }
    2.30  
    2.31      try {
     3.1 --- a/tools/control/src/org/xenoserver/cmdline/ParseDomainNew.java	Thu Sep 18 08:19:53 2003 +0000
     3.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseDomainNew.java	Thu Sep 18 11:27:03 2003 +0000
     3.3 @@ -17,7 +17,7 @@ public class ParseDomainNew extends Comm
     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 root_args = getStringParameter(args, 't', d.rootArgs);
    3.11          String usr_dev = getStringParameter(args, 'u', d.usrDevice);
     4.1 --- a/tools/control/src/org/xenoserver/control/CommandDomainNew.java	Thu Sep 18 08:19:53 2003 +0000
     4.2 +++ b/tools/control/src/org/xenoserver/control/CommandDomainNew.java	Thu Sep 18 11:27:03 2003 +0000
     4.3 @@ -212,6 +212,7 @@ public class CommandDomainNew extends Co
     4.4                  }
     4.5  
     4.6                  /* Set up boot parameters to pass to xi_build. */
     4.7 +		bargs = StringPattern.parse(bargs).resolve(domain_id) + " ";
     4.8                  if (root_dev.equals("/dev/nfs")) {
     4.9                      if (vifs == 0) {
    4.10                          throw new CommandFailedException("Cannot use NFS root without VIFs configured");
    4.11 @@ -224,7 +225,7 @@ public class CommandDomainNew extends Co
    4.12                      }
    4.13                      bargs =
    4.14                          (bargs
    4.15 -                            + " root=/dev/nfs " + root_args + " " 
    4.16 +                            + " root=/dev/nfs " + StringPattern.parse(root_args).resolve(domain_id) + " " 
    4.17                              + "nfsroot="
    4.18                              + StringPattern.parse(nfs_root_path).resolve(
    4.19                                  domain_id)
    4.20 @@ -234,7 +235,7 @@ public class CommandDomainNew extends Co
    4.21                          (bargs
    4.22                              + " root="
    4.23                              + StringPattern.parse(root_dev).resolve(domain_id)
    4.24 -                            + " " + root_args + " ");
    4.25 +                            + " " + StringPattern.parse(root_args).resolve(domain_id) + " ");
    4.26  
    4.27                  }
    4.28                  
    4.29 @@ -258,19 +259,19 @@ public class CommandDomainNew extends Co
    4.30                          ("ip="
    4.31                              + domain_ip
    4.32                              + ":"
    4.33 -                            + ((nw_nfs_server == null)
    4.34 +                            + ((nw_nfs_server == null || nw_nfs_server.equals(""))
    4.35                                  ? ""
    4.36                                  : (InetAddressPattern
    4.37                                      .parse(nw_nfs_server)
    4.38                                      .resolve(domain_id)))
    4.39                              + ":"
    4.40 -                            + ((nw_gw == null)
    4.41 +                            + ((nw_gw == null || nw_gw.equals(""))
    4.42                                  ? ""
    4.43                                  : (InetAddressPattern
    4.44                                      .parse(nw_gw)
    4.45                                      .resolve(domain_id)))
    4.46                              + ":"
    4.47 -                            + ((nw_mask == null)
    4.48 +                            + ((nw_mask == null || nw_mask.equals(""))
    4.49                                  ? ""
    4.50                                  : InetAddressPattern.parse(nw_mask).resolve(
    4.51                                      domain_id))
    4.52 @@ -342,6 +343,7 @@ public class CommandDomainNew extends Co
    4.53          } catch (CommandFailedException e) {
    4.54              throw e;
    4.55          } catch (Exception e) {
    4.56 +					     e.printStackTrace();
    4.57              throw new CommandFailedException(
    4.58                  "Could not create new domain (" + e + ")",
    4.59                  e);