WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 2/4] qemu-xen: support qdisk as disk backend

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2/4] qemu-xen: support qdisk as disk backend
From: stefano.stabellini@xxxxxxxxxxxxx
Date: Thu, 18 Nov 2010 13:02:03 +0000
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Thu, 18 Nov 2010 05:02:55 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1011181248170.2373@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1011181248170.2373@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Support qdisk in xenstore_parse_domain_config;
do not call xenstore_parse_domain_config with pv guests.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff --git a/qemu-xen.h b/qemu-xen.h
index a2d57ac..7821b54 100644
--- a/qemu-xen.h
+++ b/qemu-xen.h
@@ -62,6 +62,7 @@ void handle_buffered_pio(void);
 #endif
 
 /* xenstore.c */
+void xenstore_init(void);
 void xenstore_parse_domain_config(int domid);
 int xenstore_parse_disable_pf_config(void);
 int xenstore_fd(void);
diff --git a/vl.c b/vl.c
index 2fb5f82..d465a09 100644
--- a/vl.c
+++ b/vl.c
@@ -5813,17 +5813,18 @@ int main(int argc, char **argv, char **envp)
     dma_helper_init();
 
     xc_handle = xc_interface_open(0,0,0); /* fixme check errors */
+    xenstore_init();
+    if (!strcmp(machine->name, "xenfv")) {
 #ifdef CONFIG_STUBDOM
-    {
         char *domid_s, *msg;
         if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s)))
             fprintf(stderr,"Can not read our own domid: %s\n", msg);
         else
             xenstore_parse_domain_config(atoi(domid_s));
-    }
 #else
-    xenstore_parse_domain_config(domid);
+        xenstore_parse_domain_config(domid);
 #endif /* CONFIG_STUBDOM */
+    }
 
     /* we always create the cdrom drive, even if no disk is there */
 
diff --git a/xenstore.c b/xenstore.c
index 7b9c2ae..b7e7c28 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -278,11 +278,14 @@ static void xenstore_get_backend_path(char **backend, 
const char *devtype,
     backend_dompath = xs_get_domain_path(xsh, domid_backend);
     if (!backend_dompath) goto out;
     
-    const char *expected_devtypes[3];
+    const char *expected_devtypes[4];
     const char **expected_devtype = expected_devtypes;
 
     *expected_devtype++ = devtype;
-    if (!strcmp(devtype, "vbd")) *expected_devtype++ = "tap";
+    if (!strcmp(devtype, "vbd")) {
+       *expected_devtype++ = "tap";
+       *expected_devtype++ = "qdisk";
+    }
     *expected_devtype = 0;
     assert(expected_devtype <
            expected_devtypes + ARRAY_SIZE(expected_devtypes));
@@ -392,6 +395,17 @@ static const char *xenstore_get_guest_uuid(void)
 #define PT_PCI_POWER_MANAGEMENT_DEFAULT 0
 int direct_pci_msitranslate;
 int direct_pci_power_mgmt;
+void xenstore_init(void)
+{
+    xenstore_get_guest_uuid();
+
+    xsh = xs_daemon_open();
+    if (xsh == NULL) {
+        fprintf(logfile, "Could not contact xenstore for domain config\n");
+        return;
+    }
+}
+
 void xenstore_parse_domain_config(int hvm_domid)
 {
     char **e_danger = NULL;
@@ -416,14 +430,6 @@ void xenstore_parse_domain_config(int hvm_domid)
     for(i = 0; i < MAX_DRIVES + 1; i++)
         media_filename[i] = NULL;
 
-    xenstore_get_guest_uuid();
-
-    xsh = xs_daemon_open();
-    if (xsh == NULL) {
-        fprintf(logfile, "Could not contact xenstore for domain config\n");
-        return;
-    }
-
     danger_path = xs_get_domain_path(xsh, hvm_domid);
     if (danger_path == NULL) {
         fprintf(logfile, "xs_get_domain_path() error\n");
@@ -496,7 +502,7 @@ void xenstore_parse_domain_config(int hvm_domid)
         if (drv == NULL)
             continue;
         /* Obtain blktap sub-type prefix */
-        if (!strcmp(drv, "tap") && params[0]) {
+        if ((!strcmp(drv, "tap") || !strcmp(drv, "qdisk")) && params[0]) {
             char *offset = strchr(params, ':'); 
             if (!offset)
                 continue ;
@@ -1055,7 +1061,8 @@ void xenstore_process_event(void *opaque)
         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))
+       if (drv && (!strcmp(drv, "tap") || !strcmp(drv, "qdisk")) &&
+               ((offset = strchr(image, ':')) != NULL))
             memmove(image, offset+1, strlen(offset+1)+1);
 
         if (!strcmp(image, drives_table[hd_index].bdrv->filename))
-- 
1.5.6.5


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