summaryrefslogtreecommitdiffstats
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorPeter Maydell2016-06-13 13:18:17 +0200
committerPeter Maydell2016-06-13 13:18:17 +0200
commit8fdf038722a00693e68b4f76a66d39781572c3ec (patch)
treeff10c2adca12a51dda06fa5ace47f8eaa816f250 /migration/savevm.c
parentMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20160611' into staging (diff)
parentIntroduce "xen-load-devices-state" (diff)
downloadqemu-8fdf038722a00693e68b4f76a66d39781572c3ec.tar.gz
qemu-8fdf038722a00693e68b4f76a66d39781572c3ec.tar.xz
qemu-8fdf038722a00693e68b4f76a66d39781572c3ec.zip
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20160613-tag' into staging
Xen 2016/06/13 # gpg: Signature made Mon 13 Jun 2016 11:53:18 BST # gpg: using RSA key 0x894F8F4870E1AE90 # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" # Primary key fingerprint: D04E 33AB A51F 67BA 07D3 0AEA 894F 8F48 70E1 AE90 * remotes/sstabellini/tags/xen-20160613-tag: Introduce "xen-load-devices-state" exec: Fix qemu_ram_block_from_host for Xen Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r--migration/savevm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index 6c21231131..ae2ef8b5d4 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -31,6 +31,7 @@
#include "hw/boards.h"
#include "hw/hw.h"
#include "hw/qdev.h"
+#include "hw/xen/xen.h"
#include "net/net.h"
#include "monitor/monitor.h"
#include "sysemu/sysemu.h"
@@ -1754,6 +1755,12 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis)
return -EINVAL;
}
+ /* Validate if it is a device's state */
+ if (xen_enabled() && se->is_ram) {
+ error_report("loadvm: %s RAM loading not allowed on Xen", idstr);
+ return -EINVAL;
+ }
+
/* Add entry */
le = g_malloc0(sizeof(*le));
@@ -2064,6 +2071,36 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
}
}
+void qmp_xen_load_devices_state(const char *filename, Error **errp)
+{
+ QEMUFile *f;
+ QIOChannelFile *ioc;
+ int ret;
+
+ /* Guest must be paused before loading the device state; the RAM state
+ * will already have been loaded by xc
+ */
+ if (runstate_is_running()) {
+ error_setg(errp, "Cannot update device state while vm is running");
+ return;
+ }
+ vm_stop(RUN_STATE_RESTORE_VM);
+
+ ioc = qio_channel_file_new_path(filename, O_RDONLY | O_BINARY, 0, errp);
+ if (!ioc) {
+ return;
+ }
+ f = qemu_fopen_channel_input(QIO_CHANNEL(ioc));
+
+ migration_incoming_state_new(f);
+ ret = qemu_loadvm_state(f);
+ qemu_fclose(f);
+ if (ret < 0) {
+ error_setg(errp, QERR_IO_ERROR);
+ }
+ migration_incoming_state_destroy();
+}
+
int load_vmstate(const char *name)
{
BlockDriverState *bs, *bs_vm_state;