mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.293 (3f099372qAfv3K77sg6KIsluJAJOOQ)
Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/rac61/xeno.bk into labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/sos22/xeno.bk
This commit is contained in:
commit
e860bbb72e
6 files changed
+129
No files matched your search
@@ -31,7 +31,9 @@
|
||||
3f05631dMY7PMkwSY7zBFelGJ8goVg tools/control/src/org/xenoserver/cmdline/ParsePhysicalList.java
|
||||
3f05631dYDFXv6mwNFAgz3ta9kShJA tools/control/src/org/xenoserver/cmdline/ParsePhysicalRevoke.java
|
||||
3f098761TRsbDk9woUM846Q6_F7EmA tools/control/src/org/xenoserver/cmdline/ParseVdCreate.java
|
||||
3f099009pmH9MFkRYwP2V1DfsqEwdg tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java
|
||||
3f098761zh9WTV6LpRqcet3gqlXdtg tools/control/src/org/xenoserver/cmdline/ParseVdFree.java
|
||||
3f099009lDK_5xXO4gPyPpCTUhgnCA tools/control/src/org/xenoserver/cmdline/ParseVdRefresh.java
|
||||
3f098761vY4hzt_QKskmvMcibN0zYQ tools/control/src/org/xenoserver/cmdline/ParseVdShow.java
|
||||
3f042c35V-Bf3dlIe1r5mZs8ZTPSvA tools/control/src/org/xenoserver/control/Command.java
|
||||
3f042c35U_4O2eovLKUgo2avPPHKUw tools/control/src/org/xenoserver/control/CommandDomainDestroy.java
|
||||
@@ -45,6 +47,8 @@
|
||||
3f05631e_G6wzHhEnpihX0pIkEsbMw tools/control/src/org/xenoserver/control/CommandPhysicalList.java
|
||||
3f05631eGWxq7bojQbMa-tGxsENIhw tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java
|
||||
3f098761c5-idlmf9vWEMOlDw0VCHg tools/control/src/org/xenoserver/control/CommandVdCreate.java
|
||||
3f0990096KcyQw77qJmjTu941smS8A tools/control/src/org/xenoserver/control/CommandVdDelete.java
|
||||
3f0990093VJUL7QjxGigR5GPXf_Fkw tools/control/src/org/xenoserver/control/CommandVdRefresh.java
|
||||
3eb781fdBRXfSlWzK6GXlIQIlHFoaQ tools/control/src/org/xenoserver/control/Defaults.java
|
||||
3ec41f7cQ7Ug739JBDrsVH-7KJ5MvQ tools/control/src/org/xenoserver/control/Domain.java
|
||||
3ec41f7cAzdBu0lkuTTQx92rqSM9Qw tools/control/src/org/xenoserver/control/Extent.java
|
||||
|
||||
@@ -25,6 +25,8 @@ public class Main {
|
||||
};
|
||||
static final CommandParser vdcommands[] =
|
||||
{ new ParseVdCreate(),
|
||||
new ParseVdDelete(),
|
||||
new ParseVdRefresh(),
|
||||
new ParseVdShow(),
|
||||
new ParseVdFree()
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.xenoserver.cmdline;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.xenoserver.control.CommandFailedException;
|
||||
import org.xenoserver.control.CommandVdDelete;
|
||||
import org.xenoserver.control.Defaults;
|
||||
import org.xenoserver.control.VirtualDiskManager;
|
||||
|
||||
public class ParseVdDelete extends CommandParser {
|
||||
public void parse(Defaults d, LinkedList args) throws ParseFailedException, CommandFailedException {
|
||||
String vd_key = getStringParameter(args,'k',"");
|
||||
|
||||
if ( vd_key.equals("") )
|
||||
throw new ParseFailedException("Expected -k<key>");
|
||||
|
||||
loadState();
|
||||
if ( VirtualDiskManager.it.get_virtual_disk_key(vd_key) == null )
|
||||
throw new CommandFailedException("Virtual disk " + vd_key + " does not exist");
|
||||
|
||||
String output = new CommandVdDelete(vd_key).execute();
|
||||
if ( output != null )
|
||||
System.out.println( output );
|
||||
|
||||
saveState();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "delete";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "[-k<key>]";
|
||||
}
|
||||
|
||||
public String getHelpText() {
|
||||
return "Deletes the virtual disk with the specified key.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.xenoserver.cmdline;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.xenoserver.control.CommandFailedException;
|
||||
import org.xenoserver.control.CommandVdRefresh;
|
||||
import org.xenoserver.control.Defaults;
|
||||
|
||||
public class ParseVdRefresh extends CommandParser {
|
||||
public void parse(Defaults d, LinkedList args) throws ParseFailedException, CommandFailedException {
|
||||
String vd_key = getStringParameter(args,'k',"");
|
||||
String expiry_s = getStringParameter(args,'e',"");
|
||||
Date expiry;
|
||||
|
||||
if ( vd_key.equals("") )
|
||||
throw new ParseFailedException("Expected -k<key>");
|
||||
if ( expiry_s.equals("") )
|
||||
expiry = null;
|
||||
else
|
||||
expiry = new Date(Date.parse(expiry_s));
|
||||
|
||||
loadState();
|
||||
String output = new CommandVdRefresh(vd_key,expiry).execute();
|
||||
if ( output != null )
|
||||
System.out.println(output);
|
||||
saveState();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "refresh";
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return "-k<key> [-e<expiry>]";
|
||||
}
|
||||
|
||||
public String getHelpText() {
|
||||
return "Refresh the expiry for the specified virtual disk. Omitting -e will cause the disk to never expire.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.xenoserver.control;
|
||||
|
||||
public class CommandVdDelete extends Command {
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* Constructor for CommandVdDelete.
|
||||
* @param key The key of the disk to delete.
|
||||
*/
|
||||
public CommandVdDelete(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String execute() throws CommandFailedException {
|
||||
VirtualDiskManager.it.delete_virtual_disk(key);
|
||||
return "Deleted virtual disk " + key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.xenoserver.control;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class CommandVdRefresh extends Command {
|
||||
private String key;
|
||||
private Date expiry;
|
||||
|
||||
/**
|
||||
* Constructor for CommandVdRefresh.
|
||||
* @param key Key to refresh.
|
||||
* @param expiry New expiry.
|
||||
*/
|
||||
public CommandVdRefresh(String key, Date expiry) {
|
||||
this.key = key;
|
||||
this.expiry = expiry;
|
||||
}
|
||||
|
||||
public String execute() throws CommandFailedException {
|
||||
VirtualDiskManager.it.refresh_virtual_disk(key,expiry);
|
||||
return "Refreshed virtual disk " + key;
|
||||
}
|
||||
}
|
||||