]> xenbits.xensource.com Git - libvirt.git/commitdiff
fix index creation for disks
authorDaniel Veillard <veillard@redhat.com>
Fri, 10 Oct 2008 08:37:35 +0000 (08:37 +0000)
committerDaniel Veillard <veillard@redhat.com>
Fri, 10 Oct 2008 08:37:35 +0000 (08:37 +0000)
* src/domain_conf.c src/util.c: fix index creation for disks >
  {sd,hd,xvd,vd}z (Sanjay Rao and Chris Wright)
Daniel

AUTHORS
ChangeLog
src/domain_conf.c
src/util.c

diff --git a/AUTHORS b/AUTHORS
index 8680d5668ca667139032a56f9727adb8494d029a..b7c065f5a92c62d3f70d759368c787ef89cad53c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -51,6 +51,7 @@ Patches have also been contributed by:
   Charles Duffy        <Charles_Duffy@messageone.com>
   Nguyen Anh Quynh     <aquynh@gmail.com>
   James Morris         <jmorris@namei.org>
+  Chris Wrigh          <chrisw@redhat.com>
 
 
   [....send patches to get your name here....]
index 4e75c0572fd0ed6501ffc6027766b9413c58e9d9..845dee4548a7c32ef5b3a07995aaa1040038272d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Oct 10 10:33:29 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+       * src/domain_conf.c src/util.c: fix index creation for disks >
+         {sd,hd,xvd,vd}z (Sanjay Rao and Chris Wright)
+
 Thu Oct  9 11:30:00 EST Cole Robinson <crobinso@redhat.com>
 
        * src/domain_conf.c src/hash.c src/internal.h src/lxc_conf.c
index e8d248f55e6d0734c159e661a97d9fe14cf4e6a5..cbad43c59dbe2d98f41502fd4b52f98b135148b7 100644 (file)
@@ -3374,7 +3374,7 @@ char *virDomainConfigFile(virConnectPtr conn,
 
 /* Translates a device name of the form (regex) "[fhv]d[a-z]+" into
  * the corresponding bus,index combination (e.g. sda => (0,0), sdi (1,1),
- *                                               hdd => (1,1), vdaa => (0,27))
+ *                                               hdd => (1,1), vdaa => (0,26))
  * @param disk The disk device
  * @param busIdx parsed bus number
  * @param devIdx parsed device number
index ebe86b2c816c83cd4ade502ba97ce2c067789de2..915e738a5333993adf5117d78696f4b28de2dad8 100644 (file)
@@ -1036,7 +1036,7 @@ const char *virEnumToString(const char *const*types,
 }
 
 /* Translates a device name of the form (regex) "[fhv]d[a-z]+" into
- * the corresponding index (e.g. sda => 1, hdz => 26, vdaa => 27)
+ * the corresponding index (e.g. sda => 0, hdz => 25, vdaa => 26)
  * @param name The name of the device
  * @return name's index, or -1 on failure
  */
@@ -1056,8 +1056,8 @@ int virDiskNameToIndex(const char *name) {
     if (!ptr)
         return -1;
 
-    while (*ptr) {
-        idx = idx * 26;
+    for (i = 0; *ptr; i++) {
+        idx = (idx + i) * 26;
 
         if (!c_islower(*ptr))
             return -1;