commit a0ba1fc346bbd07a3b8ad8eb5a71382994523436
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date: Tue Nov 23 17:56:47 2010 +0000
qemu-xen: support qdisk as disk backend
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>
---
qemu-xen.h | 1 +
vl.c | 7 ++++---
xenstore.c | 31 +++++++++++++++++++------------
3 files changed, 24 insertions(+), 15 deletions(-)
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))
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|