aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/planet.rs52
2 files changed, 53 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index bcf01b2..677a210 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "solarlib"
-version = "1.4.0"
+version = "1.4.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
diff --git a/src/planet.rs b/src/planet.rs
index 210de5a..be81e7e 100644
--- a/src/planet.rs
+++ b/src/planet.rs
@@ -244,6 +244,58 @@ impl Planet {
d.suspend()?;
Ok(())
}
+
+ pub fn resume(&self) -> Result<(), Error> {
+ let d = match &self.domain {
+ Some(d) => d,
+ None => {
+ return Err(Error::Other(String::from("No domain connection found")));
+ }
+ };
+
+ d.resume()?;
+ Ok(())
+ }
+
+ pub fn reboot(&self) -> Result<(), Error> {
+ let d = match &self.domain {
+ Some(d) => d,
+ None => {
+ return Err(Error::Other(String::from("No domain connection found")));
+ },
+ };
+
+ d.reboot(0)?;
+
+ Ok(())
+ }
+
+ pub fn hard_shutdown(&self) -> Result<(), Error> {
+ let d = match &self.domain {
+ Some(d) => d,
+ None => {
+ return Err(Error::Other(String::from("No domain connection found")));
+ }
+ };
+
+ d.destroy()?;
+
+ Ok(())
+ }
+
+ pub fn hard_reboot(&self) -> Result<(), Error> {
+ let d = match &self.domain {
+ Some(d) => d,
+ None => {
+ return Err(Error::Other(String::from("No domain connection found")));
+ }
+ };
+
+ d.destroy()?;
+ d.create()?;
+
+ Ok(())
+ }
}
#[cfg(test)]