verify job: support max-depth config
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
		@ -186,6 +186,10 @@ pub const VERIFICATION_OUTDATED_AFTER_SCHEMA: Schema =
 | 
				
			|||||||
            optional: true,
 | 
					            optional: true,
 | 
				
			||||||
            schema: BACKUP_NAMESPACE_SCHEMA,
 | 
					            schema: BACKUP_NAMESPACE_SCHEMA,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        "max-depth": {
 | 
				
			||||||
 | 
					            optional: true,
 | 
				
			||||||
 | 
					            schema: crate::NS_MAX_DEPTH_SCHEMA,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
)]
 | 
					)]
 | 
				
			||||||
#[derive(Serialize, Deserialize, Updater)]
 | 
					#[derive(Serialize, Deserialize, Updater)]
 | 
				
			||||||
@ -212,6 +216,10 @@ pub struct VerificationJobConfig {
 | 
				
			|||||||
    #[serde(skip_serializing_if = "Option::is_none", default)]
 | 
					    #[serde(skip_serializing_if = "Option::is_none", default)]
 | 
				
			||||||
    /// on which backup namespace to run the verification recursively
 | 
					    /// on which backup namespace to run the verification recursively
 | 
				
			||||||
    pub ns: Option<BackupNamespace>,
 | 
					    pub ns: Option<BackupNamespace>,
 | 
				
			||||||
 | 
					    #[serde(skip_serializing_if = "Option::is_none", default)]
 | 
				
			||||||
 | 
					    /// how deep the verify should go from the `ns` level downwards. Passing 0 verifies only the
 | 
				
			||||||
 | 
					    /// snapshots on the same level as the passed `ns`, or the datastore root if none.
 | 
				
			||||||
 | 
					    pub max_depth: Option<usize>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[api(
 | 
					#[api(
 | 
				
			||||||
 | 
				
			|||||||
@ -157,6 +157,8 @@ pub enum DeletableProperty {
 | 
				
			|||||||
    OutdatedAfter,
 | 
					    OutdatedAfter,
 | 
				
			||||||
    /// Delete namespace property, defaulting to root namespace then.
 | 
					    /// Delete namespace property, defaulting to root namespace then.
 | 
				
			||||||
    Ns,
 | 
					    Ns,
 | 
				
			||||||
 | 
					    /// Delete max-depth property, defaulting to full recursion again
 | 
				
			||||||
 | 
					    MaxDepth,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[api(
 | 
					#[api(
 | 
				
			||||||
@ -239,6 +241,9 @@ pub fn update_verification_job(
 | 
				
			|||||||
                DeletableProperty::Ns => {
 | 
					                DeletableProperty::Ns => {
 | 
				
			||||||
                    data.ns = None;
 | 
					                    data.ns = None;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                DeletableProperty::MaxDepth => {
 | 
				
			||||||
 | 
					                    data.max_depth = None;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -278,6 +283,11 @@ pub fn update_verification_job(
 | 
				
			|||||||
            data.ns = Some(ns);
 | 
					            data.ns = Some(ns);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if let Some(max_depth) = update.max_depth {
 | 
				
			||||||
 | 
					        if max_depth <= pbs_api_types::MAX_NAMESPACE_DEPTH {
 | 
				
			||||||
 | 
					            data.max_depth = Some(max_depth);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    config.set_data(&id, "verification", &data)?;
 | 
					    config.set_data(&id, "verification", &data)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -50,7 +50,7 @@ pub fn do_verification_job(
 | 
				
			|||||||
                &verify_worker,
 | 
					                &verify_worker,
 | 
				
			||||||
                worker.upid(),
 | 
					                worker.upid(),
 | 
				
			||||||
                ns,
 | 
					                ns,
 | 
				
			||||||
                None,
 | 
					                verification_job.max_depth,
 | 
				
			||||||
                None,
 | 
					                None,
 | 
				
			||||||
                Some(&move |manifest| {
 | 
					                Some(&move |manifest| {
 | 
				
			||||||
                    verify_filter(ignore_verified_snapshots, outdated_after, manifest)
 | 
					                    verify_filter(ignore_verified_snapshots, outdated_after, manifest)
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user