diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-07-25 12:40:27 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-07-25 13:30:23 +0300 |
commit | bd87e253000b8a0a73c831877c99291fb430607f (patch) | |
tree | aa63fa87ab905c2bf6e874ad3448bc3c3b71deef /src/spec.rs | |
parent | 957e9f268a84f39d05a2f7ff35de105b3b695fac (diff) | |
download | vmadm-bd87e253000b8a0a73c831877c99291fb430607f.tar.gz |
fix: actually add networks to VM
Sponsored-by: author
Diffstat (limited to 'src/spec.rs')
-rw-r--r-- | src/spec.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/spec.rs b/src/spec.rs index 1470fdb..c3c6b59 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -110,6 +110,16 @@ impl OneVmInputSpecification { false } } + + fn networks(&self, config: &Configuration) -> Vec<String> { + if let Some(ref x) = self.networks { + x.clone() + } else if let Some(ref x) = config.default_networks { + x.clone() + } else { + vec!["default".to_string()] + } + } } fn get<'a, T>( @@ -188,6 +198,9 @@ pub struct Specification { /// Path to CA key for creating host certificate. pub ca_key: Option<PathBuf>, + + /// List of networks to which host should be added. + pub networks: Vec<String>, } /// Errors from this module. @@ -302,6 +315,7 @@ impl Specification { generate_host_certificate: gen_cert, autostart: input.autostart(config), ca_key, + networks: input.networks(config), }; debug!("specification as with defaults applied: {:#?}", spec); |