summaryrefslogtreecommitdiff
path: root/src/cmd/new.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/new.rs')
-rw-r--r--src/cmd/new.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/new.rs b/src/cmd/new.rs
index 0f7bc94..57f69ae 100644
--- a/src/cmd/new.rs
+++ b/src/cmd/new.rs
@@ -1,3 +1,5 @@
+//! The `new` sub-command.
+
use crate::cloudinit::{CloudInitConfig, CloudInitError};
use crate::image::{ImageError, VirtualMachineImage};
use crate::install::{virt_install, VirtInstallArgs, VirtInstallError};
@@ -9,18 +11,26 @@ use std::net::TcpStream;
const SSH_PORT: i32 = 22;
+/// Errors returned by this module.
#[derive(Debug, thiserror::Error)]
pub enum NewError {
+ /// Problem with cloud-init configuration.
#[error(transparent)]
CloudInitError(#[from] CloudInitError),
+ /// Problem creating VM image.
#[error(transparent)]
ImageError(#[from] ImageError),
+ /// Problem with libvirt.
#[error(transparent)]
VirtInstallError(#[from] VirtInstallError),
}
+/// The `new` sub-command.
+///
+/// Create all the new virtual machines specified by the caller. Wait
+/// until each VM's SSH port listens for connections.
pub fn new(specs: &[Specification]) -> Result<(), NewError> {
for spec in specs {
info!("creating new VM {}", spec.name);