diff options
author | tlh20@labyrinth.cl.cam.ac.uk <tlh20@labyrinth.cl.cam.ac.uk> | 2003-09-11 10:15:23 +0000 |
---|---|---|
committer | tlh20@labyrinth.cl.cam.ac.uk <tlh20@labyrinth.cl.cam.ac.uk> | 2003-09-11 10:15:23 +0000 |
commit | e2c12cbc69135bc8305bc2e652bbb80b518973f6 (patch) | |
tree | e37ed80f26e2769fd44f38aefbcdc908179f042e /tools | |
parent | ea0145702fd3d3e964e0b1a67c9a0a3a3bc6b257 (diff) | |
download | xen-e2c12cbc69135bc8305bc2e652bbb80b518973f6.tar.gz xen-e2c12cbc69135bc8305bc2e652bbb80b518973f6.tar.bz2 xen-e2c12cbc69135bc8305bc2e652bbb80b518973f6.zip |
bitkeeper revision 1.424 (3f604b3bXFcuMeirDE8BxjFaH5y6eA)
Many files:
Follow parition names through /dev sym-links
CommandVbdCreatePhysical.java:
*** empty log message ***
Diffstat (limited to 'tools')
7 files changed, 26 insertions, 10 deletions
diff --git a/tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java b/tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java index cacb987816..e002fcf4d0 100644 --- a/tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java +++ b/tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java @@ -37,7 +37,7 @@ public class ParseVbdCreate extends CommandParser { loadState(); String output; if (vd_key.equals("")) { - output = new CommandVbdCreatePhysical( partition_name, domain_id, vbd_num, mode ).execute(); + output = new CommandVbdCreatePhysical(d, partition_name, domain_id, vbd_num, mode ).execute(); } else { output = new CommandVbdCreate(vd_key, domain_id, vbd_num, mode).execute(); diff --git a/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java b/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java index 68194e912d..9ce195d7d1 100644 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java @@ -43,10 +43,11 @@ public class CommandPhysicalGrant extends Command { Runtime r = Runtime.getRuntime(); String output = null; String resolved = StringPattern.parse(partition_name).resolve(domain_id); - Partition partition = PartitionManager.IT.getPartition(resolved); + String resolved2 = d.runCommand(d.xiToolsDir + Settings.XI_HELPER + " expand " + resolved).trim(); + Partition partition = PartitionManager.IT.getPartition(resolved2); if ( partition == null ) { - throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved + ") does not exist."); + throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved2 + ") does not exist."); } // Check if this partition belongs to the VDM diff --git a/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java b/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java index b752473001..82766e6d80 100644 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java @@ -30,10 +30,11 @@ public class CommandPhysicalRevoke extends Command { Runtime r = Runtime.getRuntime(); String output = null; String resolved = StringPattern.parse(partition_name).resolve(domain_id); - Partition partition = PartitionManager.IT.getPartition(resolved); + String resolved2 = d.runCommand(d.xiToolsDir + Settings.XI_HELPER + " expand " + resolved).trim(); + Partition partition = PartitionManager.IT.getPartition(resolved2); if (partition == null) { - throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved + ") does not exist."); + throw new CommandFailedException("Partition " + partition_name + " (resolved to " + resolved2 + ") does not exist."); } try { diff --git a/tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java b/tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java index 2f63446e01..9e974b2bd9 100644 --- a/tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java +++ b/tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java @@ -7,6 +7,8 @@ import java.io.IOException; * Create a virtual block device. */ public class CommandVbdCreatePhysical extends Command { + /** Defaults instance to use. */ + private Defaults d; /** Virtual disk to map to. */ private String partition_name; /** Domain to create VBD for. */ @@ -24,10 +26,12 @@ public class CommandVbdCreatePhysical extends Command { * @param mode Access mode to grant. */ public CommandVbdCreatePhysical( - String partition, + Defaults d, + String partition, int domain_id, int vbd_num, Mode mode) { + this.d = d; this.partition_name = partition; this.domain_id = domain_id; this.vbd_num = vbd_num; @@ -39,10 +43,11 @@ public class CommandVbdCreatePhysical extends Command { */ public String execute() throws CommandFailedException { String resolved = StringPattern.parse(partition_name).resolve(domain_id); - Partition partition = PartitionManager.IT.getPartition(resolved); + String resolved2 = d.runCommand(d.xiToolsDir + Settings.XI_HELPER + " expand " + resolved).trim(); + Partition partition = PartitionManager.IT.getPartition(resolved2); if (partition == null) { throw new CommandFailedException( - "No partition " + partition_name + " (resolved to " + resolved + ") exists"); + "No partition " + partition_name + " (resolved to " + resolved2 + ") exists"); } VirtualDisk vd = new VirtualDisk("vbd:" + partition.getName()); diff --git a/tools/control/src/org/xenoserver/control/Defaults.java b/tools/control/src/org/xenoserver/control/Defaults.java index e64f6e19d1..bf5cc62d8e 100644 --- a/tools/control/src/org/xenoserver/control/Defaults.java +++ b/tools/control/src/org/xenoserver/control/Defaults.java @@ -215,7 +215,7 @@ public class Defaults { * @param command Command string to run. * @return Command's output. */ - private String runCommand(String command) { + String runCommand(String command) { Runtime runtime = Runtime.getRuntime(); String outline; StringBuffer output = new StringBuffer(); diff --git a/tools/control/xenctl b/tools/control/xenctl index d653d7d8a4..a562502193 100755 --- a/tools/control/xenctl +++ b/tools/control/xenctl @@ -8,6 +8,6 @@ if [ -z "$ROUTE" ] ; then ROUTE=/sbin/route ; fi if [ -z "$JAVA" ] ; then JAVA=java ; fi -ARGS="-DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH" +ARGS="$XENCTLARGS -DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH" $JAVA $ARGS -jar $(dirname $0)/xenctl-cmdline.jar $* diff --git a/tools/internal/xi_helper b/tools/internal/xi_helper index 8c1f8e1eb1..9e33af7b52 100755 --- a/tools/internal/xi_helper +++ b/tools/internal/xi_helper @@ -13,3 +13,12 @@ fi if [ "$1" = "route" ] ; then /sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}' fi + +if [ "$1" = "expand" ] ; then + cd /dev/ + CURRENT=$2 + if [ -h "$CURRENT" ] ; then + CURRENT=$(basename $(stat -c%N $CURRENT | tr -d "\`\'" | awk '{print $3}')) + fi + echo $CURRENT +fi
\ No newline at end of file |