summaryrefslogtreecommitdiff
path: root/src/spec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/spec.rs')
-rw-r--r--src/spec.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/spec.rs b/src/spec.rs
index 4bd0bb9..b9828e9 100644
--- a/src/spec.rs
+++ b/src/spec.rs
@@ -29,6 +29,7 @@ struct OneVmInputSpecification {
pub memory_mib: Option<u64>,
pub cpus: Option<u64>,
pub generate_host_certificate: Option<bool>,
+ pub autostart: Option<bool>,
pub ca_key: Option<PathBuf>,
}
@@ -98,6 +99,16 @@ impl OneVmInputSpecification {
SpecificationError::NoBaseImage(name.to_string()),
)
}
+
+ fn autostart(&self, config: &Configuration) -> bool {
+ if let Some(x) = self.autostart {
+ x
+ } else if let Some(x) = config.default_autostart {
+ x
+ } else {
+ false
+ }
+ }
}
fn get<'a, T>(
@@ -171,6 +182,9 @@ pub struct Specification {
/// Should a new host key and certificate be created for new VM?
pub generate_host_certificate: bool,
+ /// Should the VM be started automatically when host starts?
+ pub autostart: bool,
+
/// Path to CA key for creating host certificate.
pub ca_key: Option<PathBuf>,
}
@@ -284,6 +298,7 @@ impl Specification {
memory_mib: input.memory_mib(config, name)?,
cpus: input.cpus(config, name)?,
generate_host_certificate: gen_cert,
+ autostart: input.autostart(config),
ca_key,
};