include/migration/snapshot.h | 1 +
include/monitor/hmp.h | 5 +
migration/meson.build | 1 +
- migration/savevm-async.c | 591 +++++++++++++++++++++++++++++++++++
+ migration/savevm-async.c | 598 +++++++++++++++++++++++++++++++++++
monitor/hmp-cmds.c | 57 ++++
qapi/migration.json | 34 ++
qapi/misc.json | 32 ++
qemu-options.hx | 12 +
softmmu/vl.c | 10 +
- 11 files changed, 789 insertions(+)
+ 11 files changed, 796 insertions(+)
create mode 100644 migration/savevm-async.c
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
))
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
new file mode 100644
-index 0000000000..4e345c1a7d
+index 0000000000..593a619088
--- /dev/null
+++ b/migration/savevm-async.c
-@@ -0,0 +1,591 @@
+@@ -0,0 +1,598 @@
+#include "qemu/osdep.h"
+#include "migration/migration.h"
+#include "migration/savevm.h"
+ while (snap_state.state == SAVE_STATE_ACTIVE) {
+ uint64_t pending_size, pend_precopy, pend_compatible, pend_postcopy;
+
++ /* pending is expected to be called without iothread lock */
++ qemu_mutex_unlock_iothread();
+ qemu_savevm_state_pending(snap_state.file, 0, &pend_precopy, &pend_compatible, &pend_postcopy);
++ qemu_mutex_lock_iothread();
++
+ pending_size = pend_precopy + pend_compatible + pend_postcopy;
+
+ maxlen = blk_getlength(snap_state.target) - 30*1024*1024;
+ qemu_system_reset(SHUTDOWN_CAUSE_NONE);
+ ret = qemu_loadvm_state(f);
+
++ /* dirty bitmap migration has a special case we need to trigger manually */
++ dirty_bitmap_mig_before_vm_start();
++
+ qemu_fclose(f);
+ migration_incoming_state_destroy();
+ if (ret < 0) {
int qemu_get_fd(QEMUFile *f);
int qemu_fclose(QEMUFile *f);
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
-index 4e345c1a7d..8a17ec1f74 100644
+index 593a619088..cc2552d977 100644
--- a/migration/savevm-async.c
+++ b/migration/savevm-async.c
-@@ -414,7 +414,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
+@@ -418,7 +418,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
goto restart;
}
if (!snap_state.file) {
error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
-@@ -563,7 +563,7 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
+@@ -567,7 +567,7 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
blk_op_block_all(be, blocker);
/* restore the VM state */
[PVE: query-proxmox-support: include library version]
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
- pve-backup.c | 8 ++++++++
- qapi/block-core.json | 25 +++++++++++++++++++++++++
- 2 files changed, 33 insertions(+)
+ pve-backup.c | 9 +++++++++
+ qapi/block-core.json | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 38 insertions(+)
diff --git a/pve-backup.c b/pve-backup.c
-index b8182aaf89..40c2697b37 100644
+index b8182aaf89..98e79552ef 100644
--- a/pve-backup.c
+++ b/pve-backup.c
-@@ -1073,3 +1073,11 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1073,3 +1073,12 @@ BackupStatus *qmp_query_backup(Error **errp)
return info;
}
+ ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret));
+ ret->pbs_library_version = g_strdup(proxmox_backup_qemu_version());
+ ret->pbs_dirty_bitmap = true;
++ ret->pbs_dirty_bitmap_savevm = true;
+ return ret;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 553112d998..e0a0a60354 100644
+index 553112d998..f3608390c4 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -868,6 +868,31 @@
+@@ -868,6 +868,35 @@
##
{ 'command': 'backup-cancel' }
+# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
+# supported.
+#
++# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
++# safely be set for savevm-async.
++#
+# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
+#
+##
+{ 'struct': 'ProxmoxSupportStatus',
+ 'data': { 'pbs-dirty-bitmap': 'bool',
++ 'pbs-dirty-bitmap-savevm': 'bool',
+ 'pbs-library-version': 'str' } }
+
+##
info->zero_bytes, zero_per);
diff --git a/pve-backup.c b/pve-backup.c
-index 40c2697b37..1e7b92a950 100644
+index 98e79552ef..8305105fd5 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -46,6 +46,7 @@ static struct PVEBackupState {
err:
l = di_list;
-@@ -1074,10 +1100,41 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1074,11 +1100,42 @@ BackupStatus *qmp_query_backup(Error **errp)
return info;
}
ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret));
ret->pbs_library_version = g_strdup(proxmox_backup_qemu_version());
ret->pbs_dirty_bitmap = true;
+ ret->pbs_dirty_bitmap_savevm = true;
+ ret->query_bitmap_info = true;
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index e0a0a60354..b368371e8e 100644
+index f3608390c4..f57fda122c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -876,11 +876,14 @@
+@@ -876,6 +876,8 @@
# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
# supported.
#
+# @query-bitmap-info: True if the 'query-pbs-bitmap-info' QMP call is supported.
+#
- # @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
+ # @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
+ # safely be set for savevm-async.
#
+@@ -884,6 +886,7 @@
##
{ 'struct': 'ProxmoxSupportStatus',
'data': { 'pbs-dirty-bitmap': 'bool',
+ 'query-bitmap-info': 'bool',
+ 'pbs-dirty-bitmap-savevm': 'bool',
'pbs-library-version': 'str' } }
- ##
-@@ -893,6 +896,59 @@
+@@ -897,6 +900,59 @@
##
{ 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' }
1 file changed, 49 insertions(+), 118 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
-index 1e7b92a950..f3df43eb8c 100644
+index 8305105fd5..d7f2b2206f 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -52,6 +52,7 @@ static struct PVEBackupState {
2 files changed, 144 insertions(+), 78 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
-index f3df43eb8c..ded90cb822 100644
+index d7f2b2206f..e671ed8d48 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap";
qemu_mutex_unlock(&backup_state.stat.lock);
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index b368371e8e..b90d6abe64 100644
+index f57fda122c..9b827cbe43 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -775,12 +775,15 @@
+ NULL);
+}
diff --git a/pve-backup.c b/pve-backup.c
-index ded90cb822..6b25292ba1 100644
+index e671ed8d48..bd2647e5f3 100644
--- a/pve-backup.c
+++ b/pve-backup.c
-@@ -1130,5 +1130,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+@@ -1130,6 +1130,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
ret->pbs_library_version = g_strdup(proxmox_backup_qemu_version());
ret->pbs_dirty_bitmap = true;
- ret->query_bitmap_info = true;
+ ret->pbs_dirty_bitmap_savevm = true;
+ ret->pbs_dirty_bitmap_migration = true;
+ ret->query_bitmap_info = true;
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index b90d6abe64..dee3d87efe 100644
+index 9b827cbe43..30eb1262ff 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -881,12 +881,18 @@
- #
- # @query-bitmap-info: True if the 'query-pbs-bitmap-info' QMP call is supported.
+@@ -884,6 +884,11 @@
+ # @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
+ # safely be set for savevm-async.
#
+# @pbs-dirty-bitmap-migration: True if safe migration of dirty-bitmaps including
+# PBS state is supported. Enabling 'dirty-bitmaps'
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
#
##
- { 'struct': 'ProxmoxSupportStatus',
+@@ -891,6 +896,7 @@
'data': { 'pbs-dirty-bitmap': 'bool',
'query-bitmap-info': 'bool',
+ 'pbs-dirty-bitmap-savevm': 'bool',
+ 'pbs-dirty-bitmap-migration': 'bool',
'pbs-library-version': 'str' } }
static void proxmox_backup_schedule_wake(void *data) {
CoCtxData *waker = (CoCtxData *)data;
diff --git a/pve-backup.c b/pve-backup.c
-index 6b25292ba1..f7597ae55c 100644
+index bd2647e5f3..dec9c0d188 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -357,7 +357,7 @@ static void job_cancel_bh(void *opaque) {
BackupStatus *qmp_query_backup(Error **errp)
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index dee3d87efe..82133e2bee 100644
+index 30eb1262ff..6ff5367383 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -847,7 +847,7 @@
false, NULL, // PBS backup-id
false, 0, // PBS backup-time
diff --git a/pve-backup.c b/pve-backup.c
-index f7597ae55c..0ecadf6ce6 100644
+index dec9c0d188..076146cc1e 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -531,6 +531,7 @@ UuidInfo coroutine_fn *qmp_backup(
has_compress ? compress : true,
has_encrypt ? encrypt : has_keyfile,
has_fingerprint ? fingerprint : NULL,
-@@ -1041,5 +1043,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
- ret->pbs_dirty_bitmap = true;
- ret->query_bitmap_info = true;
+@@ -1042,5 +1044,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+ ret->pbs_dirty_bitmap_savevm = true;
ret->pbs_dirty_bitmap_migration = true;
+ ret->query_bitmap_info = true;
+ ret->pbs_masterkey = true;
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 82133e2bee..be3d6a0d37 100644
+index 6ff5367383..bef9b65fec 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -818,6 +818,8 @@
'*fingerprint': 'str',
'*backup-id': 'str',
'*backup-time': 'int',
-@@ -886,6 +889,9 @@
+@@ -889,6 +892,9 @@
# migration cap if this is false/unset may lead
# to crashes on migration!
#
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
#
##
-@@ -893,6 +899,7 @@
- 'data': { 'pbs-dirty-bitmap': 'bool',
+@@ -897,6 +903,7 @@
'query-bitmap-info': 'bool',
+ 'pbs-dirty-bitmap-savevm': 'bool',
'pbs-dirty-bitmap-migration': 'bool',
+ 'pbs-masterkey': 'bool',
'pbs-library-version': 'str' } }