aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl.c
diff options
context:
space:
mode:
authorIan Jackson <Ian.Jackson@eu.citrix.com>2012-08-06 12:24:46 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2012-08-06 12:24:46 +0100
commit6390110d62f80d487730de9bdb1152f2764ffc16 (patch)
treeaea202fded5b97b2884b543310e27b6f03bf761b /tools/libxl/libxl.c
parent1a3e84bd85c6804668fe32f83c0c2912956b9ff6 (diff)
downloadxen-6390110d62f80d487730de9bdb1152f2764ffc16.tar.gz
xen-6390110d62f80d487730de9bdb1152f2764ffc16.tar.bz2
xen-6390110d62f80d487730de9bdb1152f2764ffc16.zip
Backed out changeset a8d708fcb347
25727:a8d708fcb347 was mangled during commit. Back it out so that we can commit it properly. Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl.c')
-rw-r--r--tools/libxl/libxl.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index cab41ed163..726a70ebb0 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1796,9 +1796,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
STATE_AO_GC(aodev->ao);
flexarray_t *front = NULL;
flexarray_t *back = NULL;
- char *dev, *script;
+ char *dev;
libxl__device *device;
- int rc;
+ int major, minor, rc;
libxl_ctx *ctx = gc->owner;
xs_transaction_t t = XBT_NULL;
@@ -1833,6 +1833,13 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
goto out_free;
}
+ if (disk->script) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "External block scripts"
+ " not yet supported, sorry");
+ rc = ERROR_INVAL;
+ goto out_free;
+ }
+
GCNEW(device);
rc = libxl__device_from_disk(gc, domid, disk, device);
if (rc != 0) {
@@ -1844,16 +1851,18 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
switch (disk->backend) {
case LIBXL_DISK_BACKEND_PHY:
dev = disk->pdev_path;
-
- script = libxl__abs_path(gc, disk->script ?: "block",
- libxl__xen_script_dir_path());
-
do_backend_phy:
+ libxl__device_physdisk_major_minor(dev, &major, &minor);
+ flexarray_append(back, "physical-device");
+ flexarray_append(back, libxl__sprintf(gc, "%x:%x", major, minor));
+
flexarray_append(back, "params");
flexarray_append(back, dev);
- assert(script);
- flexarray_append_pair(back, "script", script);
+ flexarray_append(back, "script");
+ flexarray_append(back, GCSPRINTF("%s/%s",
+ libxl__xen_script_dir_path(),
+ "block"));
assert(device->backend_kind == LIBXL__DEVICE_KIND_VBD);
break;
@@ -1870,12 +1879,10 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
libxl__device_disk_string_of_format(disk->format),
disk->pdev_path));
- /*
- * tap devices do not support custom block scripts and
- * always use the plain block script.
- */
- script = libxl__abs_path(gc, "block",
- libxl__xen_script_dir_path());
+ flexarray_append(back, "script");
+ flexarray_append(back, GCSPRINTF("%s/%s",
+ libxl__xen_script_dir_path(),
+ "blktap"));
/* now create a phy device to export the device to the guest */
goto do_backend_phy;
@@ -2575,10 +2582,13 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
flexarray_append(back, "1");
flexarray_append(back, "state");
flexarray_append(back, libxl__sprintf(gc, "%d", 1));
- if (nic->script)
- flexarray_append_pair(back, "script",
- libxl__abs_path(gc, nic->script,
- libxl__xen_script_dir_path()));
+ if (nic->script) {
+ flexarray_append(back, "script");
+ flexarray_append(back, nic->script[0]=='/' ? nic->script
+ : libxl__sprintf(gc, "%s/%s",
+ libxl__xen_script_dir_path(),
+ nic->script));
+ }
if (nic->ifname) {
flexarray_append(back, "vifname");