aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/planet.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/planet.rs b/src/planet.rs
index 6ba795f..b5905ec 100644
--- a/src/planet.rs
+++ b/src/planet.rs
@@ -60,6 +60,8 @@ pub struct Planet {
/// Whether the planet is "orbiting" (running)
pub orbiting: bool,
+ pub status: Health,
+
#[serde(skip)]
domain: Option<Arc<Domain>>,
}
@@ -99,6 +101,8 @@ impl TryFrom<Domain> for Planet {
None
};
+ let health = d.get_state()?.0.try_into()?;
+
Ok(Self {
name: d.get_name()?,
host: c.get_hostname()?,
@@ -107,6 +111,7 @@ impl TryFrom<Domain> for Planet {
mem: d.get_max_memory()?.into(),
cpu_count: d.get_max_vcpus()?.into(),
orbiting: d.is_active()?,
+ status: health,
domain: Some(Arc::new(d)),
})
}
@@ -144,6 +149,8 @@ impl TryFrom<&Domain> for Planet {
let new_d = Domain::lookup_by_uuid_string(&c, &d.get_uuid_string()?)?;
+ let health = d.get_state()?.0.try_into()?;
+
Ok(Self {
name: d.get_name()?,
host: c.get_hostname()?,
@@ -152,12 +159,13 @@ impl TryFrom<&Domain> for Planet {
mem: d.get_max_memory()?.into(),
cpu_count: d.get_max_vcpus()?.into(),
orbiting: d.is_active()?,
+ status: health,
domain: Some(Arc::new(new_d)),
})
}
}
-#[derive(Serialize, Deserialize, Debug, PartialEq)]
+#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub enum Health {
Unknown = 0,
Running = 1,