support parameter -accel
Signed-off-by: yezengruan <yezengruan@huawei.com>
This commit is contained in:
parent
9597e65c3c
commit
34537ab6e5
78
0026-support-parameter-accel.patch
Normal file
78
0026-support-parameter-accel.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From 4761842ceae0c8ac766b04c8e7bfbb7396e802c4 Mon Sep 17 00:00:00 2001
|
||||
From: yezengruan <yezengruan@huawei.com>
|
||||
Date: Fri, 3 Feb 2023 14:26:34 +0800
|
||||
Subject: [PATCH] support parameter -accel
|
||||
|
||||
The libvirt v7.10.0 (commit id d20ebdda28) changed `-machine accel=XXX`
|
||||
to `-accel=XXX`, let's add `-accel` parameter support for compatibility
|
||||
with libvirt.
|
||||
|
||||
Signed-off-by: yezengruan <yezengruan@huawei.com>
|
||||
---
|
||||
machine_manager/src/cmdline.rs | 8 ++++++++
|
||||
machine_manager/src/config/machine_config.rs | 16 ++++++++++++++++
|
||||
2 files changed, 24 insertions(+)
|
||||
|
||||
diff --git a/machine_manager/src/cmdline.rs b/machine_manager/src/cmdline.rs
|
||||
index 7e61a40b..8c5eb26b 100644
|
||||
--- a/machine_manager/src/cmdline.rs
|
||||
+++ b/machine_manager/src/cmdline.rs
|
||||
@@ -91,6 +91,13 @@ pub fn create_args_parser<'a>() -> ArgParser<'a> {
|
||||
.help("selects emulated machine and set properties")
|
||||
.takes_value(true),
|
||||
)
|
||||
+ .arg(
|
||||
+ Arg::with_name("accel")
|
||||
+ .long("accel")
|
||||
+ .value_name("[accel]")
|
||||
+ .help("select accelerator, only 'kvm' is supported now.")
|
||||
+ .takes_value(true),
|
||||
+ )
|
||||
.arg(
|
||||
Arg::with_name("smp")
|
||||
.long("smp")
|
||||
@@ -406,6 +413,7 @@ pub fn create_vmconfig(args: &ArgMatches) -> Result<VmConfig> {
|
||||
// Parse cmdline args which need to set in VmConfig
|
||||
add_args_to_config!((args.value_of("name")), vm_cfg, add_name);
|
||||
add_args_to_config!((args.value_of("machine")), vm_cfg, add_machine);
|
||||
+ add_args_to_config!((args.value_of("accel")), vm_cfg, add_accel);
|
||||
add_args_to_config!((args.value_of("memory")), vm_cfg, add_memory);
|
||||
add_args_to_config!((args.value_of("mem-path")), vm_cfg, add_mem_path);
|
||||
add_args_to_config!((args.value_of("smp")), vm_cfg, add_cpu);
|
||||
diff --git a/machine_manager/src/config/machine_config.rs b/machine_manager/src/config/machine_config.rs
|
||||
index 33755519..d9280b22 100644
|
||||
--- a/machine_manager/src/config/machine_config.rs
|
||||
+++ b/machine_manager/src/config/machine_config.rs
|
||||
@@ -193,6 +193,7 @@ impl VmConfig {
|
||||
}
|
||||
|
||||
if let Some(accel) = cmd_parser.get_value::<String>("accel")? {
|
||||
+ // Libvirt checks the parameter types of 'kvm', 'kvm:tcg' and 'tcg'.
|
||||
if accel.ne("kvm:tcg") && accel.ne("tcg") && accel.ne("kvm") {
|
||||
bail!("Only \'kvm\', \'kvm:tcg\' and \'tcg\' are supported for \'accel\' of \'machine\'");
|
||||
}
|
||||
@@ -224,6 +225,21 @@ impl VmConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+ /// Add '-accel' accelerator config to `VmConfig`.
|
||||
+ pub fn add_accel(&mut self, accel_config: &str) -> Result<()> {
|
||||
+ let mut cmd_parser = CmdParser::new("accel");
|
||||
+ cmd_parser.push("");
|
||||
+ cmd_parser.parse(accel_config)?;
|
||||
+
|
||||
+ if let Some(accel) = cmd_parser.get_value::<String>("")? {
|
||||
+ if accel.ne("kvm") {
|
||||
+ bail!("Only \'kvm\' is supported for \'accel\'");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Ok(())
|
||||
+ }
|
||||
+
|
||||
/// Add '-m' memory config to `VmConfig`.
|
||||
pub fn add_memory(&mut self, mem_config: &str) -> Result<()> {
|
||||
let mut cmd_parser = CmdParser::new("m");
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
Name: stratovirt
|
||||
Version: 2.1.0
|
||||
Release: 8
|
||||
Release: 9
|
||||
Summary: StratoVirt is an opensource VMM(Virtual Machine Manager) which aims to perform next generation virtualization.
|
||||
|
||||
License: MulanPSL-2.0
|
||||
@ -38,6 +38,7 @@ Patch022: 0022-docs-add-the-description-of-hot-plug-of-PCI-devices.patch
|
||||
Patch023: 0023-Modify-cargo-cllippy-warning-when-compiling-cargo-cl.patch
|
||||
Patch024: 0024-machine-clear-some-warnings.patch
|
||||
Patch025: 0025-micro_vm-update-seccomp-rules.patch
|
||||
Patch026: 0026-support-parameter-accel.patch
|
||||
|
||||
ExclusiveArch: x86_64 aarch64
|
||||
|
||||
@ -92,6 +93,9 @@ chmod 555 ${RPM_BUILD_ROOT}/usr/bin/stratovirt
|
||||
chmod 555 ${RPM_BUILD_ROOT}/usr/bin/ozone
|
||||
|
||||
%changelog
|
||||
* Wed Feb 08 2023 yezengruan <yezengruan@huawei.com> - 2.1.0-9
|
||||
- Support parameter -accel
|
||||
|
||||
* Tue Nov 29 2022 Xinle.Guo <guoxinle1@huawei.com> - 2.1.0-8
|
||||
- Add micro vm seccomp rules
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user