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

[Xen-changelog] [xen-3.2-testing] ioemu: strip tap subtype prefix from image name



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202134431 0
# Node ID 9443e4a2751b064db162109a463a34eaa218bcf7
# Parent  9ae73a9ccf9bfa36c5a744b53dab86fa192df5f5
ioemu: strip tap subtype prefix from image name

Currently I am not able to mount or boot from an HVM CDROM when it is
configured for 'tap:aio' instead of 'file'.

disk=[ 'tap:aio:/var/lib/xen/images/sles10-sp2-fv/disk0,hda,w', '
       tap:aio:/home/iso/sles/SLES10.iso,hdc:cdrom,r', ]

With this patch I am able to boot from the CDROM and or mount it.

Patch changes xenstore.c:xenstore_process_event() to strip the tap
subtype prefix from the image name.

Signed-off-by: Pat Campbell <plc@xxxxxxxxxx>
xen-unstable changeset:   16944:0343aa1361011e5a280b4d78707a773a62231691
xen-unstable date:        Wed Jan 30 14:25:55 2008 +0000

ioemu: Fix xenstore access changes.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   16945:5f997b5b8a58a559020a06b1656534dce0086301
xen-unstable date:        Wed Jan 30 15:19:22 2008 +0000
---
 tools/ioemu/xenstore.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff -r 9ae73a9ccf9b -r 9443e4a2751b tools/ioemu/xenstore.c
--- a/tools/ioemu/xenstore.c    Mon Feb 04 14:12:45 2008 +0000
+++ b/tools/ioemu/xenstore.c    Mon Feb 04 14:13:51 2008 +0000
@@ -419,7 +419,7 @@ void xenstore_record_dm_state(char *stat
 
 void xenstore_process_event(void *opaque)
 {
-    char **vec, *image = NULL;
+    char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = 
NULL;
     unsigned int len, num, hd_index;
 
     vec = xs_read_watch(xsh, &num);
@@ -441,8 +441,23 @@ void xenstore_process_event(void *opaque
         goto out;
     hd_index = vec[XS_WATCH_TOKEN][2] - 'a';
     image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len);
-    if (image == NULL || !strcmp(image, bs_table[hd_index]->filename))
-        goto out;  /* gone or identical */
+    if (image == NULL)
+        goto out;  /* gone */
+
+    /* Strip off blktap sub-type prefix */
+    bpath = strdup(vec[XS_WATCH_PATH]); 
+    if (bpath == NULL)
+        goto out;
+    if ((offset = strrchr(bpath, '/')) != NULL) 
+        *offset = '\0';
+    if (pasprintf(&buf, "%s/type", bpath) == -1) 
+        goto out;
+    drv = xs_read(xsh, XBT_NULL, buf, &len);
+    if (drv && !strcmp(drv, "tap") && ((offset = strchr(image, ':')) != NULL))
+        memmove(image, offset+1, strlen(offset+1)+1);
+
+    if (!strcmp(image, bs_table[hd_index]->filename))
+        goto out;  /* identical */
 
     do_eject(0, vec[XS_WATCH_TOKEN]);
     bs_table[hd_index]->filename[0] = 0;
@@ -457,6 +472,9 @@ void xenstore_process_event(void *opaque
     }
 
  out:
+    free(drv);
+    free(buf);
+    free(bpath);
     free(image);
     free(vec);
 }

_______________________________________________
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®.