src/api2/node/disks.rs: implement initgpt API

This commit is contained in:
Dietmar Maurer
2020-06-07 10:30:34 +02:00
parent 9069debcd8
commit 707974fdb3
4 changed files with 171 additions and 7 deletions

View File

@ -32,6 +32,24 @@ async fn view_task_result(
Ok(())
}
// Note: local worker already printf logs to stdout, so there is no need
// to fetch/display logs. We just wait for the worker to finish.
pub async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
let upid: proxmox_backup::server::UPID = upid_str.parse()?;
let sleep_duration = core::time::Duration::new(0, 100_000_000);
loop {
if proxmox_backup::server::worker_is_active_local(&upid) {
tokio::time::delay_for(sleep_duration).await;
} else {
break;
}
}
Ok(())
}
fn connect() -> Result<HttpClient, Error> {
let uid = nix::unistd::Uid::current();