bitkeeper revision 1.424 (3f604b3bXFcuMeirDE8BxjFaH5y6eA)
authortlh20@labyrinth.cl.cam.ac.uk <tlh20@labyrinth.cl.cam.ac.uk>
Thu, 11 Sep 2003 10:15:23 +0000 (10:15 +0000)
committertlh20@labyrinth.cl.cam.ac.uk <tlh20@labyrinth.cl.cam.ac.uk>
Thu, 11 Sep 2003 10:15:23 +0000 (10:15 +0000)
Many files:
  Follow parition names through /dev sym-links
CommandVbdCreatePhysical.java:
  *** empty log message ***

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

index cacb9878162c33181ace11ab3b43e7fed57d28bc..e002fcf4d046992429ff6808e3abbffb2de6419a 100644 (file)
@@ -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();
index 68194e912d16bc9f91fe2c44963efd49da04e45a..9ce195d7d12d9c706c533eef2b3e0b90f30b50ba 100644 (file)
@@ -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
index b752473001a8b679373f89bbeab005ff2c65be48..82766e6d803db990fbf88137f6e4fd76cda32e44 100644 (file)
@@ -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 {
index 2f63446e0150a0cb41e75e888ef3172376b1e23d..9e974b2bd9712d7222bc84cd4002055bf30e2983 100644 (file)
@@ -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());
index e64f6e19d16160603c2853cb24723604b7f5d61a..bf5cc62d8e0f954243b86b4df67eac974458664e 100644 (file)
@@ -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();
index d653d7d8a4849dd6676c2f1a20c93ca1e7be66b3..a562502193b6d817e1756d368d7e15b45a86ca27 100755 (executable)
@@ -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 $*
index 8c1f8e1eb1d815e8487b36c39ed767569fc8570e..9e33af7b5225cf784030118de78ebe61f5c4b823 100755 (executable)
@@ -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