]> xenbits.xensource.com Git - qemu-xen-4.4-testing.git/commitdiff
qemu-xen: support qdisk as disk backend
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 23 Nov 2010 17:56:47 +0000 (17:56 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 23 Nov 2010 17:56:47 +0000 (17:56 +0000)
Support qdisk in xenstore_parse_domain_config;
do not call xenstore_parse_domain_config with pv guests.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
qemu-xen.h
vl.c
xenstore.c

index a2d57ac05af5638c36755174c94d3fff8eb04936..7821b5494835c2dd2c2ebf8bf28463a1292ab3c2 100644 (file)
@@ -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 2fb5f82273e17d3d76b5488b13503617402b7475..d465a09cf6ee63dfc2c388e3fe7dea634d329ced 100644 (file)
--- 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 */
 
index 7b9c2ae61f4e0fe4ac30f4dbd5b6ebaf7f756247..b7e7c28e111974d62c066e8ab3660ea91c94e7b2 100644 (file)
@@ -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))