Skip to content

Commit

Permalink
Merge pull request #78 from shitou12345678/main
Browse files Browse the repository at this point in the history
vmm: use config debug to enable debug_console and stratovirt log
  • Loading branch information
Vanient authored Sep 1, 2023
2 parents 9a7d522 + 0e00b9e commit 5652258
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions vmm/sandbox/src/stratovirt/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ pub(crate) const MACHINE_TYPE_PSERIES: &str = "pseries";
pub(crate) const MACHINE_TYPE_CCW_VIRTIO: &str = "s390-ccw-virtio";

const DEFAULT_STRATOVIRT_PATH: &str = "/usr/bin/stratovirt";
const DEFAULT_KERNEL_PARAMS: &str =
"console=hvc0 console=hvc1 iommu=off debug panic=1 pcie_ports=native";
const DEFAULT_KERNEL_PARAMS: &str = "console=hvc0 console=hvc1 iommu=off panic=1 pcie_ports=native";

#[cfg(target_arch = "x86_64")]
const ROOTFS_KERNEL_PARAMS: &str = " root=/dev/vda ro rootfstype=ext4";
Expand Down Expand Up @@ -131,6 +130,10 @@ impl StratoVirtVMConfig {
result.kernel.kernel_params.push_str(ROOTFS_KERNEL_PARAMS);
}

if self.common.debug {
result.kernel.kernel_params.push_str(" debug task.debug");
}

result.global_params = vec![Global {
param: "pcie-root-port.fast-unplug=1".to_string(),
}];
Expand Down Expand Up @@ -301,7 +304,7 @@ mod tests {
"-initrd",
"/var/lib/kuasar/initrd",
"-append",
"console=hvc0 console=hvc1 iommu=off debug panic=1 pcie_ports=native",
"console=hvc0 console=hvc1 iommu=off panic=1 pcie_ports=native",
"-smp",
"cpus=1",
"-m",
Expand Down Expand Up @@ -344,7 +347,7 @@ mod tests {

println!("params: {:?}", params);
let append_params = format!(
"console=hvc0 console=hvc1 iommu=off debug panic=1 pcie_ports=native{}",
"console=hvc0 console=hvc1 iommu=off panic=1 pcie_ports=native{}",
ROOTFS_KERNEL_PARAMS
);
let expected_params = vec![
Expand Down
4 changes: 3 additions & 1 deletion vmm/sandbox/src/stratovirt/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ impl VMFactory for StratoVirtVMFactory {
vm.config.name = format!("sandbox-{}", id);
vm.config.pid_file = format!("{}/sandbox-{}.pid", s.base_dir, id);
vm.block_driver = BlockDriver::from(self.default_config.block_device_driver.as_str());
vm.config.log_file = Some(format!("{}/sandbox-{}.log", s.base_dir, id));
if self.default_config.common.debug {
vm.config.log_file = Some(format!("{}/sandbox-{}.log", s.base_dir, id));
}

// set qmp socket
vm.config.qmp_socket = Some(QmpSocket {
Expand Down

0 comments on commit 5652258

Please sign in to comment.