refactor(#2352): subvolume snapshot ops via daemon wire commands
This commit is contained in:
parent
860484a193
commit
7b54e7aa50
3 changed files with 138 additions and 29 deletions
|
|
@ -202,6 +202,19 @@ async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
|
|||
HostRequest::QuotaEnable => handle_quota_enable().await?,
|
||||
HostRequest::QuotaLimit { name, limit } => handle_quota_limit(name, *limit).await?,
|
||||
HostRequest::QuotaShow { name } => handle_quota_show(name.as_deref()).await?,
|
||||
HostRequest::UpgradeSubvolume { name } => handle_upgrade_subvolume(name).await?,
|
||||
HostRequest::SnapshotSubvolume { name, label } => {
|
||||
handle_snapshot_subvolume(name, label).await?
|
||||
}
|
||||
HostRequest::DeleteSnapshot { name, label } => {
|
||||
handle_delete_snapshot(name, label).await?
|
||||
}
|
||||
HostRequest::SendSnapshot {
|
||||
name,
|
||||
label,
|
||||
parent,
|
||||
dest,
|
||||
} => handle_send_snapshot(name, label, parent.as_deref(), dest).await?,
|
||||
})
|
||||
}
|
||||
.await;
|
||||
|
|
@ -469,6 +482,39 @@ async fn handle_quota_show(name: Option<&str>) -> Result<HostResponse> {
|
|||
Ok(HostResponse::quota(rows))
|
||||
}
|
||||
|
||||
async fn handle_upgrade_subvolume(name: &str) -> Result<HostResponse> {
|
||||
crate::priv_client::upgrade_agent_subvolume(name)
|
||||
.await
|
||||
.with_context(|| format!("upgrade {name} state subvolume"))?;
|
||||
Ok(HostResponse::success())
|
||||
}
|
||||
|
||||
async fn handle_snapshot_subvolume(name: &str, label: &str) -> Result<HostResponse> {
|
||||
let path = crate::priv_client::snapshot_agent_subvolume(name, label)
|
||||
.await
|
||||
.with_context(|| format!("snapshot {name} state subvolume (label {label:?})"))?;
|
||||
Ok(HostResponse::messages(vec![path]))
|
||||
}
|
||||
|
||||
async fn handle_delete_snapshot(name: &str, label: &str) -> Result<HostResponse> {
|
||||
crate::priv_client::delete_agent_snapshot(name, label)
|
||||
.await
|
||||
.with_context(|| format!("delete {name} snapshot (label {label:?})"))?;
|
||||
Ok(HostResponse::success())
|
||||
}
|
||||
|
||||
async fn handle_send_snapshot(
|
||||
name: &str,
|
||||
label: &str,
|
||||
parent: Option<&str>,
|
||||
dest: &str,
|
||||
) -> Result<HostResponse> {
|
||||
let path = crate::priv_client::send_agent_snapshot_to_file(name, label, parent, dest)
|
||||
.await
|
||||
.with_context(|| format!("send {name} snapshot (label {label:?}) to file {dest:?}"))?;
|
||||
Ok(HostResponse::messages(vec![path]))
|
||||
}
|
||||
|
||||
async fn handle_matrix_sync_admin() -> Result<HostResponse> {
|
||||
require_matrix_present().await?;
|
||||
let register_token =
|
||||
|
|
|
|||
Loading…
Reference in a new issue