aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-06-09 08:17:23 -0400
committerCara Salter <cara@devcara.com>2022-06-09 08:19:18 -0400
commitd674951ce8cb5b41afe68bbeefcd9ee585125ab9 (patch)
tree1014b011f5eff0f75eea413fafcf6db15b0e552f /src
parentc8ab6337d26d606ce003fe747af3eff6e57f4c03 (diff)
downloadsolarlib-d674951ce8cb5b41afe68bbeefcd9ee585125ab9.tar.gz
solarlib-d674951ce8cb5b41afe68bbeefcd9ee585125ab9.zip
planet: Add "orbiting" field
True when the Planet is running, false when not
Diffstat (limited to 'src')
-rw-r--r--src/planet.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/planet.rs b/src/planet.rs
index 004f223..60e9b3b 100644
--- a/src/planet.rs
+++ b/src/planet.rs
@@ -57,6 +57,9 @@ pub struct Planet {
/// The amount of vCPUs assigned to this machine
pub cpu_count: CpuCount,
+ /// Whether the planet is "orbiting" (running)
+ pub orbiting: bool,
+
#[serde(skip)]
domain: Option<Arc<Domain>>,
}
@@ -103,6 +106,7 @@ impl TryFrom<Domain> for Planet {
uuid: d.get_uuid_string()?,
mem: d.get_max_memory()?.into(),
cpu_count: d.get_max_vcpus()?.into(),
+ orbiting: d.is_active()?,
domain: Some(Arc::new(d)),
})
}
@@ -147,6 +151,7 @@ impl TryFrom<&Domain> for Planet {
uuid: d.get_uuid_string()?,
mem: d.get_max_memory()?.into(),
cpu_count: d.get_max_vcpus()?.into(),
+ orbiting: d.is_active()?,
domain: Some(Arc::new(new_d)),
})
}