blob: 8e176598bdef73de5b39d282c8c4a7046b5cff9f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use std::convert::TryFrom;
use virt::{connect::Connect, domain::Domain;};
use crate::errors::Error;
/**
* Represents a virtual machine, that's active on some server
*/
pub struct VirtualMachine {
/// The assigned name of the VM
pub name: String,
/// The network address of the physical machine that's hosting this machine
pub host_server: String,
/// Whether or not the VM is active
pub is_active: bool,
/// The libvirtd-assigned UUID
pub uuid: String,
/// The network address of the VM
pub addr: Option<String>,
/// How much RAM (in MB) is assigned to the VM
pub assigned_mem_mb: u64,
/// How many vCPUs are assigned to the VM
pub assigned_cpus: u64,
}
impl TryFrom<Domain> for VirtualMachine {
type Error = Error;
fn try_from(d: Domain) -> Result<Self, Self::Error> {
|