debuggers.hg

changeset 600:05473a4cb01e

bitkeeper revision 1.304.1.6 (3f0bec943sH0UMOrLxjNzPbtI73ljA)

Add VBD show command
author rac61@labyrinth.cl.cam.ac.uk
date Wed Jul 09 10:21:08 2003 +0000 (2003-07-09)
parents 2fa0baf66747
children 7e70ba4347e3
files .rootkeys tools/control/src/org/xenoserver/cmdline/Main.java tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java tools/control/src/org/xenoserver/control/VirtualBlockDevice.java
line diff
     1.1 --- a/.rootkeys	Wed Jul 09 09:26:03 2003 +0000
     1.2 +++ b/.rootkeys	Wed Jul 09 10:21:08 2003 +0000
     1.3 @@ -31,6 +31,7 @@ 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  3f0bdfabfXM4tMbvmV06di5U-5FfqA tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java
     1.7 +3f0bec93F_VDIcn9oeXwJYwydX20kg tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java
     1.8  3f098761TRsbDk9woUM846Q6_F7EmA tools/control/src/org/xenoserver/cmdline/ParseVdCreate.java
     1.9  3f099009pmH9MFkRYwP2V1DfsqEwdg tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java
    1.10  3f098761zh9WTV6LpRqcet3gqlXdtg tools/control/src/org/xenoserver/cmdline/ParseVdFree.java
     2.1 --- a/tools/control/src/org/xenoserver/cmdline/Main.java	Wed Jul 09 09:26:03 2003 +0000
     2.2 +++ b/tools/control/src/org/xenoserver/cmdline/Main.java	Wed Jul 09 10:21:08 2003 +0000
     2.3 @@ -35,7 +35,8 @@ public class Main {
     2.4        new ParseVdFree()
     2.5      };
     2.6    private static final CommandParser vbdcommands[] =
     2.7 -    { new ParseVbdCreate()
     2.8 +    { new ParseVbdCreate(),
     2.9 +      new ParseVbdShow()
    2.10      };
    2.11    private static final CommandParser commands[] =
    2.12      { help,
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java	Wed Jul 09 10:21:08 2003 +0000
     3.3 @@ -0,0 +1,41 @@
     3.4 +package org.xenoserver.cmdline;
     3.5 +
     3.6 +import java.util.Iterator;
     3.7 +import java.util.LinkedList;
     3.8 +
     3.9 +import org.xenoserver.control.CommandFailedException;
    3.10 +import org.xenoserver.control.Defaults;
    3.11 +import org.xenoserver.control.Library;
    3.12 +import org.xenoserver.control.VirtualBlockDevice;
    3.13 +import org.xenoserver.control.VirtualDiskManager;
    3.14 +
    3.15 +public class ParseVbdShow extends CommandParser {
    3.16 +    public void parse(Defaults d, LinkedList args)
    3.17 +        throws ParseFailedException, CommandFailedException {
    3.18 +        loadState();
    3.19 +        Iterator i = VirtualDiskManager.IT.getVirtualBlockDevices();
    3.20 +        System.out.println("key         dom vbd mode");
    3.21 +        while (i.hasNext()) {
    3.22 +            VirtualBlockDevice vbd = (VirtualBlockDevice) i.next();
    3.23 +            System.out.println( vbd.getVirtualDisk().getKey()
    3.24 +                    + "  "
    3.25 +                    + Library.format(vbd.getDomain(), 3, false)
    3.26 +                    + " "
    3.27 +                    + Library.format(vbd.getVbdNum(), 3, false)
    3.28 +                    + " "
    3.29 +                    + vbd.getMode().toString());
    3.30 +        }
    3.31 +    }
    3.32 +
    3.33 +    public String getName() {
    3.34 +        return "show";
    3.35 +    }
    3.36 +
    3.37 +    public String getUsage() {
    3.38 +        return "";
    3.39 +    }
    3.40 +
    3.41 +    public String getHelpText() {
    3.42 +        return "Show details of all mapped virtual block devices.";
    3.43 +    }
    3.44 +}
     4.1 --- a/tools/control/src/org/xenoserver/control/VirtualBlockDevice.java	Wed Jul 09 09:26:03 2003 +0000
     4.2 +++ b/tools/control/src/org/xenoserver/control/VirtualBlockDevice.java	Wed Jul 09 10:21:08 2003 +0000
     4.3 @@ -39,28 +39,6 @@ public class VirtualBlockDevice {
     4.4          this.mode = mode;
     4.5      }
     4.6  
     4.7 -    // TODO: get rid of this method
     4.8 -    String dump(boolean title) {
     4.9 -        StringBuffer sb = new StringBuffer();
    4.10 -
    4.11 -        if (title) {
    4.12 -            sb.append("  key         dom vbd mode\n");
    4.13 -        } else {
    4.14 -            sb.append(
    4.15 -                "  "
    4.16 -                    + vd.getKey()
    4.17 -                    + "  "
    4.18 -                    + Library.format(domain, 3, false)
    4.19 -                    + " "
    4.20 -                    + Library.format(vbdNum, 3, false)
    4.21 -                    + " "
    4.22 -                    + mode.toString()
    4.23 -                    + "\n");
    4.24 -        }
    4.25 -
    4.26 -        return sb.toString();
    4.27 -    }
    4.28 -
    4.29      /**
    4.30       * Dump the virtual block device as XML.
    4.31       * @param out The writer to dump to.