cubic 0.13.0

Cubic is a lightweight command line manager for virtual machines. It has a simple, daemon-less and rootless design. All Cubic virtual machines run isolated in the user context. Cubic is built on top of QEMU, KVM and cloud-init. Show all supported images: $ cubic image ls Create a new virtual machine instance: $ cubic add mymachine --image ubuntu:noble List all virtual machine instances: $ cubic ls Start an instance: $ cubic start <instance name> Stop an instance: $ cubic stop <instance name> Open a shell in the instance: $ cubic ssh <machine name> Copy a file from the host to the instance: $ cubic scp <path/to/host/file> <machine>:<path/to/guest/file> Copy a file from the instance to the hots: $ cubic scp <machine>:<path/to/guest/file> <path/to/host/file>
use crate::commands;
use crate::error::Error;
use crate::instance::InstanceDao;
use clap::Parser;

/// Restart virtual machine instances
#[derive(Parser)]
pub struct InstanceRestartCommand {
    /// Enable verbose logging
    #[clap(short, long, default_value_t = false)]
    verbose: bool,
    /// Reduce logging output
    #[clap(short, long, default_value_t = false)]
    quiet: bool,
    /// Name of the virtual machine instances to restart
    instances: Vec<String>,
}

impl InstanceRestartCommand {
    pub fn run(&self, instance_dao: &InstanceDao) -> Result<(), Error> {
        commands::InstanceStopCommand {
            all: false,
            verbose: self.verbose,
            quiet: self.quiet,
            wait: true,
            instances: self.instances.to_vec(),
        }
        .run(instance_dao)?;
        commands::InstanceStartCommand {
            qemu_args: None,
            verbose: self.verbose,
            quiet: self.quiet,
            wait: true,
            instances: self.instances.to_vec(),
        }
        .run(instance_dao)
    }
}