diff options
author | Frederick Mayle <fmayle@google.com> | 2024-05-09 18:01:34 -0700 |
---|---|---|
committer | Frederick Mayle <fmayle@google.com> | 2024-05-10 14:14:22 -0700 |
commit | 1dee6d0d245ef1c4ce6748a7aef657da4a0547cd (patch) | |
tree | 82392db5507d19d9b9b2d2ffe6d61a081cd54882 | |
parent | 06740c05f24df9464bca0e67baebc2fb917d6826 (diff) | |
download | crosvm-1dee6d0d245ef1c4ce6748a7aef657da4a0547cd.tar.gz |
UPSTREAM: crosvm: delete `crosvm snapshot apply` command
We decided long ago to only support restoring a snapshot to a new VM,
using `crosvm run --restore`, this command is just a vestige.
Test: m
Change-Id: I14bb20e3b89c41b277b11fe672d3ce21322cf656
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5530862
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
-rw-r--r-- | src/crosvm/cmdline.rs | 16 | ||||
-rw-r--r-- | src/crosvm/sys/linux.rs | 14 | ||||
-rw-r--r-- | src/main.rs | 8 | ||||
-rw-r--r-- | src/sys/windows.rs | 17 | ||||
-rw-r--r-- | vm_control/src/lib.rs | 38 |
5 files changed, 0 insertions, 93 deletions
diff --git a/src/crosvm/cmdline.rs b/src/crosvm/cmdline.rs index c6cf27e38..f8afc55cf 100644 --- a/src/crosvm/cmdline.rs +++ b/src/crosvm/cmdline.rs @@ -746,26 +746,10 @@ pub struct SnapshotTakeCommand { } #[derive(FromArgs)] -#[argh(subcommand, name = "restore")] -/// Restore VM state from a snapshot created by take -pub struct SnapshotRestoreCommand { - #[argh(positional)] - /// path to snapshot to restore - pub snapshot_path: PathBuf, - #[argh(positional, arg_name = "VM_SOCKET")] - /// VM Socket path - pub socket_path: String, - /// true to require an encrypted snapshot - #[argh(switch, arg_name = "require_encrypted")] - pub require_encrypted: bool, -} - -#[derive(FromArgs)] #[argh(subcommand)] /// Snapshot commands pub enum SnapshotSubCommands { Take(SnapshotTakeCommand), - Restore(SnapshotRestoreCommand), } /// Container for GpuParameters that have been fixed after parsing using serde. diff --git a/src/crosvm/sys/linux.rs b/src/crosvm/sys/linux.rs index f94096cde..0060f2354 100644 --- a/src/crosvm/sys/linux.rs +++ b/src/crosvm/sys/linux.rs @@ -2990,13 +2990,6 @@ fn process_vm_request<V: VmArch + 'static, Vcpu: VcpuArch + 'static>( msg, ) }, - |msg, index| { - vcpu::kick_vcpu( - &state.vcpu_handles.get(index), - state.linux.irq_chip.as_irq_chip(), - msg, - ) - }, state.cfg.force_s2idle, #[cfg(feature = "swap")] state.swap_controller.as_ref(), @@ -3004,13 +2997,6 @@ fn process_vm_request<V: VmArch + 'static, Vcpu: VcpuArch + 'static>( state.vcpu_handles.len(), state.irq_handler_control, || state.linux.irq_chip.snapshot(state.linux.vcpu_count), - |image| { - state - .linux - .irq_chip - .try_box_clone()? - .restore(image, state.linux.vcpu_count) - }, ); if state.cfg.force_s2idle { if let VmRequest::SuspendVcpus = request { diff --git a/src/main.rs b/src/main.rs index c65fab97d..93ae51bc6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,6 @@ use vm_control::BalloonControlCommand; use vm_control::DiskControlCommand; use vm_control::HotPlugDeviceInfo; use vm_control::HotPlugDeviceType; -use vm_control::RestoreCommand; use vm_control::SnapshotCommand; use vm_control::SwapCommand; use vm_control::UsbControlResult; @@ -633,13 +632,6 @@ fn snapshot_vm(cmd: cmdline::SnapshotCommand) -> std::result::Result<(), ()> { }); (take_cmd.socket_path, req) } - Restore(path) => { - let req = VmRequest::Restore(RestoreCommand::Apply { - restore_path: path.snapshot_path, - require_encrypted: path.require_encrypted, - }); - (path.socket_path, req) - } }; let socket_path = Path::new(&socket_path); vms_request(&request, socket_path) diff --git a/src/sys/windows.rs b/src/sys/windows.rs index beb2a5ab8..4240be209 100644 --- a/src/sys/windows.rs +++ b/src/sys/windows.rs @@ -903,17 +903,6 @@ fn handle_readable_event<V: VmArch + 'static, Vcpu: VcpuArch + 'static>( msg, ); }, - |msg, index| { - kick_vcpu( - run_mode_arc, - vcpu_control_channels, - vcpu_boxes, - guest_os.irq_chip.as_ref(), - pvclock_host_tube, - index, - msg, - ); - }, force_s2idle, #[cfg(feature = "swap")] None, @@ -921,12 +910,6 @@ fn handle_readable_event<V: VmArch + 'static, Vcpu: VcpuArch + 'static>( vcpu_size, irq_handler_control, || guest_os.irq_chip.as_ref().snapshot(vcpu_size), - |snapshot| { - guest_os - .irq_chip - .try_box_clone()? - .restore(snapshot, vcpu_size) - }, ); (resp, run_mode_opt) }; diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index 9c989b43c..895664f4f 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -324,15 +324,6 @@ pub enum SnapshotCommand { }, } -/// Commands for restore feature -#[derive(Serialize, Deserialize, Debug)] -pub enum RestoreCommand { - Apply { - restore_path: PathBuf, - require_encrypted: bool, - }, -} - /// Commands for actions on devices and the devices control thread. #[derive(Serialize, Deserialize, Debug)] pub enum DeviceControlCommand { @@ -1337,8 +1328,6 @@ pub enum VmRequest { HotPlugNetCommand(NetControlCommand), /// Command to Snapshot devices Snapshot(SnapshotCommand), - /// Command to Restore devices - Restore(RestoreCommand), /// Register for event notification #[cfg(feature = "registered_events")] RegisterListener { @@ -1627,14 +1616,12 @@ impl VmRequest { usb_control_tube: Option<&Tube>, bat_control: &mut Option<BatControl>, kick_vcpus: impl Fn(VcpuControl), - kick_vcpu: impl Fn(VcpuControl, usize), force_s2idle: bool, #[cfg(feature = "swap")] swap_controller: Option<&swap::SwapController>, device_control_tube: &Tube, vcpu_size: usize, irq_handler_control: &Tube, snapshot_irqchip: impl Fn() -> anyhow::Result<serde_json::Value>, - restore_irqchip: impl FnMut(serde_json::Value) -> anyhow::Result<()>, ) -> VmResponse { match *self { VmRequest::Exit => { @@ -1991,31 +1978,6 @@ impl VmRequest { } } } - VmRequest::Restore(RestoreCommand::Apply { - ref restore_path, - require_encrypted, - }) => { - info!("Starting crosvm restore"); - match do_restore( - restore_path.clone(), - kick_vcpus, - kick_vcpu, - irq_handler_control, - device_control_tube, - vcpu_size, - restore_irqchip, - require_encrypted, - ) { - Ok(()) => { - info!("Finished crosvm restore successfully"); - VmResponse::Ok - } - Err(e) => { - error!("failed to handle restore: {:?}", e); - VmResponse::Err(SysError::new(EIO)) - } - } - } #[cfg(feature = "registered_events")] VmRequest::RegisterListener { socket_addr: _, |