direct-io.hg

changeset 471:858e1659fdcb

bitkeeper revision 1.246 (3eca6a979guOx5GLVimvVvJLI_a1Ag)

additional error checking and input validation
author ach61@labyrinth.cl.cam.ac.uk
date Tue May 20 17:49:11 2003 +0000 (2003-05-20)
parents b52f15bd4369
children 26986a2c9f0a
files .rootkeys tools/control/README-xenctl tools/control/src/uk/ac/cam/cl/xeno/xenctl/Library.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java tools/control/web/tmpl/dom-delr.tmpl tools/control/web/tmpl/dom-star.tmpl tools/control/web/tmpl/dom-stpr.tmpl tools/control/web/tmpl/vd-par.tmpl tools/control/web/tmpl/vd-vbdcr.tmpl tools/control/web/tmpl/vd-vdcr.tmpl tools/control/web/tmpl/vd-vdrr.tmpl
line diff
     1.1 --- a/.rootkeys	Mon May 19 19:26:22 2003 +0000
     1.2 +++ b/.rootkeys	Tue May 20 17:49:11 2003 +0000
     1.3 @@ -7,6 +7,7 @@ 3e6377b24eQqYMsDi9XrFkIgTzZ47A tools/bal
     1.4  3e6377d6eiFjF1hHIS6JEIOFk62xSA tools/balloon/README
     1.5  3e6377dbGcgnisKw16DPCaND7oGO3Q tools/balloon/balloon.c
     1.6  3eb781edFwm_pW9FwnQACIe68viLOw tools/control/Makefile
     1.7 +3eca6a96a31IwaKtkEa4jmzwTWlm8Q tools/control/README-xenctl
     1.8  3eb781fcTp_LPQwaot3SSSehkaf4eg tools/control/build-dom.xml
     1.9  3ec41f7cWCxQ8pdH8ZWqhhv-38qQ1w tools/control/build-xen.xml
    1.10  3ec41f7ca6IBXDSe0HVcMPp3PPloOQ tools/control/build.properties
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/control/README-xenctl	Tue May 20 17:49:11 2003 +0000
     2.3 @@ -0,0 +1,45 @@
     2.4 +
     2.5 +some notes on configuring xenctl...
     2.6 +
     2.7 +to build:
     2.8 +
     2.9 + # edit xeno.bk/tools/control/build.properties
    2.10 + # change manger.url to your xenoserver: mousetrap-0.xeno.cl.cam.ac.uk
    2.11 + # change build.home to your xeno.bk path
    2.12 + export PATH=/usr/groups/xeno/build_tools/bin:${PATH}
    2.13 + # this next step has already been done.
    2.14 + # cp $CATALINA_HOME/server/lib/catalina-ant.jar $ANT_HOME/lib
    2.15 + cd xeno.bk/tools/control
    2.16 + make
    2.17 + cd xeno.bk/tools/internal
    2.18 + make
    2.19 +
    2.20 +to setup:
    2.21 +
    2.22 + ## expand the jakarta (aka catalina) tree somewhere accessible by dom0
    2.23 + export ROOTDIR=/anfs/scratch/labyrinth/ach61
    2.24 + cd $ROOTDIR
    2.25 + tar zxf /usr/groups/xeno/archive/tomcat-4.1.24.tar.gz 
    2.26 + export CATALINA_HOME=$ROOTDIR/jakarta-tomcat-4.1.24
    2.27 + export JAVA_HOME=/usr/groups/xeno/build_tools/java-1.4.1
    2.28 +
    2.29 + ## edit $CATALINA_HOME/conf/server.xml, change port 8080 to port 80
    2.30 + cp $CATALINA_HOME/conf/server.xml $CATALINA_HOME/conf/server.orig
    2.31 + sed 's/8080/80/g' $CATALINA_HOME/conf/server.orig > $CATALINA_HOME/conf/server.xml 
    2.32 +
    2.33 + ## install the xenctl web archive
    2.34 + cp xeno.bk/tools/control/dist/xenctl-0.1-dev.war $CATALINA_HOME/webapps/xenctl.war
    2.35 + cp xeno.bk/tools/control/domctl.xml /var/lib/xen
    2.36 +
    2.37 + ## either edit xi_tools_dir in domctl.xml or copy the binaries
    2.38 + # find xeno.bk/tools/internal -perm +111 -type f -exec cp {} /usr/local/bin \;
    2.39 +
    2.40 +to run:
    2.41 + $CATALINA_HOME/bin/startup.sh
    2.42 + # point your browser at hostname-0.xeno.cl.cam.ac.uk:80/xenctl
    2.43 +
    2.44 +
    2.45 +for development:
    2.46 + ## to "make install" in xeno.bk/tools/control  instead of copying the war file
    2.47 + cp $CATALINA_HOME/conf/tomcat-users.xml $CATALINA_HOME/conf/tomcat-users.orig
    2.48 + sed -e 's/<tomcat-users>/<tomcat-users>\
  <role rolename="standard"\/>\
  <role rolename="manager"\/>\
  <user username="hobbes" password="tiger" roles="standard,manager"\/>/' $CATALINA_HOME/conf/tomcat-users.orig > $CATALINA_HOME/conf/tomcat-users.xml
     3.1 --- a/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Library.java	Mon May 19 19:26:22 2003 +0000
     3.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Library.java	Tue May 20 17:49:11 2003 +0000
     3.3 @@ -64,6 +64,12 @@ Library
     3.4    {
     3.5      String substring = size;
     3.6      int    suffix = 1;
     3.7 +    long   value = 0;
     3.8 +
     3.9 +    if (size == null)
    3.10 +    {
    3.11 +      return 0;
    3.12 +    }
    3.13  
    3.14      if ((substring = check(size, 'm')) != null)
    3.15      {
    3.16 @@ -94,7 +100,16 @@ Library
    3.17        substring = size;
    3.18      }
    3.19  
    3.20 -    return Long.decode(substring).longValue() * suffix;
    3.21 +    try
    3.22 +    {
    3.23 +      value = Long.decode(substring).longValue() * suffix;
    3.24 +    }
    3.25 +    catch (NumberFormatException e)
    3.26 +    {
    3.27 +      value = 0;
    3.28 +    }
    3.29 +
    3.30 +    return value;
    3.31    }
    3.32  
    3.33    static String
     4.1 --- a/tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java	Mon May 19 19:26:22 2003 +0000
     4.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java	Tue May 20 17:49:11 2003 +0000
     4.3 @@ -71,14 +71,19 @@ RootBean
     4.4      Partition p = pm.get_partition(partition);
     4.5      String result="done";
     4.6      int loop;
     4.7 +    long size;
     4.8  
     4.9      if (p == null)
    4.10      {
    4.11        return (" eh? what partition: " + partition);
    4.12      }
    4.13  
    4.14 -    vdm.add_xeno_partition(p, 
    4.15 -			   Library.parse_size(chunksize)/default_sector_size);
    4.16 +    size = Library.parse_size(chunksize) / default_sector_size;
    4.17 +    if (size == 0)
    4.18 +    {
    4.19 +      return ("error: invalid chunk size");
    4.20 +    }
    4.21 +    vdm.add_xeno_partition(p, size);
    4.22      pm.add_xeno_partition(p);
    4.23  
    4.24      /*    return pm.dump(true); */
    4.25 @@ -110,9 +115,15 @@ RootBean
    4.26    {
    4.27      VirtualDisk vd;
    4.28      Date date = new Date();
    4.29 +    long parse_size;
    4.30  
    4.31 -    vd = vdm.create_virtual_disk(name,
    4.32 -				 Library.parse_size(size)/default_sector_size,
    4.33 +
    4.34 +    parse_size = Library.parse_size(size)/default_sector_size;
    4.35 +    if (parse_size == 0)
    4.36 +    {
    4.37 +      return ("error: invalid size");
    4.38 +    }
    4.39 +    vd = vdm.create_virtual_disk(name, parse_size,
    4.40  				 new Date(date.getTime() + expiry));
    4.41  
    4.42      return ("Virtual Disk created with key: " + vd.get_key());
    4.43 @@ -122,6 +133,11 @@ RootBean
    4.44    public String
    4.45    doDeleteVirtualDisk (String key)
    4.46    {
    4.47 +    if (key == null ||
    4.48 +	key.trim().equals(""))
    4.49 +    {
    4.50 +      return ("error: no virtual disk specified");
    4.51 +    }
    4.52      vdm.delete_virtual_disk(key);
    4.53  
    4.54      return ("okay");
     5.1 --- a/tools/control/web/tmpl/dom-delr.tmpl	Mon May 19 19:26:22 2003 +0000
     5.2 +++ b/tools/control/web/tmpl/dom-delr.tmpl	Tue May 20 17:49:11 2003 +0000
     5.3 @@ -22,13 +22,22 @@ INCLUDE&dommenu.tmpl
     5.4    String domains[] = hsrw.getParameterValues("dom");
     5.5    boolean force = hsrw.getParameter("force").equals("true");
     5.6  
     5.7 -  for (int i = 0; i < domains.length; i++)
     5.8 +  if (domains == null || domains.length == 0)
     5.9    {
    5.10  %>
    5.11 +Error: no domain specified.<br>
    5.12 +<%
    5.13 +  }
    5.14 +  else
    5.15 +  {
    5.16 +    for (int i = 0; i < domains.length; i++)
    5.17 +    {
    5.18 +%>
    5.19  result <%= domains[i] %> =
    5.20   <%= command_destroy.executeCommand(d, Integer.parseInt(domains[i]),
    5.21                                      force) %> <br>
    5.22  <%
    5.23 +    }
    5.24    }
    5.25  %>
    5.26  
     6.1 --- a/tools/control/web/tmpl/dom-star.tmpl	Mon May 19 19:26:22 2003 +0000
     6.2 +++ b/tools/control/web/tmpl/dom-star.tmpl	Tue May 20 17:49:11 2003 +0000
     6.3 @@ -21,13 +21,22 @@ INCLUDE&dommenu.tmpl
     6.4  
     6.5    String domains[] = hsrw.getParameterValues("dom");
     6.6  
     6.7 -  for (int i = 0; i < domains.length; i++)
     6.8 +  if (domains == null || domains.length == 0)
     6.9    {
    6.10  %>
    6.11 -result <%= domains[i] %> =
    6.12 - <%= command_start.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
    6.13 +Error: no domain specified.<br>
    6.14  <%
    6.15    }
    6.16 +  else
    6.17 +  {
    6.18 +    for (int i = 0; i < domains.length; i++)
    6.19 +    {
    6.20 +%>
    6.21 +result <%= domains[i] %> =<br>
    6.22 +<%= command_start.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
    6.23 +<%
    6.24 +    }
    6.25 +  }
    6.26  %>
    6.27  
    6.28  </td>
     7.1 --- a/tools/control/web/tmpl/dom-stpr.tmpl	Mon May 19 19:26:22 2003 +0000
     7.2 +++ b/tools/control/web/tmpl/dom-stpr.tmpl	Tue May 20 17:49:11 2003 +0000
     7.3 @@ -21,12 +21,21 @@ INCLUDE&dommenu.tmpl
     7.4  
     7.5    String domains[] = hsrw.getParameterValues("dom");
     7.6  
     7.7 -  for (int i = 0; i < domains.length; i++)
     7.8 +  if (domains == null || domains.length == 0)
     7.9    {
    7.10  %>
    7.11 +Error: no domain specified.<br>
    7.12 +<%
    7.13 +  }
    7.14 +  else
    7.15 +  {
    7.16 +    for (int i = 0; i < domains.length; i++)
    7.17 +    {
    7.18 +%>
    7.19  result <%= domains[i] %> =
    7.20   <%= command_stop.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
    7.21  <%
    7.22 +    }
    7.23    }
    7.24  %>
    7.25  
     8.1 --- a/tools/control/web/tmpl/vd-par.tmpl	Mon May 19 19:26:22 2003 +0000
     8.2 +++ b/tools/control/web/tmpl/vd-par.tmpl	Tue May 20 17:49:11 2003 +0000
     8.3 @@ -17,22 +17,34 @@ INCLUDE&vdmenu.tmpl
     8.4    HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
     8.5  
     8.6    String partitions[] = hsrw.getParameterValues("p");
     8.7 -  String size = hsrw.getParameter("chunk").trim() +
     8.8 -                hsrw.getParameter("chunkunits").trim();
     8.9 +  String size = null;
    8.10  
    8.11 -  for (int i = 0; i < partitions.length; i++)
    8.12 +  if (partitions == null || partitions.length == 0)
    8.13 +  {
    8.14 +%>
    8.15 +Error: No partitions chosen.<br>
    8.16 +<%
    8.17 +  }
    8.18 +  else if (hsrw.getParameter("chunk") == null ||
    8.19 +           hsrw.getParameter("chunk").trim().equals(""))
    8.20    {
    8.21  %>
    8.22 -p = <%= root.doAddPartition(partitions[i], size) %> <br>
    8.23 +Error: chunk size not specified.<br>
    8.24  <%
    8.25    }
    8.26 +  else
    8.27 +  {
    8.28 +    size = hsrw.getParameter("chunk").trim() +
    8.29 +           hsrw.getParameter("chunkunits").trim();
    8.30 +    for (int i = 0; i < partitions.length; i++)
    8.31 +    {
    8.32 +%>
    8.33 +output[<%= i %>] =<br>
    8.34 +<%= root.doAddPartition(partitions[i], size) %> <br>
    8.35 +<%
    8.36 +    }
    8.37 +  }
    8.38  %>
    8.39 -chunk = <%= hsrw.getParameter("chunk") %>
    8.40 -<br>
    8.41 -chunkunits = <%= hsrw.getParameter("chunkunits") %>
    8.42 -<br>
    8.43 -size = <%= size %>
    8.44 -<br>
    8.45  
    8.46  
    8.47  <%
     9.1 --- a/tools/control/web/tmpl/vd-vbdcr.tmpl	Mon May 19 19:26:22 2003 +0000
     9.2 +++ b/tools/control/web/tmpl/vd-vbdcr.tmpl	Tue May 20 17:49:11 2003 +0000
     9.3 @@ -15,20 +15,61 @@ INCLUDE&vdmenu.tmpl
     9.4  
     9.5  <%
     9.6    HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
     9.7 +
     9.8 +  if (hsrw.getParameter("vd") == null ||
     9.9 +      hsrw.getParameter("vd").trim().equals(""))
    9.10 +  {
    9.11  %>
    9.12 -output = <%= root.doCreateVirtualBlockDevice(hsrw.getParameter("vd"),
    9.13 -                    Integer.decode(hsrw.getParameter("domain")).intValue(),
    9.14 -                    Integer.decode(hsrw.getParameter("vbd")).intValue(),
    9.15 -                                             hsrw.getParameter("mode"))
    9.16 -         %>
    9.17 -<br>
    9.18 -vd = <%= hsrw.getParameter("vd") %>
    9.19 -<br>
    9.20 -domain = <%= hsrw.getParameter("domain") %>
    9.21 -<br>
    9.22 -vbd = <%= hsrw.getParameter("vbd") %>
    9.23 -<br>
    9.24 -mode = <%= hsrw.getParameter("mode") %>
    9.25 +Error: No virtual disk chosen.<br>
    9.26 +<%
    9.27 +  }
    9.28 +  else if (hsrw.getParameter("domain") == null ||
    9.29 +           hsrw.getParameter("domain").trim().equals(""))
    9.30 +  {
    9.31 +%>
    9.32 +Error: No domain specified.<br>
    9.33 +<%
    9.34 +  }
    9.35 +  else if (hsrw.getParameter("vbd") == null ||
    9.36 +           hsrw.getParameter("vbd").trim().equals(""))
    9.37 +  {
    9.38 +%>
    9.39 +Error: No virtual block device number specified.<br>
    9.40 +<%
    9.41 +  }
    9.42 +  else
    9.43 +  {
    9.44 +    int domain = -1;
    9.45 +    int vbd = -1;
    9.46 +
    9.47 +    try
    9.48 +    {
    9.49 +      domain = Integer.decode(hsrw.getParameter("domain")).intValue();
    9.50 +      vbd = Integer.decode(hsrw.getParameter("vbd")).intValue();
    9.51 +%>
    9.52 +output =<br>
    9.53 +<%= root.doCreateVirtualBlockDevice(hsrw.getParameter("vd"),
    9.54 +                                    domain, vbd,
    9.55 +                                     hsrw.getParameter("mode"))  %>
    9.56 +<%
    9.57 +    }
    9.58 +    catch (NumberFormatException e)
    9.59 +    {
    9.60 +      if (domain == -1)
    9.61 +      {
    9.62 +%>
    9.63 +Error: invalid domain specification.<br>
    9.64 +<%
    9.65 +      }
    9.66 +      else
    9.67 +      {
    9.68 +%>
    9.69 +Error: invalid virtual block device number specification.<br>
    9.70 +<%
    9.71 +      }
    9.72 +    }
    9.73 +  }
    9.74 +%>
    9.75  
    9.76  <%
    9.77    root.doFlushState();
    10.1 --- a/tools/control/web/tmpl/vd-vdcr.tmpl	Mon May 19 19:26:22 2003 +0000
    10.2 +++ b/tools/control/web/tmpl/vd-vdcr.tmpl	Tue May 20 17:49:11 2003 +0000
    10.3 @@ -16,39 +16,64 @@ INCLUDE&vdmenu.tmpl
    10.4  
    10.5  <%
    10.6    HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
    10.7 -  String size = hsrw.getParameter("size").trim() +
    10.8 -                hsrw.getParameter("sizeunits").trim();
    10.9 -  long expiry = Long.decode(hsrw.getParameter("expiry")).longValue(); 
   10.10 +  String size = null;
   10.11 +  String expiry_string = null;
   10.12 +  long expiry = 0;
   10.13  
   10.14 -  /* not perfect, but good enough for now... */
   10.15 -    if ( hsrw.getParameter("expiryunits").equals("d"))
   10.16 +  if (hsrw.getParameter("size") == null ||
   10.17 +      hsrw.getParameter("size").trim().equals(""))
   10.18    {
   10.19 -    expiry *= 24 * 60 * 60 * 1000;
   10.20 +%>
   10.21 +Error: size not specified.<br>
   10.22 +<%
   10.23    }
   10.24 -  else if ( hsrw.getParameter("expiryunits").equals("w"))
   10.25 +  else if (hsrw.getParameter("expiry") == null ||
   10.26 +           hsrw.getParameter("expiry").trim().equals(""))
   10.27    {
   10.28 -    expiry *= 24 * 60 * 60 * 1000 * 7;
   10.29 -  }
   10.30 -  else if ( hsrw.getParameter("expiryunits").equals("m"))
   10.31 -  {
   10.32 -    expiry *= 24 * 60 * 60 * 1000 * 30;
   10.33 +%>
   10.34 +Error: expiry time not specified.<br>
   10.35 +<%
   10.36    }
   10.37 -  else if ( hsrw.getParameter("expiryunits").equals("y"))
   10.38 +  else
   10.39    {
   10.40 -    expiry *= 24 * 60 * 60 * 1000 * 365;
   10.41 -  }
   10.42 +    size = hsrw.getParameter("size").trim() +
   10.43 +           hsrw.getParameter("sizeunits").trim();
   10.44 +
   10.45 +    try
   10.46 +    {
   10.47 +      expiry = Long.decode(hsrw.getParameter("expiry")).longValue(); 
   10.48  
   10.49 +      /* not perfect, but good enough for now... */
   10.50 +      if ( hsrw.getParameter("expiryunits").equals("d"))
   10.51 +      {
   10.52 +        expiry *= 24 * 60 * 60 * 1000;
   10.53 +      }
   10.54 +      else if ( hsrw.getParameter("expiryunits").equals("w"))
   10.55 +      {
   10.56 +        expiry *= 24 * 60 * 60 * 1000 * 7;
   10.57 +      }
   10.58 +      else if ( hsrw.getParameter("expiryunits").equals("m"))
   10.59 +      {
   10.60 +        expiry *= 24 * 60 * 60 * 1000 * 30;
   10.61 +      }
   10.62 +      else if ( hsrw.getParameter("expiryunits").equals("y"))
   10.63 +      {
   10.64 +        expiry *= 24 * 60 * 60 * 1000 * 365;
   10.65 +      }
   10.66  %>
   10.67 -output = <%= root.doCreateVirtualDisk( hsrw.getParameter("name"),
   10.68 -                                       size, expiry)
   10.69 -         %>
   10.70 +output =<br>
   10.71 +<%= root.doCreateVirtualDisk( hsrw.getParameter("name"), size, expiry) %>
   10.72  <br>
   10.73 -size = <%= size %>
   10.74 -<br>
   10.75 -expiry = <%= hsrw.getParameter("expiry") %>
   10.76 -<br>
   10.77 -expiryunits = <%= hsrw.getParameter("expiryunits") %>
   10.78 -<br>
   10.79 +<%
   10.80 +    }
   10.81 +    catch (NumberFormatException e)
   10.82 +    {
   10.83 +%>
   10.84 +Error: invalid expiry time specification.<br>
   10.85 +<%
   10.86 +    }
   10.87 +  }
   10.88 +%>
   10.89  
   10.90  <%
   10.91    root.doFlushState();
    11.1 --- a/tools/control/web/tmpl/vd-vdrr.tmpl	Mon May 19 19:26:22 2003 +0000
    11.2 +++ b/tools/control/web/tmpl/vd-vdrr.tmpl	Tue May 20 17:49:11 2003 +0000
    11.3 @@ -1,4 +1,4 @@
    11.4 -Refresh Virtual Disk Results
    11.5 +Refresh Virtual Disk
    11.6  SECTION&XenoServers
    11.7  BREADCRUMB&Virtual Disk Manager&vd.jsp
    11.8  
    11.9 @@ -14,34 +14,43 @@ INCLUDE&vdmenu.tmpl
   11.10    HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   11.11  
   11.12    String vds[] = hsrw.getParameterValues("vd");
   11.13 -  long expiry = Long.decode(hsrw.getParameter("expiry")).longValue(); 
   11.14 +  long expiry;
   11.15  
   11.16 -  /* not perfect, but good enough for now... */
   11.17 -    if ( hsrw.getParameter("expiryunits").equals("d"))
   11.18 +  if (vds == null || vds.length == 0)
   11.19    {
   11.20 -    expiry *= 24 * 60 * 60 * 1000;
   11.21 -  }
   11.22 -  else if ( hsrw.getParameter("expiryunits").equals("w"))
   11.23 -  {
   11.24 -    expiry *= 24 * 60 * 60 * 1000 * 7;
   11.25 +%>
   11.26 +Error: No virtual disk chosen.<br>
   11.27 +<%
   11.28    }
   11.29 -  else if ( hsrw.getParameter("expiryunits").equals("m"))
   11.30 -  {
   11.31 -    expiry *= 24 * 60 * 60 * 1000 * 30;
   11.32 -  }
   11.33 -  else if ( hsrw.getParameter("expiryunits").equals("y"))
   11.34 +  else if (hsrw.getParameter("expiry") == null ||
   11.35 +           hsrw.getParameter("expiry").trim().equals(""))
   11.36    {
   11.37 -    expiry *= 24 * 60 * 60 * 1000 * 365;
   11.38 -  }
   11.39 -
   11.40 -  if (vds == null)
   11.41 -  { 
   11.42  %>
   11.43 -no virtual disks selected.
   11.44 +Error: expiry time not specified.<br>
   11.45  <%
   11.46    }
   11.47    else
   11.48    {
   11.49 +    expiry = Long.decode(hsrw.getParameter("expiry")).longValue(); 
   11.50 +
   11.51 +    /* not perfect, but good enough for now... */
   11.52 +    if ( hsrw.getParameter("expiryunits").equals("d"))
   11.53 +    {
   11.54 +      expiry *= 24 * 60 * 60 * 1000;
   11.55 +    }
   11.56 +    else if ( hsrw.getParameter("expiryunits").equals("w"))
   11.57 +    {
   11.58 +      expiry *= 24 * 60 * 60 * 1000 * 7;
   11.59 +    }
   11.60 +    else if ( hsrw.getParameter("expiryunits").equals("m"))
   11.61 +    {
   11.62 +      expiry *= 24 * 60 * 60 * 1000 * 30;
   11.63 +    }
   11.64 +    else if ( hsrw.getParameter("expiryunits").equals("y"))
   11.65 +    {
   11.66 +      expiry *= 24 * 60 * 60 * 1000 * 365;
   11.67 +    }
   11.68 +
   11.69      for (int i = 0; i < vds.length; i++)
   11.70      {
   11.71  %>
   11.72 @@ -51,12 +60,6 @@ vd = <%= root.doRefreshVirtualDisk(vds[i
   11.73    }
   11.74  %>
   11.75  
   11.76 -<br>
   11.77 -expiry = <%= hsrw.getParameter("expiry") %>
   11.78 -<br>
   11.79 -expiryunits = <%= hsrw.getParameter("expiryunits") %>
   11.80 -<br>
   11.81 -
   11.82  <%
   11.83    root.doFlushState();
   11.84  %>