aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-06-12 21:07:24 -0400
committerCara Salter <cara@devcara.com>2022-06-12 21:07:24 -0400
commit945991ae5227bf3de7d715e4d256e11f1753e4fa (patch)
tree0af3487a4ca78f8bfde86f68a9cca775e01b263f
parent66b136fbbdbc4963de6db63e5af8eb44e0d2ae8b (diff)
downloadsolarlib-945991ae5227bf3de7d715e4d256e11f1753e4fa.tar.gz
solarlib-945991ae5227bf3de7d715e4d256e11f1753e4fa.zip
star: Automatically mount ships
-rw-r--r--src/star.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/star.rs b/src/star.rs
index d62d91c..28caa21 100644
--- a/src/star.rs
+++ b/src/star.rs
@@ -81,7 +81,7 @@ impl Star {
})
}
- /// Lists the "inhabitants" of the House (the [Waifu]s on the machine
+ /// Lists the planets that are currently part of the Star's system
///
/// ```
/// use crate::star::Star;
@@ -207,6 +207,12 @@ impl Star {
Some(c) => {
let dom = Domain::define_xml(&c, &buf)?;
+ let mut dev_buf: Vec<u8> = vec![];
+ crate::templates::disk_xml(&mut dev_buf, format!("/var/lib/libvirt/images/{}", ship.make_pretty_name()))?;
+ let dev_buf = String::from_utf8(dev_buf).unwrap();
+
+ dom.attach_device(&dev_buf)?;
+
dom.create()?;
dom
@@ -216,15 +222,6 @@ impl Star {
}
};
- let mut dev_buf: Vec<u8> = vec![];
- crate::templates::disk_xml(
- &mut buf,
- format!("/var/lib/libvirt/images/{}", ship.make_pretty_name())
- )?;
-
- let dev_buf = String::from_utf8(dev_buf).unwrap();
-
-
dom.try_into()
}