aboutsummaryrefslogtreecommitdiff
path: root/src/house.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-04-23 21:31:34 -0400
committerCara Salter <cara@devcara.com>2022-04-23 21:31:34 -0400
commitc06184b2ff121ad829db9cc65e92af56f66d442e (patch)
tree8345f4b4cb52e6ba3a861a3f1ec9e607443ab5b0 /src/house.rs
parent013a7488c8d2d11daf2cb6184f7fe2d25f6da8a4 (diff)
downloadsolarlib-c06184b2ff121ad829db9cc65e92af56f66d442e.tar.gz
solarlib-c06184b2ff121ad829db9cc65e92af56f66d442e.zip
teach Houses how to download Vans
Diffstat (limited to 'src/house.rs')
-rw-r--r--src/house.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/house.rs b/src/house.rs
index ad6e055..33d3573 100644
--- a/src/house.rs
+++ b/src/house.rs
@@ -4,6 +4,7 @@
*/
use crate::waifu::*;
use crate::errors::Error;
+use crate::van::Van;
use serde::{Serialize, Deserialize};
use virt::{connect::Connect, domain::Domain};
use std::process::{ExitStatus};
@@ -98,7 +99,7 @@ impl House {
///
/// h.introduce("test-2", 1024, 1, 20000, "test.iso").unwrap();
/// ```
- pub async fn introduce(&mut self, name: String, max_mem: Memory, max_cpus: CpuCount, disk_size_mb: u64, image_name: String) -> Result<Waifu, Error> {
+ pub async fn introduce(&mut self, name: String, max_mem: Memory, max_cpus: CpuCount, disk_size_mb: u64, van: Van) -> Result<Waifu, Error> {
// Check for image on host machine
let mut output = Command::new("ssh")
@@ -106,13 +107,13 @@ impl House {
"-oStrictHostKeyChecking=accept-new",
&self.address.clone(),
"stat",
- &format!("/var/lib/libvirt/images/{}", image_name.clone())
+ &format!("/var/lib/libvirt/images/{}", van.make_pretty_name().clone())
])
.output()
.await?;
if output.status != ExitStatus::from_raw(0) {
- return Err(Error::MissingImage(image_name.clone()));
+ return Err(Error::MissingImage(van.name.clone()));
}
// Allocate VM disk
@@ -145,8 +146,8 @@ impl House {
uuid.to_string(),
random_mac().clone(),
true,
- max_mem.count(),
- max_cpus.count(),
+ max_mem.0,
+ max_cpus.0,
"blank".to_string()
)?;