[PVE-Backup: avoid coroutines to fix AIO freeze, cleanups]
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
+[add new force parameter to job_cancel_sync calls]
+Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
block/meson.build | 5 +
block/monitor/block-hmp-cmds.c | 33 ++
create mode 100644 pve-backup.c
diff --git a/block/meson.build b/block/meson.build
-index 19bc2b7cbb..9e433daf2e 100644
+index 7883df047c..9d3dd5b7c3 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -46,6 +46,11 @@ block_ss.add(files(
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 3e6670c963..1e29681d30 100644
+index 2ac4aedfff..f6668ab01d 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -1015,3 +1015,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
+ hmp_handle_error(mon, error);
+}
diff --git a/blockdev.c b/blockdev.c
-index b6f797b41f..84e9b898be 100644
+index 4be0863050..29fee73cbd 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -36,6 +36,7 @@
#include "monitor/monitor.h"
#include "qemu/error-report.h"
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index e6dd3be07a..15ddecada1 100644
+index 245f8acc55..3e7f2421eb 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
-@@ -497,6 +497,20 @@ SRST
+@@ -482,6 +482,20 @@ SRST
Show the current VM UUID.
ERST
{
.name = "usernet",
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 42203dbe92..7faba36b39 100644
+index 1ad13b668b..d4bb00216e 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -99,6 +99,35 @@ ERST
{
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 8f6135e6a5..4a572a2e34 100644
+index 1574b5564b..77076d7be3 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -66,7 +66,7 @@
+@@ -67,7 +67,7 @@
typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf);
uint64_t byte_size,
BackupDumpFunc *dump_cb,
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index 1247d7362a..8d3df46c93 100644
+index 3a39ba41b5..d269b4c99c 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
-@@ -29,6 +29,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
+@@ -30,6 +30,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
void hmp_info_spice(Monitor *mon, const QDict *qdict);
-@@ -72,6 +73,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
+@@ -73,6 +74,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
void hmp_set_password(Monitor *mon, const QDict *qdict);
void hmp_expire_password(Monitor *mon, const QDict *qdict);
void hmp_change(Monitor *mon, const QDict *qdict);
void hmp_device_add(Monitor *mon, const QDict *qdict);
void hmp_device_del(Monitor *mon, const QDict *qdict);
diff --git a/meson.build b/meson.build
-index cc46eabb42..7d7e474313 100644
+index 54c23b9567..37dab249cc 100644
--- a/meson.build
+++ b/meson.build
-@@ -1065,6 +1065,7 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -1203,6 +1203,7 @@ keyutils = dependency('libkeyutils', required: false,
has_gettid = cc.has_function('gettid')
libuuid = cc.find_library('uuid', required: true)
+libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
- # Malloc tests
-
+ # libselinux
+ selinux = dependency('libselinux',
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 64a84cf4ee..7efcd2d641 100644
+index 5000ce39d1..b2687eae3a 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -195,6 +195,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
+#endif /* PROXMOX_BACKUP_CLIENT_H */
diff --git a/pve-backup.c b/pve-backup.c
new file mode 100644
-index 0000000000..66868dec14
+index 0000000000..88f5ee133f
--- /dev/null
+++ b/pve-backup.c
@@ -0,0 +1,959 @@
+ if (next_job) {
+ AioContext *aio_context = next_job->job.aio_context;
+ aio_context_acquire(aio_context);
-+ job_cancel_sync(&next_job->job);
++ job_cancel_sync(&next_job->job, true);
+ aio_context_release(aio_context);
+ } else {
+ break;
+ if (job_should_pause(&job->job)) {
+ bool error_or_canceled = pvebackup_error_or_canceled();
+ if (error_or_canceled) {
-+ job_cancel_sync(&job->job);
++ job_cancel_sync(&job->job, true);
+ } else {
+ job_resume(&job->job);
+ }
+ return info;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index fdfa579d00..c5d604693f 100644
+index cd69af921e..e4c3de0804 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -699,6 +699,115 @@
+@@ -744,6 +744,115 @@
{ 'command': 'query-block', 'returns': ['BlockInfo'] }
# @BlockDeviceTimedStats:
#
diff --git a/qapi/common.json b/qapi/common.json
-index 7c976296f0..0690b07903 100644
+index 412cc4f5ae..3e7a77ea66 100644
--- a/qapi/common.json
+++ b/qapi/common.json
-@@ -197,3 +197,16 @@
- { 'enum': 'GrabToggleKeys',
- 'data': [ 'ctrl-ctrl', 'alt-alt', 'shift-shift','meta-meta', 'scrolllock',
- 'ctrl-scrolllock' ] }
+@@ -208,3 +208,16 @@
+ ##
+ { 'struct': 'HumanReadableText',
+ 'data': { 'human-readable-text': 'str' } }
+
+##
+# @UuidInfo:
+##
+{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
diff --git a/qapi/machine.json b/qapi/machine.json
-index a6f483af4f..6effa7ad30 100644
+index a05c46e253..e2cec7922f 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -4,6 +4,8 @@