Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying a custom devmapper snapshot device on snapshot boot #3

Open
wants to merge 2 commits into
base: v0.25_reference
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/devices/src/virtio/block/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub struct BlockState {
)]
cache_type: CacheTypeState,
root_device: bool,
disk_path: String,
pub disk_path: String,
ustiugov marked this conversation as resolved.
Show resolved Hide resolved
virtio_state: VirtioDeviceState,
rate_limiter_state: RateLimiterState,
}
Expand Down
5 changes: 3 additions & 2 deletions src/vmm/src/device_manager/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,12 @@ impl<'a> Persist<'a> for MMIODeviceManager {

// Send Transport event to reset connections if device
// is activated.
if vsock.is_activated() {
// TODO: temporarily disabled to avoid FC agent becoming unavailable when restoring snapshots
ustiugov marked this conversation as resolved.
Show resolved Hide resolved
/*if vsock.is_activated() {
vsock.send_transport_reset_event().unwrap_or_else(|e| {
error!("Failed to send reset transport event: {:?}", e);
});
}
}*/

states.vsock_device = Some(ConnectedVsockState {
device_id: devid.clone(),
Expand Down
13 changes: 12 additions & 1 deletion src/vmm/src/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,18 @@ pub fn restore_from_snapshot(
) -> std::result::Result<Arc<Mutex<Vmm>>, LoadSnapshotError> {
use self::LoadSnapshotError::*;
let track_dirty_pages = params.enable_diff_snapshots;
let microvm_state = snapshot_state_from_file(&params.snapshot_path, version_map)?;
let mut microvm_state = snapshot_state_from_file(&params.snapshot_path, version_map)?;

let new_snapshot_path = &params.new_snapshot_path;

if ! new_snapshot_path.eq("") {
let n = microvm_state.device_states.block_devices.len();
for i in 0..n {
if microvm_state.device_states.block_devices[i].device_state.disk_path.contains("thinpool-snap") {
microvm_state.device_states.block_devices[i].device_state.disk_path = new_snapshot_path.clone();
}
}
}

// Some sanity checks before building the microvm.
snapshot_state_sanity_check(&microvm_state)?;
Expand Down
2 changes: 2 additions & 0 deletions src/vmm/src/vmm_config/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct LoadSnapshotParams {
pub mem_file_path: PathBuf,
/// Setting this flag enables user page faults handling by a different process.
pub enable_user_page_faults: bool,
/// Setting this string to nonempty changes the snapshot device
pub new_snapshot_path: String,
/// Path to the passfd socket.
pub sock_file_path: PathBuf,
/// Setting this flag will enable KVM dirty page tracking and will
Expand Down
6 changes: 3 additions & 3 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
# would help with reproducible builds (in addition to pinning Cargo.lock)

# Development container image (without tag)
DEVCTR_IMAGE_NO_TAG="docker.io/vhiveease/fcuvm_dev"
DEVCTR_IMAGE_NO_TAG="docker.io/amohoste/fcuvm_dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix, update the build image on vhiveease if necessary


# Development container tag
#DEVCTR_IMAGE_TAG="v30"
DEVCTR_IMAGE_TAG="v16_upf"
DEVCTR_IMAGE_TAG="v30"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DEVCTR_IMAGE_TAG="v30"
DEVCTR_IMAGE_TAG="v30_upf"

#DEVCTR_IMAGE_TAG="v16_upf"

# Development container image (name:tag)
# This should be updated whenever we upgrade the development container.
Expand Down