ia64/xen-unstable

changeset 597:6e6c86f3a177

bitkeeper revision 1.332 (3f0d4a71ScYIvhpYjrv_aLLacdn4Ig)

Remove on-disk storage of virtual block devices
Implement retrieving VBD info from /proc
remove VBD delete and flush commands as VBDs go away by themselves when their domains are destroyed
author rac61@labyrinth.cl.cam.ac.uk
date Thu Jul 10 11:13:53 2003 +0000 (2003-07-10)
parents 681598b3259f
children 73fab8c399fd
files .rootkeys tools/control/src/org/xenoserver/cmdline/Main.java tools/control/src/org/xenoserver/cmdline/ParseVbdDelete.java tools/control/src/org/xenoserver/cmdline/ParseVbdFlush.java tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java tools/control/src/org/xenoserver/control/CommandVbdCreate.java tools/control/src/org/xenoserver/control/CommandVbdDelete.java tools/control/src/org/xenoserver/control/CommandVbdFlush.java tools/control/src/org/xenoserver/control/CommandVbdList.java tools/control/src/org/xenoserver/control/CommandVdDelete.java tools/control/src/org/xenoserver/control/VirtualBlockDevice.java tools/control/src/org/xenoserver/control/VirtualDiskManager.java tools/control/src/org/xenoserver/control/XMLHelper.java
line diff
     1.1 --- a/.rootkeys	Thu Jul 10 11:04:02 2003 +0000
     1.2 +++ b/.rootkeys	Thu Jul 10 11:13:53 2003 +0000
     1.3 @@ -29,8 +29,6 @@ 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 -3f0bf89f_DkClyexDd4EDwinZJG83A tools/control/src/org/xenoserver/cmdline/ParseVbdDelete.java
     1.8 -3f0bf89fvzPQqcHBq1xA0XlFiO8tLA tools/control/src/org/xenoserver/cmdline/ParseVbdFlush.java
     1.9  3f0bec93F_VDIcn9oeXwJYwydX20kg tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java
    1.10  3f098761TRsbDk9woUM846Q6_F7EmA tools/control/src/org/xenoserver/cmdline/ParseVdCreate.java
    1.11  3f099009pmH9MFkRYwP2V1DfsqEwdg tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java
    1.12 @@ -50,8 +48,7 @@ 3f05631e_G6wzHhEnpihX0pIkEsbMw tools/con
    1.13  3f05631eGWxq7bojQbMa-tGxsENIhw tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java
    1.14  3f0bdfab88VYiD26FXCDmmAAGJ8zWA tools/control/src/org/xenoserver/control/CommandVbdCreate.java
    1.15  3f0bdfabI14M5_odjCIwQbXCdauReA tools/control/src/org/xenoserver/control/CommandVbdCreatePhysical.java
    1.16 -3f0bf89fcVy1cFU18hPVXkFMMLHLug tools/control/src/org/xenoserver/control/CommandVbdDelete.java
    1.17 -3f0bf8a0aRDXkIGy3liS1oKXIQpeyA tools/control/src/org/xenoserver/control/CommandVbdFlush.java
    1.18 +3f0d4a70B132OMLyoUBFJAfNCATCww tools/control/src/org/xenoserver/control/CommandVbdList.java
    1.19  3f098761c5-idlmf9vWEMOlDw0VCHg tools/control/src/org/xenoserver/control/CommandVdCreate.java
    1.20  3f0990096KcyQw77qJmjTu941smS8A tools/control/src/org/xenoserver/control/CommandVdDelete.java
    1.21  3f0990093VJUL7QjxGigR5GPXf_Fkw tools/control/src/org/xenoserver/control/CommandVdRefresh.java
     2.1 --- a/tools/control/src/org/xenoserver/cmdline/Main.java	Thu Jul 10 11:04:02 2003 +0000
     2.2 +++ b/tools/control/src/org/xenoserver/cmdline/Main.java	Thu Jul 10 11:13:53 2003 +0000
     2.3 @@ -36,8 +36,6 @@ public class Main {
     2.4      };
     2.5    private static final CommandParser vbdcommands[] =
     2.6      { new ParseVbdCreate(),
     2.7 -      new ParseVbdDelete(),
     2.8 -      new ParseVbdFlush(),
     2.9        new ParseVbdShow()
    2.10      };
    2.11    private static final CommandParser commands[] =
     3.1 --- a/tools/control/src/org/xenoserver/cmdline/ParseVbdDelete.java	Thu Jul 10 11:04:02 2003 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,41 +0,0 @@
     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.CommandVbdDelete;
    3.10 -import org.xenoserver.control.Defaults;
    3.11 -
    3.12 -public class ParseVbdDelete extends CommandParser {
    3.13 -    public void parse(Defaults d, LinkedList args)
    3.14 -        throws ParseFailedException, CommandFailedException {
    3.15 -        int domain_id = getIntParameter(args, 'n', 0);
    3.16 -        int vbd_num = getIntParameter(args, 'v', -1);
    3.17 -
    3.18 -        if (domain_id == 0) {
    3.19 -            throw new ParseFailedException("Expected -n<domain_id>");
    3.20 -        }
    3.21 -        if (vbd_num == -1) {
    3.22 -            throw new ParseFailedException("Expected -v<vbd_num>");
    3.23 -        }
    3.24 -        loadState();
    3.25 -        String output = new CommandVbdDelete(domain_id, vbd_num).execute();
    3.26 -        if (output != null) {
    3.27 -            System.out.println(output);
    3.28 -        }
    3.29 -        saveState();
    3.30 -    }
    3.31 -
    3.32 -    public String getName() {
    3.33 -        return "delete";
    3.34 -    }
    3.35 -
    3.36 -    public String getUsage() {
    3.37 -        return "-n<domain> -v<vbd>";
    3.38 -    }
    3.39 -
    3.40 -    public String getHelpText() {
    3.41 -        return "Deletes the specified virtual block device from the specified domain.";
    3.42 -    }
    3.43 -
    3.44 -}
     4.1 --- a/tools/control/src/org/xenoserver/cmdline/ParseVbdFlush.java	Thu Jul 10 11:04:02 2003 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,31 +0,0 @@
     4.4 -package org.xenoserver.cmdline;
     4.5 -
     4.6 -import java.util.LinkedList;
     4.7 -
     4.8 -import org.xenoserver.control.CommandFailedException;
     4.9 -import org.xenoserver.control.CommandVbdFlush;
    4.10 -import org.xenoserver.control.Defaults;
    4.11 -
    4.12 -public class ParseVbdFlush extends CommandParser {
    4.13 -    public void parse(Defaults d, LinkedList args)
    4.14 -        throws ParseFailedException, CommandFailedException {
    4.15 -        loadState();
    4.16 -        String output = new CommandVbdFlush().execute();
    4.17 -        if (output != null) {
    4.18 -            System.out.println(output);
    4.19 -        }
    4.20 -        saveState();
    4.21 -    }
    4.22 -
    4.23 -    public String getName() {
    4.24 -        return "flush";
    4.25 -    }
    4.26 -
    4.27 -    public String getUsage() {
    4.28 -        return "";
    4.29 -    }
    4.30 -
    4.31 -    public String getHelpText() {
    4.32 -        return "Delete all virtual block devices";
    4.33 -    }
    4.34 -}
     5.1 --- a/tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java	Thu Jul 10 11:04:02 2003 +0000
     5.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java	Thu Jul 10 11:13:53 2003 +0000
     5.3 @@ -1,29 +1,29 @@
     5.4  package org.xenoserver.cmdline;
     5.5  
     5.6 -import java.util.Iterator;
     5.7  import java.util.LinkedList;
     5.8  
     5.9  import org.xenoserver.control.CommandFailedException;
    5.10 +import org.xenoserver.control.CommandVbdList;
    5.11  import org.xenoserver.control.Defaults;
    5.12  import org.xenoserver.control.Library;
    5.13  import org.xenoserver.control.VirtualBlockDevice;
    5.14 -import org.xenoserver.control.VirtualDiskManager;
    5.15  
    5.16  public class ParseVbdShow extends CommandParser {
    5.17      public void parse(Defaults d, LinkedList args)
    5.18          throws ParseFailedException, CommandFailedException {
    5.19          loadState();
    5.20 -        Iterator i = VirtualDiskManager.IT.getVirtualBlockDevices();
    5.21 +        CommandVbdList list = new CommandVbdList();
    5.22 +        list.execute();
    5.23 +        VirtualBlockDevice[] vbds = list.vbds();
    5.24          System.out.println("key         dom vbd mode");
    5.25 -        while (i.hasNext()) {
    5.26 -            VirtualBlockDevice vbd = (VirtualBlockDevice) i.next();
    5.27 -            System.out.println( vbd.getVirtualDisk().getKey()
    5.28 +        for (int i=0; i<vbds.length; i++) {
    5.29 +            System.out.println( vbds[i].getVirtualDisk().getKey()
    5.30                      + "  "
    5.31 -                    + Library.format(vbd.getDomain(), 3, false)
    5.32 +                    + Library.format(vbds[i].getDomain(), 3, false)
    5.33                      + " "
    5.34 -                    + Library.format(vbd.getVbdNum(), 3, false)
    5.35 +                    + Library.format(vbds[i].getVbdNum(), 3, false)
    5.36                      + " "
    5.37 -                    + vbd.getMode().toString());
    5.38 +                    + vbds[i].getMode().toString());
    5.39          }
    5.40      }
    5.41  
     6.1 --- a/tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java	Thu Jul 10 11:04:02 2003 +0000
     6.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java	Thu Jul 10 11:13:53 2003 +0000
     6.3 @@ -10,13 +10,14 @@ public class ParseVdDelete extends Comma
     6.4      public void parse(Defaults d, LinkedList args)
     6.5          throws ParseFailedException, CommandFailedException {
     6.6          String vd_key = getStringParameter(args, 'k', "");
     6.7 +        boolean force = getFlagParameter(args,'f');
     6.8  
     6.9          if (vd_key.equals("")) {
    6.10              throw new ParseFailedException("Expected -k<key>");
    6.11          }
    6.12  
    6.13          loadState();
    6.14 -        String output = new CommandVdDelete(vd_key).execute();
    6.15 +        String output = new CommandVdDelete(vd_key,force).execute();
    6.16          if (output != null) {
    6.17              System.out.println(output);
    6.18          }
    6.19 @@ -29,11 +30,11 @@ public class ParseVdDelete extends Comma
    6.20      }
    6.21  
    6.22      public String getUsage() {
    6.23 -        return "-k<key>";
    6.24 +        return "-k<key> [-f]";
    6.25      }
    6.26  
    6.27      public String getHelpText() {
    6.28 -        return "Deletes the virtual disk with the specified key.";
    6.29 +        return "Deletes the virtual disk with the specified key. -f forces deletion even if the disk is in use.";
    6.30      }
    6.31  
    6.32  }
     7.1 --- a/tools/control/src/org/xenoserver/control/CommandVbdCreate.java	Thu Jul 10 11:04:02 2003 +0000
     7.2 +++ b/tools/control/src/org/xenoserver/control/CommandVbdCreate.java	Thu Jul 10 11:13:53 2003 +0000
     7.3 @@ -45,7 +45,7 @@ public class CommandVbdCreate extends Co
     7.4          }
     7.5  
     7.6          VirtualBlockDevice vbd =
     7.7 -            VirtualDiskManager.IT.createVirtualBlockDevice(
     7.8 +            new VirtualBlockDevice(
     7.9                  vd,
    7.10                  domain_id,
    7.11                  vbd_num,
     8.1 --- a/tools/control/src/org/xenoserver/control/CommandVbdDelete.java	Thu Jul 10 11:04:02 2003 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,43 +0,0 @@
     8.4 -package org.xenoserver.control;
     8.5 -
     8.6 -/**
     8.7 - * Delete a virtual block device. Note that this does not update anything inside
     8.8 - * Xen, and therefore should only be done if you are certain that the domain has
     8.9 - * either not been started, or has been destroyed, or you are sure it will not
    8.10 - * try to access the VBD again. Since the mapping is not removed in Xen, any
    8.11 - * subsequent changes to the underlying virtual disk will affect the domain,
    8.12 - * probably adversely.
    8.13 - */
    8.14 -public class CommandVbdDelete extends Command {
    8.15 -    /** Domain id to delete from */
    8.16 -    private int domain_id;
    8.17 -    /** VBD number to delete */
    8.18 -    private int vbd_num;
    8.19 -
    8.20 -    /**
    8.21 -     * Constructor for CommandVbdDelete.
    8.22 -     * @param domain_id Domain ID to delete from
    8.23 -     * @param vbd_num VBD number to delete
    8.24 -     */
    8.25 -    public CommandVbdDelete(int domain_id, int vbd_num) {
    8.26 -        this.domain_id = domain_id;
    8.27 -        this.vbd_num = vbd_num;
    8.28 -    }
    8.29 -
    8.30 -    /**
    8.31 -     * @see org.xenoserver.control.Command#execute()
    8.32 -     */
    8.33 -    public String execute() throws CommandFailedException {
    8.34 -        if (VirtualDiskManager
    8.35 -            .IT
    8.36 -            .deleteVirtualBlockDevice(domain_id, vbd_num)) {
    8.37 -            return "Deleted VBD " + vbd_num + " from domain " + domain_id;
    8.38 -        } else {
    8.39 -            throw new CommandFailedException(
    8.40 -                "No such virtual block device "
    8.41 -                    + vbd_num
    8.42 -                    + " in domain "
    8.43 -                    + domain_id);
    8.44 -        }
    8.45 -    }
    8.46 -}
     9.1 --- a/tools/control/src/org/xenoserver/control/CommandVbdFlush.java	Thu Jul 10 11:04:02 2003 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,14 +0,0 @@
     9.4 -package org.xenoserver.control;
     9.5 -
     9.6 -/**
     9.7 - * Flush (delete) all virtual block devices.
     9.8 - */
     9.9 -public class CommandVbdFlush extends Command {
    9.10 -    /**
    9.11 -     * @see org.xenoserver.control.Command#execute()
    9.12 -     */
    9.13 -    public String execute() throws CommandFailedException {
    9.14 -        VirtualDiskManager.IT.flushVirtualBlockDevices();
    9.15 -        return "Flushed virtual block devices";
    9.16 -    }
    9.17 -}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tools/control/src/org/xenoserver/control/CommandVbdList.java	Thu Jul 10 11:13:53 2003 +0000
    10.3 @@ -0,0 +1,66 @@
    10.4 +package org.xenoserver.control;
    10.5 +
    10.6 +import java.io.BufferedReader;
    10.7 +import java.io.FileReader;
    10.8 +import java.io.IOException;
    10.9 +import java.util.StringTokenizer;
   10.10 +import java.util.Vector;
   10.11 +
   10.12 +public class CommandVbdList extends Command {
   10.13 +    /** Array of virtual block devices returned */
   10.14 +    private VirtualBlockDevice[] array;
   10.15 +
   10.16 +    public String execute() throws CommandFailedException {
   10.17 +        Vector v = new Vector();
   10.18 +        BufferedReader in;
   10.19 +        String line;
   10.20 +
   10.21 +        try {
   10.22 +            in = new BufferedReader(new FileReader("/proc/xeno/dom0/vhd"));
   10.23 +            line = in.readLine();
   10.24 +            while (line != null) {
   10.25 +                int domain = -1;
   10.26 +                int vbdnum = -1;
   10.27 +                String key = "";
   10.28 +                Mode mode = Mode.READ_ONLY;
   10.29 +
   10.30 +                StringTokenizer st = new StringTokenizer(line);
   10.31 +                if (st.hasMoreTokens()) {
   10.32 +                    domain = Integer.parseInt(st.nextToken());
   10.33 +                }
   10.34 +                if (st.hasMoreTokens()) {
   10.35 +                    vbdnum = Integer.parseInt(st.nextToken());
   10.36 +                }
   10.37 +                if (st.hasMoreTokens()) {
   10.38 +                    key = st.nextToken();
   10.39 +                }
   10.40 +                if (st.hasMoreTokens()) {
   10.41 +                    if (Integer.parseInt(st.nextToken()) == 2) {
   10.42 +                        mode = Mode.READ_WRITE;
   10.43 +                    }
   10.44 +                }
   10.45 +
   10.46 +                VirtualDisk vd = VirtualDiskManager.IT.getVirtualDisk(key);
   10.47 +                if (vd == null) {
   10.48 +                    throw new CommandFailedException(
   10.49 +                        "Key " + key + " has no matching virtual disk");
   10.50 +                }
   10.51 +                VirtualBlockDevice vbd =
   10.52 +                    new VirtualBlockDevice(vd, domain, vbdnum, mode);
   10.53 +                v.add(vbd);
   10.54 +
   10.55 +                line = in.readLine();
   10.56 +            }
   10.57 +        } catch (IOException e) {
   10.58 +            throw new CommandFailedException("Could not read VBD file", e);
   10.59 +        }
   10.60 +
   10.61 +        array = new VirtualBlockDevice[v.size()];
   10.62 +        v.toArray(array);
   10.63 +        return null;
   10.64 +    }
   10.65 +    
   10.66 +    public VirtualBlockDevice[] vbds() {
   10.67 +        return array;
   10.68 +    }
   10.69 +}
    11.1 --- a/tools/control/src/org/xenoserver/control/CommandVdDelete.java	Thu Jul 10 11:04:02 2003 +0000
    11.2 +++ b/tools/control/src/org/xenoserver/control/CommandVdDelete.java	Thu Jul 10 11:13:53 2003 +0000
    11.3 @@ -6,13 +6,16 @@ package org.xenoserver.control;
    11.4  public class CommandVdDelete extends Command {
    11.5      /** Key of disk to delete. */
    11.6      private String key;
    11.7 +    /** Force deletion? */
    11.8 +    private boolean force;
    11.9  
   11.10      /**
   11.11       * Constructor for CommandVdDelete.
   11.12       * @param key The key of the disk to delete.
   11.13       */
   11.14 -    public CommandVdDelete(String key) {
   11.15 +    public CommandVdDelete(String key,boolean force) {
   11.16          this.key = key;
   11.17 +        this.force = force;
   11.18      }
   11.19  
   11.20      /**
   11.21 @@ -23,6 +26,16 @@ public class CommandVdDelete extends Com
   11.22              throw new CommandFailedException(
   11.23                  "Virtual disk " + key + " does not exist");
   11.24          }
   11.25 +        if ( !force ) {
   11.26 +            CommandVbdList list = new CommandVbdList();
   11.27 +            list.execute();
   11.28 +            VirtualBlockDevice[] vbds = list.vbds();
   11.29 +            for (int i=0;i<vbds.length;i++) {
   11.30 +                if (vbds[i].getVirtualDisk().getKey().equals(key)) {
   11.31 +                    throw new CommandFailedException("Virtual disk " + key + " is in use.");
   11.32 +                }
   11.33 +            }
   11.34 +        }
   11.35  
   11.36          VirtualDiskManager.IT.deleteVirtualDisk(key);
   11.37          return "Deleted virtual disk " + key;
    12.1 --- a/tools/control/src/org/xenoserver/control/VirtualBlockDevice.java	Thu Jul 10 11:04:02 2003 +0000
    12.2 +++ b/tools/control/src/org/xenoserver/control/VirtualBlockDevice.java	Thu Jul 10 11:13:53 2003 +0000
    12.3 @@ -5,8 +5,6 @@
    12.4  
    12.5  package org.xenoserver.control;
    12.6  
    12.7 -import java.io.PrintWriter;
    12.8 -
    12.9  /**
   12.10   * A virtual block device; a mapping from a domain-specific number to a virtual
   12.11   * disk with associated access mode.
   12.12 @@ -40,19 +38,6 @@ public class VirtualBlockDevice {
   12.13      }
   12.14  
   12.15      /**
   12.16 -     * Dump the virtual block device as XML.
   12.17 -     * @param out The writer to dump to.
   12.18 -     */
   12.19 -    void dumpAsXML(PrintWriter out) {
   12.20 -        out.println("  <virtual_block_device>");
   12.21 -        out.println("    <key>" + vd.getKey() + "</key>");
   12.22 -        out.println("    <domain>" + domain + "</domain>");
   12.23 -        out.println("    <vbdnum>" + vbdNum + "</vbdnum>");
   12.24 -        out.println("    <mode>" + mode + "</mode>");
   12.25 -        out.println("  </virtual_block_device>");
   12.26 -    }
   12.27 -
   12.28 -    /**
   12.29       * @return This device's virtual disk.
   12.30       */
   12.31      public VirtualDisk getVirtualDisk() {
    13.1 --- a/tools/control/src/org/xenoserver/control/VirtualDiskManager.java	Thu Jul 10 11:04:02 2003 +0000
    13.2 +++ b/tools/control/src/org/xenoserver/control/VirtualDiskManager.java	Thu Jul 10 11:13:53 2003 +0000
    13.3 @@ -21,8 +21,6 @@ public class VirtualDiskManager {
    13.4      private VirtualDisk freeDisk;
    13.5      /** The map of keys to virtual disks. */
    13.6      private LinkedHashMap virtualDisks = new LinkedHashMap(100);
    13.7 -    /** The map of (domain,vbdnum) to virtual block devices. */
    13.8 -    private LinkedHashMap virtualBlockDevices = new LinkedHashMap(100);
    13.9  
   13.10      /**
   13.11       * VDM constructor, private as it's a singleton.
   13.12 @@ -101,46 +99,6 @@ public class VirtualDiskManager {
   13.13      }
   13.14  
   13.15      /**
   13.16 -     * Create a new virtual block device.
   13.17 -     * @param vd The virtual disk to expose.
   13.18 -     * @param domain The domain to create the device for.
   13.19 -     * @param vbdNum The block device number to use.
   13.20 -     * @param mode The mode to create the device with.
   13.21 -     * @return The newly created virtual block device.
   13.22 -     */
   13.23 -    VirtualBlockDevice createVirtualBlockDevice(
   13.24 -        VirtualDisk vd,
   13.25 -        int domain,
   13.26 -        int vbdNum,
   13.27 -        Mode mode) {
   13.28 -        VirtualBlockDevice vbd =
   13.29 -            new VirtualBlockDevice(vd, domain, vbdNum, mode);
   13.30 -
   13.31 -        insertVirtualBlockDevice(vbd);
   13.32 -
   13.33 -        return vbd;
   13.34 -    }
   13.35 -
   13.36 -    /**
   13.37 -     * Delete a virtual block device.
   13.38 -     * @param domain Domain owning the device.
   13.39 -     * @param vbdNum The vbd number within the domain.
   13.40 -     * @return true if the VBD was deleted, false if it does not exist.
   13.41 -     */
   13.42 -    boolean deleteVirtualBlockDevice(int domain, int vbdNum) {
   13.43 -        Object hash = hashVBD(domain, vbdNum);
   13.44 -        return virtualBlockDevices.remove(hash) != null;
   13.45 -    }
   13.46 -
   13.47 -    /**
   13.48 -     * Flush all virtual block devices.
   13.49 -     */
   13.50 -    void flushVirtualBlockDevices() {
   13.51 -        /* isn't automatic garbage collection wonderful? */
   13.52 -        virtualBlockDevices = new LinkedHashMap(100);
   13.53 -    }
   13.54 -
   13.55 -    /**
   13.56       * Insert a new virtual disk into the map.
   13.57       * @param vd The disk to insert.
   13.58       */
   13.59 @@ -149,15 +107,6 @@ public class VirtualDiskManager {
   13.60      }
   13.61  
   13.62      /**
   13.63 -     * Insert a new virtual block device into the map.
   13.64 -     * @param vbd The device to insert.
   13.65 -     */
   13.66 -    void insertVirtualBlockDevice(VirtualBlockDevice vbd) {
   13.67 -        Object hash = hashVBD(vbd.getDomain(), vbd.getVbdNum());
   13.68 -        virtualBlockDevices.put(hash, vbd);
   13.69 -    }
   13.70 -
   13.71 -    /**
   13.72       * Hash a virtual block device.
   13.73       * @param domain The VBD's domain.
   13.74       * @param vbdNum The VBD's number within the domain.
   13.75 @@ -190,14 +139,6 @@ public class VirtualDiskManager {
   13.76              vd.dumpAsXML(out);
   13.77          }
   13.78          out.println("</virtual_disks>");
   13.79 -        out.println("<virtual_block_devices>");
   13.80 -        i = virtualBlockDevices.values().iterator();
   13.81 -        while (i.hasNext()) {
   13.82 -            VirtualBlockDevice vbd = (VirtualBlockDevice) i.next();
   13.83 -            vbd.dumpAsXML(out);
   13.84 -        }
   13.85 -
   13.86 -        out.println("</virtual_block_devices>");
   13.87      }
   13.88  
   13.89      /**
   13.90 @@ -208,13 +149,6 @@ public class VirtualDiskManager {
   13.91      }
   13.92  
   13.93      /**
   13.94 -     * @return An iterator over the virtual block devices.
   13.95 -     */
   13.96 -    public Iterator getVirtualBlockDevices() {
   13.97 -        return virtualBlockDevices.values().iterator();
   13.98 -    }
   13.99 -
  13.100 -    /**
  13.101       * @return An iterator over the virtual disks.
  13.102       */
  13.103      public Iterator getVirtualDisks() {
    14.1 --- a/tools/control/src/org/xenoserver/control/XMLHelper.java	Thu Jul 10 11:04:02 2003 +0000
    14.2 +++ b/tools/control/src/org/xenoserver/control/XMLHelper.java	Thu Jul 10 11:13:53 2003 +0000
    14.3 @@ -100,13 +100,6 @@ class XMLHelper {
    14.4                          + "]");
    14.5              }
    14.6          }
    14.7 -
    14.8 -        /* parse virtual block devices */
    14.9 -        parseVirtualBlockDevices(
   14.10 -            vdm,
   14.11 -            document.getElementsByTagName("virtual_block_device"));
   14.12 -
   14.13 -        return;
   14.14      }
   14.15  
   14.16      /**
   14.17 @@ -190,35 +183,4 @@ class XMLHelper {
   14.18              pm.addXenoPartition(partition);
   14.19          }
   14.20      }
   14.21 -
   14.22 -    /**
   14.23 -     * Parse a list of virtual block device nodes.
   14.24 -     * @param vdm The VirtualDiskManager to configure. 
   14.25 -     * @param nl The node list.
   14.26 -     */
   14.27 -    private static void parseVirtualBlockDevices(
   14.28 -        VirtualDiskManager vdm,
   14.29 -        NodeList nl) {
   14.30 -        for (int loop = 0; loop < nl.getLength(); loop++) {
   14.31 -            Node node = nl.item(loop);
   14.32 -            Mode mode;
   14.33 -
   14.34 -            if (XMLHelper
   14.35 -                .getText(XMLHelper.getSubNode("mode", node))
   14.36 -                .equals("rw")) {
   14.37 -                mode = Mode.READ_WRITE;
   14.38 -            } else {
   14.39 -                mode = Mode.READ_ONLY;
   14.40 -            }
   14.41 -
   14.42 -            vdm.createVirtualBlockDevice(
   14.43 -                vdm.getVirtualDisk(
   14.44 -                    XMLHelper.getText(XMLHelper.getSubNode("key", node))),
   14.45 -                Integer.parseInt(
   14.46 -                    XMLHelper.getText(XMLHelper.getSubNode("domain", node))),
   14.47 -                Integer.parseInt(
   14.48 -                    XMLHelper.getText(XMLHelper.getSubNode("vbdnum", node))),
   14.49 -                mode);
   14.50 -        }
   14.51 -    }
   14.52  }