mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-01 22:50:54 +00:00
runtime-rs: Track GPT partition padding files for cleanup
When a GPT-partitioned VMDK is split into individual partition images,
padding files may be generated between partitions to maintain correct
byte offsets. These were not tracked for cleanup, leading to stale
temporary files after container removal.
Iterate over the partition layout and check for pad-{idx}.img files
alongside the head image; add any that exist to gpt_metadata_paths
so they are removed during teardown.
Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -730,6 +730,19 @@ impl ErofsMultiLayerRootfs {
|
||||
// Track GPT metadata files (head + padding) for cleanup
|
||||
gpt_metadata_paths.push(gpt_files.head_path.clone());
|
||||
gpt_metadata_paths.extend(gpt_files.pad_paths.iter().cloned());
|
||||
for idx in 0..layout.partitions.len() {
|
||||
if idx > 0 {
|
||||
// Check for padding files (only created when there are gaps)
|
||||
let pad_path = gpt_files
|
||||
.head_path
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(format!("pad-{}.img", idx));
|
||||
if pad_path.exists() {
|
||||
gpt_metadata_paths.push(pad_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info!(
|
||||
sl!(),
|
||||
|
||||
Reference in New Issue
Block a user