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

[Xen-changelog] [xen-unstable] ioemu: Allow blktap to be able to be booted as system volume for PV-on-HVM



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192447475 -3600
# Node ID 2372f89c0447e055506489688f53c9c69b6080d9
# Parent  c19c51317eebe8e852dd4ad90ca19880397fa3b4
ioemu: Allow blktap to be able to be booted as system volume for PV-on-HVM

 - All xvdN disk is looked like hdN.
 - All tap disks are checked.(tap:aio, tap:sync, tap:vmdk, etc.)

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

diff -r c19c51317eeb -r 2372f89c0447 tools/ioemu/xenstore.c
--- a/tools/ioemu/xenstore.c    Mon Oct 15 12:20:43 2007 +0100
+++ b/tools/ioemu/xenstore.c    Mon Oct 15 12:24:35 2007 +0100
@@ -82,7 +82,7 @@ void xenstore_parse_domain_config(int do
     char **e = NULL;
     char *buf = NULL, *path;
     char *fpath = NULL, *bpath = NULL,
-        *dev = NULL, *params = NULL, *type = NULL;
+        *dev = NULL, *params = NULL, *type = NULL, *drv = NULL;
     int i, is_scsi;
     unsigned int len, num, hd_index;
 
@@ -123,6 +123,14 @@ void xenstore_parse_domain_config(int do
         dev = xs_read(xsh, XBT_NULL, buf, &len);
         if (dev == NULL)
             continue;
+        /* Change xvdN to look like hdN */
+        if (!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));
+            dev[0] = 'h';
+            dev[1] = 'd';
+        }
         is_scsi = !strncmp(dev, "sd", 2);
         if ((strncmp(dev, "hd", 2) && !is_scsi) || strlen(dev) != 3 )
             continue;
@@ -140,6 +148,22 @@ void xenstore_parse_domain_config(int do
         params = xs_read(xsh, XBT_NULL, buf, &len);
         if (params == NULL)
             continue;
+        /* read the name of the device */
+        if (pasprintf(&buf, "%s/type", bpath) == -1)
+            continue;
+        free(drv);
+        drv = xs_read(xsh, XBT_NULL, buf, &len);
+        if (drv == NULL)
+            continue;
+        /* Strip off blktap sub-type prefix aio: - QEMU can autodetect this */
+        if (!strcmp(drv, "tap") && params[0]) {
+            char *offset = strchr(params, ':'); 
+            if (!offset)
+                continue ;
+            memmove(params, offset+1, strlen(offset+1)+1 );
+            fprintf(logfile, "Strip off blktap sub-type prefix to %s\n", 
params); 
+        }
+
         /* 
          * check if device has a phantom vbd; the phantom is hooked
          * to the frontend device (for ease of cleanup), so lookup 
@@ -202,6 +226,7 @@ void xenstore_parse_domain_config(int do
     free(buf);
     free(path);
     free(e);
+    free(drv);
     return;
 }
 

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