aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl
diff options
context:
space:
mode:
authorWei Liu <wei.liu2@citrix.com>2013-04-26 11:11:37 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-04-26 15:55:10 +0100
commit0114d259ebcd1f87966e2849f6ac1af8d9dd89c5 (patch)
treea0f3fe704328639c31bab95b2270192f6a1575ca /tools/libxl
parent7259d4d3df40d273725b8c074f169b98846dec97 (diff)
downloadxen-0114d259ebcd1f87966e2849f6ac1af8d9dd89c5.tar.gz
xen-0114d259ebcd1f87966e2849f6ac1af8d9dd89c5.tar.bz2
xen-0114d259ebcd1f87966e2849f6ac1af8d9dd89c5.zip
libxl: write IO ABI for disk frontends
This is a patch to forward-port a Xend behaviour. Xend writes IO ABI used for all frontends. Blkfront before 2.6.26 relies on this behaviour otherwise guest cannot boot when running in 32-on-64 mode. Blkfront after 2.6.26 writes that node itself, in which case it's just an overwrite to an existing node which should be OK. In fact Xend writes the ABI for all frontends including console and vif. But nowadays only old disk frontends rely on that behaviour so that we only write the ABI for disk frontends in libxl, minimizing the impact. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl')
-rw-r--r--tools/libxl/libxl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0f936c0ab7..30302c71b0 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2052,6 +2052,12 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
libxl_ctx *ctx = gc->owner;
xs_transaction_t t = XBT_NULL;
+ libxl_domain_type type = libxl__domain_type(gc, domid);
+ if (type == LIBXL_DOMAIN_TYPE_INVALID) {
+ rc = ERROR_FAIL;
+ goto out;
+ }
+
for (;;) {
rc = libxl__xs_transaction_start(gc, &t);
if (rc) goto out;
@@ -2170,6 +2176,23 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
flexarray_append(front, "device-type");
flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
+ /*
+ * Old PV kernel disk frontends before 2.6.26 rely on tool stack to
+ * write disk native protocol to frontend node. Xend does this, port
+ * this behaviour to xl.
+ *
+ * New kernels write this node themselves. In that case it just
+ * overwrites an existing node which is OK.
+ */
+ if (type == LIBXL_DOMAIN_TYPE_PV) {
+ const char *protocol =
+ xc_domain_get_native_protocol(ctx->xch, domid);
+ if (protocol) {
+ flexarray_append(front, "protocol");
+ flexarray_append(front, libxl__strdup(gc, protocol));
+ }
+ }
+
libxl__device_generic_add(gc, t, device,
libxl__xs_kvs_of_flexarray(gc, back, back->count),
libxl__xs_kvs_of_flexarray(gc, front, front->count));