ia64/xen-unstable

changeset 715:4778f77eb1bf

bitkeeper revision 1.424 (3f604b3bXFcuMeirDE8BxjFaH5y6eA)

Many files:
Follow parition names through /dev sym-links
CommandVbdCreatePhysical.java:
*** empty log message ***
author tlh20@labyrinth.cl.cam.ac.uk
date Thu Sep 11 10:15:23 2003 +0000 (2003-09-11)
parents 0dd18b6d0c08
children 0b04d8a47390 ec38a236c5db
files tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java tools/control/src/org/xenoserver/control/Defaults.java tools/control/xenctl tools/internal/xi_helper
line diff
     1.1 --- a/tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java	Wed Sep 10 17:20:23 2003 +0000
     1.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java	Thu Sep 11 10:15:23 2003 +0000
     1.3 @@ -37,7 +37,7 @@ public class ParseVbdCreate extends Comm
     1.4          loadState();
     1.5          String output;
     1.6          if (vd_key.equals("")) {
     1.7 -            output = new CommandVbdCreatePhysical( partition_name, domain_id, vbd_num, mode ).execute();
     1.8 +            output = new CommandVbdCreatePhysical(d,  partition_name, domain_id, vbd_num, mode ).execute();
     1.9          } else {
    1.10              output =
    1.11                  new CommandVbdCreate(vd_key, domain_id, vbd_num, mode).execute();
     2.1 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java	Wed Sep 10 17:20:23 2003 +0000
     2.2 +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java	Thu Sep 11 10:15:23 2003 +0000
     2.3 @@ -43,10 +43,11 @@ public class CommandPhysicalGrant extend
     2.4          Runtime r = Runtime.getRuntime();
     2.5          String output = null;
     2.6  	String resolved = StringPattern.parse(partition_name).resolve(domain_id);
     2.7 -        Partition partition = PartitionManager.IT.getPartition(resolved);
     2.8 +	String resolved2 = d.runCommand(d.xiToolsDir + Settings.XI_HELPER + " expand " + resolved).trim();
     2.9 +        Partition partition = PartitionManager.IT.getPartition(resolved2);
    2.10      
    2.11          if ( partition == null ) {
    2.12 -          throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved + ") does not exist.");
    2.13 +          throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved2 + ") does not exist.");
    2.14          }
    2.15      
    2.16          // Check if this partition belongs to the VDM
     3.1 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java	Wed Sep 10 17:20:23 2003 +0000
     3.2 +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java	Thu Sep 11 10:15:23 2003 +0000
     3.3 @@ -30,10 +30,11 @@ public class CommandPhysicalRevoke exten
     3.4          Runtime r = Runtime.getRuntime();
     3.5          String output = null;
     3.6  	String resolved = StringPattern.parse(partition_name).resolve(domain_id);
     3.7 -        Partition partition = PartitionManager.IT.getPartition(resolved);
     3.8 +	String resolved2 = d.runCommand(d.xiToolsDir + Settings.XI_HELPER + " expand " + resolved).trim();
     3.9 +        Partition partition = PartitionManager.IT.getPartition(resolved2);
    3.10  
    3.11          if (partition == null) {
    3.12 -          throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved + ") does not exist.");
    3.13 +          throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved2 + ") does not exist.");
    3.14          }
    3.15  
    3.16          try {
     4.1 --- a/tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java	Wed Sep 10 17:20:23 2003 +0000
     4.2 +++ b/tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java	Thu Sep 11 10:15:23 2003 +0000
     4.3 @@ -7,6 +7,8 @@ import java.io.IOException;
     4.4   * Create a virtual block device.
     4.5   */
     4.6  public class CommandVbdCreatePhysical extends Command {
     4.7 +    /** Defaults instance to use. */
     4.8 +    private Defaults d;
     4.9      /** Virtual disk to map to. */
    4.10      private String partition_name;
    4.11      /** Domain to create VBD for. */
    4.12 @@ -24,10 +26,12 @@ public class CommandVbdCreatePhysical ex
    4.13       * @param mode Access mode to grant.
    4.14       */
    4.15      public CommandVbdCreatePhysical(
    4.16 -        String partition,
    4.17 +        Defaults d, 
    4.18 +	String partition,
    4.19          int domain_id,
    4.20          int vbd_num,
    4.21          Mode mode) {
    4.22 +        this.d = d;
    4.23          this.partition_name = partition;
    4.24          this.domain_id = domain_id;
    4.25          this.vbd_num = vbd_num;
    4.26 @@ -39,10 +43,11 @@ public class CommandVbdCreatePhysical ex
    4.27       */
    4.28      public String execute() throws CommandFailedException {
    4.29          String resolved = StringPattern.parse(partition_name).resolve(domain_id);
    4.30 -        Partition partition = PartitionManager.IT.getPartition(resolved);
    4.31 +	String resolved2 = d.runCommand(d.xiToolsDir + Settings.XI_HELPER + " expand " + resolved).trim();
    4.32 +        Partition partition = PartitionManager.IT.getPartition(resolved2);
    4.33          if (partition == null) {
    4.34              throw new CommandFailedException(
    4.35 -                "No partition " + partition_name + " (resolved to " + resolved + ") exists");
    4.36 +                "No partition " + partition_name + " (resolved to " + resolved2 + ") exists");
    4.37          }
    4.38  
    4.39          VirtualDisk vd = new VirtualDisk("vbd:" + partition.getName());
     5.1 --- a/tools/control/src/org/xenoserver/control/Defaults.java	Wed Sep 10 17:20:23 2003 +0000
     5.2 +++ b/tools/control/src/org/xenoserver/control/Defaults.java	Thu Sep 11 10:15:23 2003 +0000
     5.3 @@ -215,7 +215,7 @@ public class Defaults {
     5.4       * @param command Command string to run.
     5.5       * @return Command's output.
     5.6       */
     5.7 -    private String runCommand(String command) {
     5.8 +    String runCommand(String command) {
     5.9          Runtime runtime = Runtime.getRuntime();
    5.10          String outline;
    5.11          StringBuffer output = new StringBuffer();
     6.1 --- a/tools/control/xenctl	Wed Sep 10 17:20:23 2003 +0000
     6.2 +++ b/tools/control/xenctl	Thu Sep 11 10:15:23 2003 +0000
     6.3 @@ -8,6 +8,6 @@ if [ -z "$ROUTE" ] ; then ROUTE=/sbin/ro
     6.4  if [ -z "$JAVA" ] ; then JAVA=java ; fi
     6.5  
     6.6  
     6.7 -ARGS="-DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH"
     6.8 +ARGS="$XENCTLARGS -DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH"
     6.9  
    6.10  $JAVA $ARGS -jar $(dirname $0)/xenctl-cmdline.jar $*
     7.1 --- a/tools/internal/xi_helper	Wed Sep 10 17:20:23 2003 +0000
     7.2 +++ b/tools/internal/xi_helper	Thu Sep 11 10:15:23 2003 +0000
     7.3 @@ -13,3 +13,12 @@ fi
     7.4  if [ "$1" = "route" ] ; then
     7.5    /sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}'
     7.6  fi
     7.7 +
     7.8 +if [ "$1" = "expand" ] ; then
     7.9 +  cd /dev/
    7.10 +  CURRENT=$2
    7.11 +  if [ -h "$CURRENT" ] ; then
    7.12 +    CURRENT=$(basename $(stat -c%N $CURRENT | tr -d "\`\'" | awk '{print $3}'))
    7.13 +  fi
    7.14 +  echo $CURRENT
    7.15 +fi
    7.16 \ No newline at end of file