Skip to content

Commit 847452a

Browse files
Apply bundle by mounted root in create-delta
1 parent eded163 commit 847452a

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

crates/vz-cli/src/commands/vm_patch.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,15 +1010,21 @@ fn create_delta(args: CreateDeltaArgs) -> anyhow::Result<()> {
10101010
let patched_image = workspace.path().join("patched.img");
10111011

10121012
clone_or_copy_image_with_sidecars(&base_image, &patched_image, true)?;
1013+
let manifest = verify_bundle(&bundle)?;
1014+
validate_patch_target_base_policy(&manifest)?;
10131015
let state_path = workspace.path().join("patch-state.json");
1014-
apply_with_state_path(
1015-
ApplyArgs {
1016-
bundle: bundle.clone(),
1017-
root: None,
1018-
image: Some(patched_image.clone()),
1019-
},
1020-
&state_path,
1021-
)?;
1016+
1017+
let disk = crate::provision::attach_and_mount(&patched_image).with_context(|| {
1018+
format!(
1019+
"failed to attach and mount image {} before patch apply",
1020+
patched_image.display()
1021+
)
1022+
})?;
1023+
let apply_result =
1024+
apply_verified_manifest_with_root(manifest, &bundle, &disk.mount_point, &state_path);
1025+
let detach_result = disk.detach();
1026+
apply_result?;
1027+
detach_result?;
10221028

10231029
let chunk_size = mib_to_bytes(args.chunk_size_mib)?;
10241030
let header = create_image_delta_file(&base_image, &patched_image, &delta, chunk_size)

0 commit comments

Comments
 (0)