fix incorrect rootfs readonly mount
By default, on aarch64 the rootfs is mounted in readonly mode
if not specified otherwise.
@@ -841,6 +841,11 @@ impl Vmm {
.cmdline
.insert_str("ro")
.map_err(|e| StartMicrovmError::KernelCmdline(e.to_string()))?;
+ } else {
+ kernel_config
+ .cmdline
+ .insert_str("rw")
+ .map_err(|e| StartMicrovmError::KernelCmdline(e.to_string()))?;
}
}
}
@@ -872,6 +877,11 @@ impl Vmm {
.cmdline
.insert_str("ro")
.map_err(|e| StartMicrovmError::KernelCmdline(e.to_string()))?;
+ } else {
+ kernel_config
+ .cmdline
+ .insert_str("rw")
+ .map_err(|e| StartMicrovmError::KernelCmdline(e.to_string()))?;
}
}
@@ -2780,7 +2790,7 @@ mod tests {
.expect("Cannot initialize mmio device manager");
assert!(vmm.attach_block_devices().is_ok());
- assert!(vmm.get_kernel_cmdline_str().contains("root=/dev/vda"));
+ assert!(vmm.get_kernel_cmdline_str().contains("root=/dev/vda rw"));
// Use Case 2: Root Block Device is specified through PARTUUID.
let mut vmm = create_vmm_object(InstanceState::Uninitialized);
@@ -2805,7 +2815,7 @@ mod tests {
assert!(vmm.attach_block_devices().is_ok());
assert!(vmm
.get_kernel_cmdline_str()
- .contains("root=PARTUUID=0eaa91a0-01"));
+ .contains("root=PARTUUID=0eaa91a0-01 rw"));
// Use Case 3: Root Block Device is not added at all.
let mut vmm = create_vmm_object(InstanceState::Uninitialized);
