Delete files associated to VM

This commit is contained in:
Pierre HUBERT 2023-10-26 12:14:09 +02:00
parent 9371d709a5
commit f5f4239337

View File

@ -148,7 +148,14 @@ impl Handler<DeleteDomainReq> for LibVirtActor {
false => sys::VIR_DOMAIN_UNDEFINE_NVRAM,
})?;
// TODO : delete files, if requested
if !msg.keep_files {
log::info!("Delete storage associated with the domain");
let path = AppConfig::get().vm_storage_path(msg.id);
if path.exists() {
std::fs::remove_dir_all(path)?;
}
}
Ok(())
}
}