aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTim Deegan <Tim.Deegan@xensource.com>2007-07-24 15:47:36 +0100
committerTim Deegan <Tim.Deegan@xensource.com>2007-07-24 15:47:36 +0100
commit3e3989b612f269221d3bb510a619fd2baa0f68a6 (patch)
tree41e15af2cb198f4fc09ce796ccaa6efa8d949bb7 /tools
parentd55594ec24fb3a2efe1a88c976386af9faa77f0d (diff)
downloadxen-3e3989b612f269221d3bb510a619fd2baa0f68a6.tar.gz
xen-3e3989b612f269221d3bb510a619fd2baa0f68a6.tar.bz2
xen-3e3989b612f269221d3bb510a619fd2baa0f68a6.zip
[HVM] Live-migration fixups after 15639:c585f993385c
Use the same xenstore area for log-dirty commands as for save/continue, and avoid a race condition by acking the save command after the save. Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/ioemu/target-i386-dm/helper2.c3
-rw-r--r--tools/ioemu/xenstore.c39
-rw-r--r--tools/xcutils/xc_save.c4
3 files changed, 23 insertions, 23 deletions
diff --git a/tools/ioemu/target-i386-dm/helper2.c b/tools/ioemu/target-i386-dm/helper2.c
index 7b4dcca687..070109a6cd 100644
--- a/tools/ioemu/target-i386-dm/helper2.c
+++ b/tools/ioemu/target-i386-dm/helper2.c
@@ -632,7 +632,6 @@ int main_loop(void)
/* Wait up to 10 msec. */
main_loop_wait(10);
- xenstore_record_dm_state("paused");
fprintf(logfile, "device model saving state\n");
/* Pull all outstanding ioreqs through the system */
@@ -644,6 +643,8 @@ int main_loop(void)
"/var/lib/xen/qemu-save.%d", domid);
do_savevm(qemu_file);
+ xenstore_record_dm_state("paused");
+
/* Wait to be allowed to continue */
while (suspend_requested) {
FD_ZERO(&fds);
diff --git a/tools/ioemu/xenstore.c b/tools/ioemu/xenstore.c
index 37c535e7b5..80ba5f40a9 100644
--- a/tools/ioemu/xenstore.c
+++ b/tools/ioemu/xenstore.c
@@ -181,7 +181,8 @@ void xenstore_parse_domain_config(int domid)
}
/* Set a watch for log-dirty requests from the migration tools */
- if (pasprintf(&buf, "%s/logdirty/next-active", path) != -1) {
+ if (pasprintf(&buf, "/local/domain/0/device-model/%u/logdirty/next-active",
+ domid) != -1) {
xs_watch(xsh, buf, "logdirty");
fprintf(logfile, "Watching %s\n", buf);
}
@@ -224,33 +225,26 @@ void xenstore_process_logdirty_event(void)
unsigned int len;
int i;
- fprintf(logfile, "Triggered log-dirty buffer switch\n");
-
if (!seg) {
- char *path, *p, *key_ascii, key_terminated[17] = {0,};
+ char *path = NULL, *key_ascii, key_terminated[17] = {0,};
key_t key;
int shmid;
/* Find and map the shared memory segment for log-dirty bitmaps */
- if (!(path = xs_get_domain_path(xsh, domid))) {
- fprintf(logfile, "Log-dirty: can't get domain path in store\n");
- exit(1);
- }
- if (!(path = realloc(path, strlen(path)
- + strlen("/logdirty/next-active") + 1))) {
+ if (pasprintf(&path,
+ "/local/domain/0/device-model/%u/logdirty/key",
+ domid) == -1) {
fprintf(logfile, "Log-dirty: out of memory\n");
exit(1);
}
- strcat(path, "/logdirty/");
- p = path + strlen(path);
- strcpy(p, "key");
key_ascii = xs_read(xsh, XBT_NULL, path, &len);
- if (!key_ascii) {
+ free(path);
+
+ if (!key_ascii)
/* No key yet: wait for the next watch */
- free(path);
return;
- }
+
strncpy(key_terminated, key_ascii, 16);
free(key_ascii);
key = (key_t) strtoull(key_terminated, NULL, 16);
@@ -282,18 +276,21 @@ void xenstore_process_logdirty_event(void)
}
/* Remember the paths for the next-active and active entries */
- strcpy(p, "active");
- if (!(active_path = strdup(path))) {
+ if (pasprintf(&active_path,
+ "/local/domain/0/device-model/%u/logdirty/active",
+ domid) == -1) {
fprintf(logfile, "Log-dirty: out of memory\n");
exit(1);
}
- strcpy(p, "next-active");
- if (!(next_active_path = strdup(path))) {
+ if (pasprintf(&next_active_path,
+ "/local/domain/0/device-model/%u/logdirty/next-active",
+ domid) == -1) {
fprintf(logfile, "Log-dirty: out of memory\n");
exit(1);
}
- free(path);
}
+
+ fprintf(logfile, "Triggered log-dirty buffer switch\n");
/* Read the required active buffer from the store */
act = xs_read(xsh, XBT_NULL, next_active_path, &len);
diff --git a/tools/xcutils/xc_save.c b/tools/xcutils/xc_save.c
index 4bfcc67a8d..188ea7b72e 100644
--- a/tools/xcutils/xc_save.c
+++ b/tools/xcutils/xc_save.c
@@ -123,11 +123,13 @@ static void * init_qemu_maps(int domid, unsigned int bitmap_size)
/* Tell qemu about it */
if ((xs = xs_daemon_open()) == NULL)
errx(1, "Couldn't contact xenstore");
- if (!(path = xs_get_domain_path(xs, domid)))
+ if (!(path = strdup("/local/domain/0/device-model/")))
errx(1, "can't get domain path in store");
if (!(path = realloc(path, strlen(path)
+ + 10
+ strlen("/logdirty/next-active") + 1)))
errx(1, "no memory for constructing xenstore path");
+ snprintf(path + strlen(path), 11, "%i", domid);
strcat(path, "/logdirty/");
p = path + strlen(path);