]>
Commit | Line | Data |
---|---|---|
ed012365 WB |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Fiona Ebner <f.ebner@proxmox.com> | |
3 | Date: Mon, 3 Oct 2022 15:52:04 +0200 | |
4 | Subject: [PATCH] PVE Backup: allow passing max-workers performance setting | |
5 | ||
6 | For query-proxmox-support, add an indication that it's possible to use | |
7 | the setting. | |
8 | ||
9 | For now, the other two BackupPerf settings are not exposed: | |
10 | ||
11 | * use-copy-range: would need to be implemented by the backup-dump | |
12 | block driver first, and in fact, the default for backup was changed, | |
13 | because it wasn't as fast for backup in QEMU, see commit | |
14 | 6a30f663d4c0b3c45a544d541e0c4e214b2473a1. | |
15 | ||
16 | * max-chunk: enforced to be at least the backup cluster size, which is | |
17 | 4 MiB for PBS and otherwise maximum of source and target cluster size. | |
18 | And block-copy has a maximum buffer size of 1 MiB, so setting a larger | |
19 | max-chunk doesn't even have an effect. To make the setting sensibly | |
20 | usable the check would need to be removed and optionally the | |
21 | block-copy max buffer size would need to be bumped. I tried doing just | |
22 | that, and tested different source/target combinations with different | |
23 | max-chunk settings, but there were no noticable improvements over the | |
24 | default "unlimited" (resulting in 1 MiB for block-copy). | |
25 | ||
26 | Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> | |
27 | --- | |
28 | block/monitor/block-hmp-cmds.c | 4 +++- | |
29 | pve-backup.c | 18 +++++++++++++----- | |
30 | qapi/block-core.json | 9 +++++++-- | |
31 | 3 files changed, 23 insertions(+), 8 deletions(-) | |
32 | ||
33 | diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c | |
53b56ca7 | 34 | index ac23f21eef..636509b83e 100644 |
ed012365 WB |
35 | --- a/block/monitor/block-hmp-cmds.c |
36 | +++ b/block/monitor/block-hmp-cmds.c | |
53b56ca7 | 37 | @@ -1063,7 +1063,9 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict) |
ed012365 WB |
38 | false, false, // PBS encrypt |
39 | true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA, | |
bf251437 | 40 | NULL, NULL, |
ed012365 WB |
41 | - devlist, qdict_haskey(qdict, "speed"), speed, &error); |
42 | + devlist, qdict_haskey(qdict, "speed"), speed, | |
43 | + false, 0, // BackupPerf max-workers | |
44 | + &error); | |
45 | ||
46 | hmp_handle_error(mon, error); | |
47 | } | |
48 | diff --git a/pve-backup.c b/pve-backup.c | |
53b56ca7 | 49 | index 04c8ce0a3d..56da408001 100644 |
ed012365 WB |
50 | --- a/pve-backup.c |
51 | +++ b/pve-backup.c | |
bf251437 | 52 | @@ -57,6 +57,7 @@ static struct PVEBackupState { |
ed012365 WB |
53 | bool starting; |
54 | } stat; | |
55 | int64_t speed; | |
56 | + BackupPerf perf; | |
57 | VmaWriter *vmaw; | |
58 | ProxmoxBackupHandle *pbs; | |
59 | GList *di_list; | |
bf251437 | 60 | @@ -492,8 +493,6 @@ static void create_backup_jobs_bh(void *opaque) { |
ed012365 WB |
61 | } |
62 | backup_state.txn = job_txn_new_seq(); | |
63 | ||
64 | - BackupPerf perf = { .max_workers = 16 }; | |
65 | - | |
66 | /* create and start all jobs (paused state) */ | |
67 | GList *l = backup_state.di_list; | |
68 | while (l) { | |
bf251437 | 69 | @@ -513,8 +512,9 @@ static void create_backup_jobs_bh(void *opaque) { |
ed012365 WB |
70 | |
71 | BlockJob *job = backup_job_create( | |
72 | NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap, | |
73 | - bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, | |
74 | - JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err); | |
75 | + bitmap_mode, false, NULL, &backup_state.perf, BLOCKDEV_ON_ERROR_REPORT, | |
76 | + BLOCKDEV_ON_ERROR_REPORT, JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, | |
77 | + &local_err); | |
78 | ||
d03e1b3c FE |
79 | aio_context_release(aio_context); |
80 | ||
bf251437 FE |
81 | @@ -585,7 +585,9 @@ UuidInfo coroutine_fn *qmp_backup( |
82 | const char *config_file, | |
83 | const char *firewall_file, | |
84 | const char *devlist, | |
ed012365 WB |
85 | - bool has_speed, int64_t speed, Error **errp) |
86 | + bool has_speed, int64_t speed, | |
87 | + bool has_max_workers, int64_t max_workers, | |
88 | + Error **errp) | |
89 | { | |
90 | assert(qemu_in_coroutine()); | |
91 | ||
bf251437 | 92 | @@ -915,6 +917,11 @@ UuidInfo coroutine_fn *qmp_backup( |
ed012365 WB |
93 | |
94 | backup_state.speed = (has_speed && speed > 0) ? speed : 0; | |
95 | ||
96 | + backup_state.perf = (BackupPerf){ .max_workers = 16 }; | |
97 | + if (has_max_workers) { | |
98 | + backup_state.perf.max_workers = max_workers; | |
99 | + } | |
100 | + | |
101 | backup_state.vmaw = vmaw; | |
102 | backup_state.pbs = pbs; | |
103 | ||
bf251437 | 104 | @@ -1086,5 +1093,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) |
ed012365 WB |
105 | ret->pbs_dirty_bitmap_migration = true; |
106 | ret->query_bitmap_info = true; | |
107 | ret->pbs_masterkey = true; | |
108 | + ret->backup_max_workers = true; | |
109 | return ret; | |
110 | } | |
111 | diff --git a/qapi/block-core.json b/qapi/block-core.json | |
bf251437 | 112 | index 9edeb33d82..809f3c61bc 100644 |
ed012365 WB |
113 | --- a/qapi/block-core.json |
114 | +++ b/qapi/block-core.json | |
bf251437 | 115 | @@ -924,6 +924,8 @@ |
ed012365 WB |
116 | # |
117 | # @encrypt: use encryption ((optional for format 'pbs', defaults to true if there is a keyfile) | |
118 | # | |
119 | +# @max-workers: see @BackupPerf for details. Default 16. | |
120 | +# | |
121 | # Returns: the uuid of the backup job | |
122 | # | |
123 | ## | |
bf251437 | 124 | @@ -942,7 +944,9 @@ |
ed012365 WB |
125 | '*format': 'BackupFormat', |
126 | '*config-file': 'str', | |
127 | '*firewall-file': 'str', | |
128 | - '*devlist': 'str', '*speed': 'int' }, | |
129 | + '*devlist': 'str', | |
130 | + '*speed': 'int', | |
131 | + '*max-workers': 'int' }, | |
132 | 'returns': 'UuidInfo', 'coroutine': true } | |
133 | ||
134 | ## | |
bf251437 | 135 | @@ -997,7 +1001,8 @@ |
ed012365 WB |
136 | 'pbs-dirty-bitmap-savevm': 'bool', |
137 | 'pbs-dirty-bitmap-migration': 'bool', | |
138 | 'pbs-masterkey': 'bool', | |
139 | - 'pbs-library-version': 'str' } } | |
140 | + 'pbs-library-version': 'str', | |
141 | + 'backup-max-workers': 'bool' } } | |
142 | ||
143 | ## | |
144 | # @query-proxmox-support: |