mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-02 19:36:45 +00:00
fix #3786: api: add resync-corrupt option to sync jobs
This option allows us to "fix" corrupt snapshots (and/or their chunks) by pulling them from another remote. When traversing the remote snapshots, we check if it exists locally, and if it is, we check if the last verification of it failed. If the local snapshot is broken and the `resync-corrupt` option is turned on, we pull in the remote snapshot, overwriting the local one. This is very useful and has been requested a lot, as there is currently no way to "fix" corrupt chunks/snapshots even if the user has a healthy version of it on their offsite instance. Originally-by: Shannon Sterz <s.sterz@proxmox.com> Signed-off-by: Gabriel Goller <g.goller@proxmox.com> Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
916c46905b
commit
32969b47e1
@ -536,6 +536,10 @@ impl SyncDirection {
|
||||
}
|
||||
}
|
||||
|
||||
pub const RESYNC_CORRUPT_SCHEMA: Schema =
|
||||
BooleanSchema::new("If the verification failed for a local snapshot, try to pull it again.")
|
||||
.schema();
|
||||
|
||||
#[api(
|
||||
properties: {
|
||||
id: {
|
||||
@ -590,6 +594,10 @@ impl SyncDirection {
|
||||
schema: TRANSFER_LAST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
"resync-corrupt": {
|
||||
schema: RESYNC_CORRUPT_SCHEMA,
|
||||
optional: true,
|
||||
}
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Clone, Updater, PartialEq)]
|
||||
@ -623,6 +631,8 @@ pub struct SyncJobConfig {
|
||||
pub limit: RateLimitConfig,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub transfer_last: Option<usize>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resync_corrupt: Option<bool>,
|
||||
}
|
||||
|
||||
impl SyncJobConfig {
|
||||
|
Loading…
Reference in New Issue
Block a user