debuggers.hg
diff tools/libxl/libxl.c @ 22854:6ec61438713a
libxl/xl: support empty disk paths (ejected cdroms)
Support empty disk paths, including in domain config files, for
compatibility with xend. This allows a domain to be created with a
cdrom which is initially in the "ejected" (no cd present) state.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Support empty disk paths, including in domain config files, for
compatibility with xend. This allows a domain to be created with a
cdrom which is initially in the "ejected" (no cd present) state.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> |
---|---|
date | Tue Jan 25 18:06:53 2011 +0000 (2011-01-25) |
parents | 787af706dadc |
children | 1d1eec7e1fb4 |
line diff
1.1 --- a/tools/libxl/libxl.c Tue Jan 25 17:02:47 2011 +0000 1.2 +++ b/tools/libxl/libxl.c Tue Jan 25 18:06:53 2011 +0000 1.3 @@ -646,8 +646,8 @@ int libxl_event_get_disk_eject_info(libx 1.4 1.5 disk->backend_domid = 0; 1.6 disk->domid = domid; 1.7 - disk->physpath = NULL; 1.8 - disk->phystype = 0; 1.9 + disk->physpath = strdup(""); 1.10 + disk->phystype = PHYSTYPE_EMPTY; 1.11 /* this value is returned to the user: do not free right away */ 1.12 disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", backend)); 1.13 disk->unpluggable = 1; 1.14 @@ -882,6 +882,8 @@ int libxl_device_disk_add(libxl_ctx *ctx 1.15 device.backend_kind = DEVICE_VBD; 1.16 break; 1.17 } 1.18 + case PHYSTYPE_EMPTY: 1.19 + break; 1.20 case PHYSTYPE_FILE: 1.21 /* let's pretend is tap:aio for the moment */ 1.22 disk->phystype = PHYSTYPE_AIO; 1.23 @@ -1606,7 +1608,7 @@ static unsigned int libxl_append_disk_li 1.24 pdisk->backend_domid = 0; 1.25 pdisk->domid = domid; 1.26 physpath_tmp = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/params", be_path, *dir), &len); 1.27 - if (strchr(physpath_tmp, ':')) { 1.28 + if (physpath_tmp && strchr(physpath_tmp, ':')) { 1.29 pdisk->physpath = strdup(strchr(physpath_tmp, ':') + 1); 1.30 free(physpath_tmp); 1.31 } else { 1.32 @@ -1684,7 +1686,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u 1.33 1.34 if (!disk->physpath) { 1.35 disk->physpath = strdup(""); 1.36 - disk->phystype = PHYSTYPE_PHY; 1.37 + disk->phystype = PHYSTYPE_EMPTY; 1.38 } 1.39 disks = libxl_device_disk_list(ctx, domid, &num); 1.40 for (i = 0; i < num; i++) {