aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_xshelp.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-07-26 15:58:18 +0100
committerIan Campbell <ian.campbell@citrix.com>2012-07-26 15:58:18 +0100
commite158dcadaf6e6842791fe5114cc0e1de0e77ffbd (patch)
tree80d924a74c2212d9466620cc1178f23fd859b3aa /tools/libxl/libxl_xshelp.c
parentf5e3add94b9455922f3374e61acd60ffddb6b5de (diff)
downloadxen-e158dcadaf6e6842791fe5114cc0e1de0e77ffbd.tar.gz
xen-e158dcadaf6e6842791fe5114cc0e1de0e77ffbd.tar.bz2
xen-e158dcadaf6e6842791fe5114cc0e1de0e77ffbd.zip
libxl: make libxl_cdrom_insert async.
This functionality is a bit of a mess and several configurations are not properly supported. The protocol for changing is basically to change the params node in the disk xenstore backend. There is no interlock or error reporting in this protocol. Completely removing the device and recreating it is not necessary nor expected. For reference the equivalent xend code is tools/python/xen/xend/server/blkif.py::BlkifController::reconfigureDevice(). Device model stub domains are not supported. There appears to be no way correctly to do a media change on the emulated device while also changing the stub domains PV backend to point to the new backend. Reworking this is a significant task deferred until 4.3. xend (via the equivalent "xm block-configure" functionality) also does not support media change for stub domains (confirmed by code inspection and experiment). Unlike xend this version errors out instead of silently not achieving anything in this case. There is no support for qemu-xen (upstream) media change. I expect this is supported on the qemu side and required QMP plumbing on the libxl side. Again this is deferred until 4.3. On the plus side the current implementation is trivially "asynchronous". Adds a libxl__xs_writev_atonce helper to write a key-value list to xenstore in one go. Tested with Windows 7. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_xshelp.c')
-rw-r--r--tools/libxl/libxl_xshelp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
index 855ac85611..0fedf8fac0 100644
--- a/tools/libxl/libxl_xshelp.c
+++ b/tools/libxl/libxl_xshelp.c
@@ -61,6 +61,31 @@ int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
return 0;
}
+int libxl__xs_writev_atonce(libxl__gc *gc,
+ const char *dir, char *kvs[])
+{
+ int rc;
+ xs_transaction_t t = XBT_NULL;
+
+ for (;;) {
+ rc = libxl__xs_transaction_start(gc, &t);
+ if (rc) goto out;
+
+ rc = libxl__xs_writev(gc, t, dir, kvs);
+ if (rc) goto out;
+
+ rc = libxl__xs_transaction_commit(gc, &t);
+ if (!rc) break;
+ if (rc<0) goto out;
+ }
+
+out:
+ libxl__xs_transaction_abort(gc, &t);
+
+ return rc;
+
+}
+
int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
const char *path, const char *fmt, ...)
{