]>
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 | |
34 | index 0502f42be6..cc231ec3f2 100644 | |
35 | --- a/block/monitor/block-hmp-cmds.c | |
36 | +++ b/block/monitor/block-hmp-cmds.c | |
37 | @@ -1049,7 +1049,9 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict) | |
38 | false, false, // PBS encrypt | |
39 | true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA, | |
40 | false, NULL, false, NULL, !!devlist, | |
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 | |
49 | index 2e22030eec..e9aa7e0f49 100644 | |
50 | --- a/pve-backup.c | |
51 | +++ b/pve-backup.c | |
52 | @@ -55,6 +55,7 @@ static struct PVEBackupState { | |
53 | bool starting; | |
54 | } stat; | |
55 | int64_t speed; | |
56 | + BackupPerf perf; | |
57 | VmaWriter *vmaw; | |
58 | ProxmoxBackupHandle *pbs; | |
59 | GList *di_list; | |
60 | @@ -492,8 +493,6 @@ static void create_backup_jobs_bh(void *opaque) { | |
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) { | |
69 | @@ -513,8 +512,9 @@ static void create_backup_jobs_bh(void *opaque) { | |
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 | ||
79 | di->job = job; | |
80 | if (job) { | |
81 | @@ -584,7 +584,9 @@ UuidInfo coroutine_fn *qmp_backup( | |
82 | bool has_config_file, const char *config_file, | |
83 | bool has_firewall_file, const char *firewall_file, | |
84 | bool has_devlist, const char *devlist, | |
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 | ||
92 | @@ -914,6 +916,11 @@ UuidInfo coroutine_fn *qmp_backup( | |
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 | ||
104 | @@ -1089,5 +1096,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) | |
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 | |
5b15e2ec | 112 | index cc2ead0b75..e3f62faa81 100644 |
ed012365 WB |
113 | --- a/qapi/block-core.json |
114 | +++ b/qapi/block-core.json | |
5b15e2ec | 115 | @@ -829,6 +829,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 | ## | |
5b15e2ec | 124 | @@ -847,7 +849,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 | ## | |
5b15e2ec | 135 | @@ -902,7 +906,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: |