Configure CI (#2)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2 Co-authored-by: Pierre HUBERT <pierre.git@communiquons.org> Co-committed-by: Pierre HUBERT <pierre.git@communiquons.org>
This commit is contained in:
@ -8,7 +8,7 @@ use crate::libvirt_rest_structures::hypervisor::HypervisorInfo;
|
||||
use crate::nat::nat_hook;
|
||||
use crate::utils::net_utils;
|
||||
use actix_web::{HttpResponse, Responder};
|
||||
use sysinfo::{System, SystemExt};
|
||||
use sysinfo::{Components, Disks, Networks, System};
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct StaticConfig {
|
||||
@ -106,18 +106,33 @@ pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
|
||||
struct ServerInfo {
|
||||
hypervisor: HypervisorInfo,
|
||||
system: System,
|
||||
components: Components,
|
||||
disks: Disks,
|
||||
networks: Networks,
|
||||
}
|
||||
|
||||
pub async fn server_info(client: LibVirtReq) -> HttpResult {
|
||||
let mut system = System::new();
|
||||
system.refresh_disks_list();
|
||||
system.refresh_components_list();
|
||||
system.refresh_networks_list();
|
||||
system.refresh_all();
|
||||
|
||||
let mut components = Components::new();
|
||||
components.refresh_list();
|
||||
components.refresh();
|
||||
|
||||
let mut disks = Disks::new();
|
||||
disks.refresh_list();
|
||||
disks.refresh();
|
||||
|
||||
let mut networks = Networks::new();
|
||||
networks.refresh_list();
|
||||
networks.refresh();
|
||||
|
||||
Ok(HttpResponse::Ok().json(ServerInfo {
|
||||
hypervisor: client.get_info().await?,
|
||||
system,
|
||||
components,
|
||||
disks,
|
||||
networks,
|
||||
}))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user