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();
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
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 {
* 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. */
* @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;
*/
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());
* @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();
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 $*
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