ia64/xen-unstable
changeset 527:25c290356870
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
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
author | sos22@labyrinth.cl.cam.ac.uk |
---|---|
date | Mon Jul 07 15:36:18 2003 +0000 (2003-07-07) |
parents | 155febe2fe2b ae364085dd0c |
children | 4ebe3235a8f3 |
files | .rootkeys tools/control/src/org/xenoserver/cmdline/Main.java tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java tools/control/src/org/xenoserver/cmdline/ParseVdRefresh.java tools/control/src/org/xenoserver/control/CommandVdDelete.java tools/control/src/org/xenoserver/control/CommandVdRefresh.java |
line diff
1.1 --- a/.rootkeys Mon Jul 07 15:18:36 2003 +0000 1.2 +++ b/.rootkeys Mon Jul 07 15:36:18 2003 +0000 1.3 @@ -31,7 +31,9 @@ 3f05631dswxJX_TpcuG6tBstyHSetg tools/con 1.4 3f05631dMY7PMkwSY7zBFelGJ8goVg tools/control/src/org/xenoserver/cmdline/ParsePhysicalList.java 1.5 3f05631dYDFXv6mwNFAgz3ta9kShJA tools/control/src/org/xenoserver/cmdline/ParsePhysicalRevoke.java 1.6 3f098761TRsbDk9woUM846Q6_F7EmA tools/control/src/org/xenoserver/cmdline/ParseVdCreate.java 1.7 +3f099009pmH9MFkRYwP2V1DfsqEwdg tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java 1.8 3f098761zh9WTV6LpRqcet3gqlXdtg tools/control/src/org/xenoserver/cmdline/ParseVdFree.java 1.9 +3f099009lDK_5xXO4gPyPpCTUhgnCA tools/control/src/org/xenoserver/cmdline/ParseVdRefresh.java 1.10 3f098761vY4hzt_QKskmvMcibN0zYQ tools/control/src/org/xenoserver/cmdline/ParseVdShow.java 1.11 3f042c35V-Bf3dlIe1r5mZs8ZTPSvA tools/control/src/org/xenoserver/control/Command.java 1.12 3f042c35U_4O2eovLKUgo2avPPHKUw tools/control/src/org/xenoserver/control/CommandDomainDestroy.java 1.13 @@ -45,6 +47,8 @@ 3f05631ev3UK5FRi5vgR08zDp3OZYw tools/con 1.14 3f05631e_G6wzHhEnpihX0pIkEsbMw tools/control/src/org/xenoserver/control/CommandPhysicalList.java 1.15 3f05631eGWxq7bojQbMa-tGxsENIhw tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java 1.16 3f098761c5-idlmf9vWEMOlDw0VCHg tools/control/src/org/xenoserver/control/CommandVdCreate.java 1.17 +3f0990096KcyQw77qJmjTu941smS8A tools/control/src/org/xenoserver/control/CommandVdDelete.java 1.18 +3f0990093VJUL7QjxGigR5GPXf_Fkw tools/control/src/org/xenoserver/control/CommandVdRefresh.java 1.19 3eb781fdBRXfSlWzK6GXlIQIlHFoaQ tools/control/src/org/xenoserver/control/Defaults.java 1.20 3ec41f7cQ7Ug739JBDrsVH-7KJ5MvQ tools/control/src/org/xenoserver/control/Domain.java 1.21 3ec41f7cAzdBu0lkuTTQx92rqSM9Qw tools/control/src/org/xenoserver/control/Extent.java
2.1 --- a/tools/control/src/org/xenoserver/cmdline/Main.java Mon Jul 07 15:18:36 2003 +0000 2.2 +++ b/tools/control/src/org/xenoserver/cmdline/Main.java Mon Jul 07 15:36:18 2003 +0000 2.3 @@ -25,6 +25,8 @@ public class Main { 2.4 }; 2.5 static final CommandParser vdcommands[] = 2.6 { new ParseVdCreate(), 2.7 + new ParseVdDelete(), 2.8 + new ParseVdRefresh(), 2.9 new ParseVdShow(), 2.10 new ParseVdFree() 2.11 };
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java Mon Jul 07 15:36:18 2003 +0000 3.3 @@ -0,0 +1,40 @@ 3.4 +package org.xenoserver.cmdline; 3.5 + 3.6 +import java.util.LinkedList; 3.7 + 3.8 +import org.xenoserver.control.CommandFailedException; 3.9 +import org.xenoserver.control.CommandVdDelete; 3.10 +import org.xenoserver.control.Defaults; 3.11 +import org.xenoserver.control.VirtualDiskManager; 3.12 + 3.13 +public class ParseVdDelete extends CommandParser { 3.14 + public void parse(Defaults d, LinkedList args) throws ParseFailedException, CommandFailedException { 3.15 + String vd_key = getStringParameter(args,'k',""); 3.16 + 3.17 + if ( vd_key.equals("") ) 3.18 + throw new ParseFailedException("Expected -k<key>"); 3.19 + 3.20 + loadState(); 3.21 + if ( VirtualDiskManager.it.get_virtual_disk_key(vd_key) == null ) 3.22 + throw new CommandFailedException("Virtual disk " + vd_key + " does not exist"); 3.23 + 3.24 + String output = new CommandVdDelete(vd_key).execute(); 3.25 + if ( output != null ) 3.26 + System.out.println( output ); 3.27 + 3.28 + saveState(); 3.29 + } 3.30 + 3.31 + public String getName() { 3.32 + return "delete"; 3.33 + } 3.34 + 3.35 + public String getUsage() { 3.36 + return "[-k<key>]"; 3.37 + } 3.38 + 3.39 + public String getHelpText() { 3.40 + return "Deletes the virtual disk with the specified key."; 3.41 + } 3.42 + 3.43 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseVdRefresh.java Mon Jul 07 15:36:18 2003 +0000 4.3 @@ -0,0 +1,42 @@ 4.4 +package org.xenoserver.cmdline; 4.5 + 4.6 +import java.util.Date; 4.7 +import java.util.LinkedList; 4.8 + 4.9 +import org.xenoserver.control.CommandFailedException; 4.10 +import org.xenoserver.control.CommandVdRefresh; 4.11 +import org.xenoserver.control.Defaults; 4.12 + 4.13 +public class ParseVdRefresh extends CommandParser { 4.14 + public void parse(Defaults d, LinkedList args) throws ParseFailedException, CommandFailedException { 4.15 + String vd_key = getStringParameter(args,'k',""); 4.16 + String expiry_s = getStringParameter(args,'e',""); 4.17 + Date expiry; 4.18 + 4.19 + if ( vd_key.equals("") ) 4.20 + throw new ParseFailedException("Expected -k<key>"); 4.21 + if ( expiry_s.equals("") ) 4.22 + expiry = null; 4.23 + else 4.24 + expiry = new Date(Date.parse(expiry_s)); 4.25 + 4.26 + loadState(); 4.27 + String output = new CommandVdRefresh(vd_key,expiry).execute(); 4.28 + if ( output != null ) 4.29 + System.out.println(output); 4.30 + saveState(); 4.31 + } 4.32 + 4.33 + public String getName() { 4.34 + return "refresh"; 4.35 + } 4.36 + 4.37 + public String getUsage() { 4.38 + return "-k<key> [-e<expiry>]"; 4.39 + } 4.40 + 4.41 + public String getHelpText() { 4.42 + return "Refresh the expiry for the specified virtual disk. Omitting -e will cause the disk to never expire."; 4.43 + } 4.44 + 4.45 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tools/control/src/org/xenoserver/control/CommandVdDelete.java Mon Jul 07 15:36:18 2003 +0000 5.3 @@ -0,0 +1,18 @@ 5.4 +package org.xenoserver.control; 5.5 + 5.6 +public class CommandVdDelete extends Command { 5.7 + private String key; 5.8 + 5.9 + /** 5.10 + * Constructor for CommandVdDelete. 5.11 + * @param key The key of the disk to delete. 5.12 + */ 5.13 + public CommandVdDelete(String key) { 5.14 + this.key = key; 5.15 + } 5.16 + 5.17 + public String execute() throws CommandFailedException { 5.18 + VirtualDiskManager.it.delete_virtual_disk(key); 5.19 + return "Deleted virtual disk " + key; 5.20 + } 5.21 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/tools/control/src/org/xenoserver/control/CommandVdRefresh.java Mon Jul 07 15:36:18 2003 +0000 6.3 @@ -0,0 +1,23 @@ 6.4 +package org.xenoserver.control; 6.5 + 6.6 +import java.util.Date; 6.7 + 6.8 +public class CommandVdRefresh extends Command { 6.9 + private String key; 6.10 + private Date expiry; 6.11 + 6.12 + /** 6.13 + * Constructor for CommandVdRefresh. 6.14 + * @param key Key to refresh. 6.15 + * @param expiry New expiry. 6.16 + */ 6.17 + public CommandVdRefresh(String key, Date expiry) { 6.18 + this.key = key; 6.19 + this.expiry = expiry; 6.20 + } 6.21 + 6.22 + public String execute() throws CommandFailedException { 6.23 + VirtualDiskManager.it.refresh_virtual_disk(key,expiry); 6.24 + return "Refreshed virtual disk " + key; 6.25 + } 6.26 +}