ia64/xen-unstable

changeset 16136:05337cb5206f

ioemu: Allow xvd* to co-exist with hd*.
- Whether hdN is defined first is checked.
- If hdN is defined, xvdN is not replaced with hdN.

Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
author Keir Fraser <keir@xensource.com>
date Tue Oct 16 09:40:08 2007 +0100 (2007-10-16)
parents d915111f8246
children 1f893d055c6f
files tools/ioemu/xenstore.c
line diff
     1.1 --- a/tools/ioemu/xenstore.c	Tue Oct 16 09:30:20 2007 +0100
     1.2 +++ b/tools/ioemu/xenstore.c	Tue Oct 16 09:40:08 2007 +0100
     1.3 @@ -83,7 +83,7 @@ void xenstore_parse_domain_config(int do
     1.4      char *buf = NULL, *path;
     1.5      char *fpath = NULL, *bpath = NULL,
     1.6          *dev = NULL, *params = NULL, *type = NULL, *drv = NULL;
     1.7 -    int i, is_scsi;
     1.8 +    int i, is_scsi, is_hdN = 0;
     1.9      unsigned int len, num, hd_index;
    1.10  
    1.11      for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
    1.12 @@ -123,8 +123,29 @@ void xenstore_parse_domain_config(int do
    1.13          dev = xs_read(xsh, XBT_NULL, buf, &len);
    1.14          if (dev == NULL)
    1.15              continue;
    1.16 +        if (!strncmp(dev, "hd", 2)) {
    1.17 +            is_hdN = 1;
    1.18 +            break;
    1.19 +        }
    1.20 +    }
    1.21 +        
    1.22 +    for (i = 0; i < num; i++) {
    1.23 +        /* read the backend path */
    1.24 +        if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) == -1)
    1.25 +            continue;
    1.26 +        free(bpath);
    1.27 +        bpath = xs_read(xsh, XBT_NULL, buf, &len);
    1.28 +        if (bpath == NULL)
    1.29 +            continue;
    1.30 +        /* read the name of the device */
    1.31 +        if (pasprintf(&buf, "%s/dev", bpath) == -1)
    1.32 +            continue;
    1.33 +        free(dev);
    1.34 +        dev = xs_read(xsh, XBT_NULL, buf, &len);
    1.35 +        if (dev == NULL)
    1.36 +            continue;
    1.37          /* Change xvdN to look like hdN */
    1.38 -        if (!strncmp(dev, "xvd", 3 )) {
    1.39 +        if (!is_hdN && !strncmp(dev, "xvd", 3)) {
    1.40              fprintf(logfile, "Change xvd%c to look like hd%c\n",
    1.41                      dev[3], dev[3]);
    1.42              memmove(dev, dev+1, strlen(dev));