[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V5 11/12] Experimental support for block migrating T
From: |
Stefan Berger |
Subject: |
[Qemu-devel] [PATCH V5 11/12] Experimental support for block migrating TPMs state |
Date: |
Fri, 20 May 2011 11:42:51 -0400 |
User-agent: |
quilt/0.48-1 |
This patch adds (experimental) support for block migration.
In the case of block migration an empty QCoW2 image must be found on
the destination so that early checks on the content and whether it can be
decrytped with the provided key have to be skipped. That empty file needs
to be created by higher layers (i.e., libvirt).
Also, the completion of the block migration has to be delayed until after
the TPM has written the last bytes of its state into the block device so
that we get the latest state on the target as well. Before the change to
savevm.c it could happen that the latest state of the TPM did not make it to
the destination host since the TPM was still processing a command and
changing its state (written into block storage) but the block migration
already had finished. Re-ordering the saving of the live_state to finish
after the 'non live_state' seems to get it right.
Signed-off-by: Stefan Berger <address@hidden>
---
hw/tpm_builtin.c | 5 +++++
savevm.c | 22 +++++++++++-----------
2 files changed, 16 insertions(+), 11 deletions(-)
Index: qemu-git/hw/tpm_builtin.c
===================================================================
--- qemu-git.orig/hw/tpm_builtin.c
+++ qemu-git/hw/tpm_builtin.c
@@ -471,6 +471,11 @@ static int tpm_builtin_startup_bs(BlockD
if (!tpm_builtin_is_valid_bsdir(dir) ||
!tpm_builtin_has_valid_content(dir)) {
+ if (incoming_expected) {
+ /* during migration with block migration, we may end
+ up here due to an empty block file */
+ return -ENOKEY;
+ }
/* if it's encrypted and has something else than null-content,
we assume to have the wrong key */
if (bdrv_is_encrypted(bs)) {
Index: qemu-git/savevm.c
===================================================================
--- qemu-git.orig/savevm.c
+++ qemu-git/savevm.c
@@ -1547,17 +1547,6 @@ int qemu_savevm_state_complete(Monitor *
cpu_synchronize_all_states();
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
- if (se->save_live_state == NULL)
- continue;
-
- /* Section type */
- qemu_put_byte(f, QEMU_VM_SECTION_END);
- qemu_put_be32(f, se->section_id);
-
- se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque);
- }
-
- QTAILQ_FOREACH(se, &savevm_handlers, entry) {
int len;
if (se->save_state == NULL && se->vmsd == NULL)
@@ -1578,6 +1567,17 @@ int qemu_savevm_state_complete(Monitor *
vmstate_save(f, se);
}
+ QTAILQ_FOREACH(se, &savevm_handlers, entry) {
+ if (se->save_live_state == NULL)
+ continue;
+
+ /* Section type */
+ qemu_put_byte(f, QEMU_VM_SECTION_END);
+ qemu_put_be32(f, se->section_id);
+
+ se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque);
+ }
+
qemu_put_byte(f, QEMU_VM_EOF);
if (qemu_file_has_error(f))
- [Qemu-devel] [PATCH V5 00/12] Qemu Trusted Platform Module (TPM) integration, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 05/12] Add a debug register, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 03/12] Add persistent state handling to TPM TIS frontend driver, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 01/12] Support for TPM command line options, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 02/12] Add TPM (frontend) hardware interface (TPM TIS) to Qemu, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 08/12] Introduce file lock for the block layer, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 04/12] Add tpm_tis driver to build process, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 07/12] Implementation of the libtpms-based backend, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 12/12] Experimental support for taking measurements when kernel etc. are passed to Qemu, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 11/12] Experimental support for block migrating TPMs state,
Stefan Berger <=
- [Qemu-devel] [PATCH V5 06/12] Add a TPM backend skeleton implementation, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 10/12] Encrypt state blobs using AES CBC encryption, Stefan Berger, 2011/05/20
- [Qemu-devel] [PATCH V5 09/12] Add block storage support for libtpms based TPM backend, Stefan Berger, 2011/05/20