mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
bitkeeper revision 1.424 (3f604b3bXFcuMeirDE8BxjFaH5y6eA)
Many files: Follow parition names through /dev sym-links CommandVbdCreatePhysical.java: *** empty log message ***
This commit is contained in:
1 parent
ea0145702f
commit
e2c12cbc69
7 files changed
+26
-10
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 $*
|
||||
@@ -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
|
||||