[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] ioemu: Allow xvd* to co-exist with hd*.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192524008 -3600
# Node ID 05337cb5206fd3a553d9c3a0c752996bc40e189c
# Parent  d915111f8246bacfda168effafade68e1262e7cb
ioemu: Allow xvd* to co-exist with hd*.
 - Whether hdN is defined first is checked.
 - If hdN is defined, xvdN is not replaced with hdN.

Signed-off-by: Takanori Kasai <kasai.takanori@xxxxxxxxxxxxxx>
---
 tools/ioemu/xenstore.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff -r d915111f8246 -r 05337cb5206f tools/ioemu/xenstore.c
--- a/tools/ioemu/xenstore.c    Tue Oct 16 09:30:20 2007 +0100
+++ b/tools/ioemu/xenstore.c    Tue Oct 16 09:40:08 2007 +0100
@@ -83,7 +83,7 @@ void xenstore_parse_domain_config(int do
     char *buf = NULL, *path;
     char *fpath = NULL, *bpath = NULL,
         *dev = NULL, *params = NULL, *type = NULL, *drv = NULL;
-    int i, is_scsi;
+    int i, is_scsi, is_hdN = 0;
     unsigned int len, num, hd_index;
 
     for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
@@ -123,8 +123,29 @@ void xenstore_parse_domain_config(int do
         dev = xs_read(xsh, XBT_NULL, buf, &len);
         if (dev == NULL)
             continue;
+        if (!strncmp(dev, "hd", 2)) {
+            is_hdN = 1;
+            break;
+        }
+    }
+        
+    for (i = 0; i < num; i++) {
+        /* read the backend path */
+        if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) == -1)
+            continue;
+        free(bpath);
+        bpath = xs_read(xsh, XBT_NULL, buf, &len);
+        if (bpath == NULL)
+            continue;
+        /* read the name of the device */
+        if (pasprintf(&buf, "%s/dev", bpath) == -1)
+            continue;
+        free(dev);
+        dev = xs_read(xsh, XBT_NULL, buf, &len);
+        if (dev == NULL)
+            continue;
         /* Change xvdN to look like hdN */
-        if (!strncmp(dev, "xvd", 3 )) {
+        if (!is_hdN && !strncmp(dev, "xvd", 3)) {
             fprintf(logfile, "Change xvd%c to look like hd%c\n",
                     dev[3], dev[3]);
             memmove(dev, dev+1, strlen(dev));

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.