diff options
author | tlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk> | 2003-05-06 09:36:15 +0000 |
---|---|---|
committer | tlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk> | 2003-05-06 09:36:15 +0000 |
commit | fd347f1b55d1a77969f2624f0063152568dabab0 (patch) | |
tree | e90591937b99940e1237421f9a6e047d5dbca521 /tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java | |
parent | 5379a4b2d0213f3a323dc6c0340845b6353cd273 (diff) | |
download | xen-fd347f1b55d1a77969f2624f0063152568dabab0.tar.gz xen-fd347f1b55d1a77969f2624f0063152568dabab0.tar.bz2 xen-fd347f1b55d1a77969f2624f0063152568dabab0.zip |
bitkeeper revision 1.206 (3eb7820fjxOimwW6NMSeo6KyAdqZUQ)
Many files:
new file
domctl, xi_ tools, updated domain builder, /proc/xeno/domains
Diffstat (limited to 'tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java')
-rw-r--r-- | tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java b/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java new file mode 100644 index 0000000000..025f373c50 --- /dev/null +++ b/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java @@ -0,0 +1,69 @@ +package uk.ac.cam.cl.xeno.domctl; + +import java.io.*; +import java.net.*; + +public class CommandDestroy extends Command +{ + public int doCommand(Defaults d, String args[]) + { + Runtime r = Runtime.getRuntime (); + int domain_id = getIntParameter(args, 'n', 0); + boolean force = getFlagParameter(args, 'f'); + int rc = 0; + + if (domain_id == 0) { + System.err.println ("Expected -n<domain_id>"); + rc = -1; + return rc; + } + + try + { + Process destroy_p; + String destroy_cmdarray[] = force ? new String[3] : new String[2]; + int destroy_rc; + int idx = 0; + destroy_cmdarray[idx++] = d.XIToolsDir + "xi_destroy"; + if (force) { + destroy_cmdarray[idx++] = "-f"; + } + destroy_cmdarray[idx++] = "" + domain_id; + + if (Settings.TEST) { + reportCommand (destroy_cmdarray); + } else { + destroy_p = r.exec (destroy_cmdarray); + destroy_rc = destroy_p.waitFor (); + + if (destroy_rc != 0) { + return reportXIError ("Could not destroy domain", destroy_cmdarray); + } + } + } + catch (Exception e) + { + System.err.println ("Could not destroy domain (" + e + ")"); + e.printStackTrace (); + rc = -1; + } + + return rc; + } + + public String getName() + { + return "destroy"; + } + + public String getUsage() + { + return "[-f] [-n<domain_id>]"; + } + + public String getHelpText() + { + return + "Destory the specified domain. -f forcibly destroys it."; + } +} |