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

vmm: use config debug to enable debug_console and stratovirt log #78

Merged
merged 1 commit into from
Sep 1, 2023
Merged
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
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
Loading