aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_save.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-10-21 18:46:32 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-10-21 18:46:32 +0100
commita050657a54f734d6ed809072f9c1329d8324ee67 (patch)
treeb253477d9ded8728a0722ccc31da7c76a56f2836 /tools/libxc/xc_domain_save.c
parent49fa0e868f1e3748a25c60cf2a36b5c40a135b83 (diff)
downloadxen-a050657a54f734d6ed809072f9c1329d8324ee67.tar.gz
xen-a050657a54f734d6ed809072f9c1329d8324ee67.tar.bz2
xen-a050657a54f734d6ed809072f9c1329d8324ee67.zip
tools: cleanup domain save switch_qemu_logdirty callback
Move the function into struct save_callbacks with the others and add the void *closure to the callback arguments. Add and propagate an error return code from the callback. Use this in libxl to pass the save context to libxl__domain_suspend_common_switch_qemu_logdirty allowing us to reuse the parent's xenstore handle, gc context etc. Also add an apparently missing libxl__free_all to libxl__domain_suspend_common. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_save.c')
-rw-r--r--tools/libxc/xc_domain_save.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index b6e239200b..47f8a79c9d 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -873,8 +873,7 @@ static int save_tsc_info(xc_interface *xch, uint32_t dom, int io_fd)
int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags,
- struct save_callbacks* callbacks,
- int hvm, void (*switch_qemu_logdirty)(int, unsigned))
+ struct save_callbacks* callbacks, int hvm)
{
xc_dominfo_t info;
DECLARE_DOMCTL;
@@ -938,6 +937,13 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
int completed = 0;
+ if ( hvm && !callbacks->switch_qemu_logdirty )
+ {
+ ERROR("No switch_qemu_logdirty callback provided.");
+ errno = EINVAL;
+ return 1;
+ }
+
outbuf_init(xch, &ob, OUTBUF_SIZE);
/* If no explicit control parameters given, use defaults */
@@ -1009,8 +1015,11 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
}
/* Enable qemu-dm logging dirty pages to xen */
- if ( hvm )
- switch_qemu_logdirty(dom, 1);
+ if ( hvm && !callbacks->switch_qemu_logdirty(dom, 1, callbacks->data) )
+ {
+ PERROR("Couldn't enable qemu log-dirty mode (errno %d)", errno);
+ goto out;
+ }
}
else
{
@@ -1870,8 +1879,8 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
XEN_DOMCTL_SHADOW_OP_OFF,
NULL, 0, NULL, 0, NULL) < 0 )
DPRINTF("Warning - couldn't disable shadow mode");
- if ( hvm )
- switch_qemu_logdirty(dom, 0);
+ if ( hvm && !callbacks->switch_qemu_logdirty(dom, 0, callbacks->data) )
+ DPRINTF("Warning - couldn't disable qemu log-dirty mode");
}
if ( live_shinfo )