mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 07:19:06 +00:00
HV: Remove number of guest CPU configuration in ACRN
ACRN doesn't support configuring number of guest vcpu option ('-c') anymore. Number of guest vcpus will be defined in the hypervisor scenario configuration file instead. Removed the -c option from the acrn-dm parameters when launching VMs and also trimmed configuration.toml file accordingly. fixes #2136 Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
This commit is contained in:
parent
da98191940
commit
9d50cc1ff9
3
Makefile
3
Makefile
@ -329,6 +329,7 @@ ifneq (,$(ACRNCMD))
|
||||
CONFIGS += $(CONFIG_ACRN)
|
||||
|
||||
# acrn-specific options (all should be suffixed by "_ACRN")
|
||||
DEFMAXVCPUS_ACRN := 1
|
||||
DEFBLOCKSTORAGEDRIVER_ACRN := virtio-blk
|
||||
DEFNETWORKMODEL_ACRN := macvtap
|
||||
KERNEL_NAME_ACRN = $(call MAKE_KERNEL_NAME,$(KERNELTYPE))
|
||||
@ -431,6 +432,7 @@ USER_VARS += SHIMPATH
|
||||
USER_VARS += SYSCONFDIR
|
||||
USER_VARS += DEFVCPUS
|
||||
USER_VARS += DEFMAXVCPUS
|
||||
USER_VARS += DEFMAXVCPUS_ACRN
|
||||
USER_VARS += DEFMEMSZ
|
||||
USER_VARS += DEFMEMSLOTS
|
||||
USER_VARS += DEFBRIDGES
|
||||
@ -598,6 +600,7 @@ $(GENERATED_FILES): %: %.in $(MAKEFILE_LIST) VERSION .git-commit
|
||||
-e "s|@SHIMPATH@|$(SHIMPATH)|g" \
|
||||
-e "s|@DEFVCPUS@|$(DEFVCPUS)|g" \
|
||||
-e "s|@DEFMAXVCPUS@|$(DEFMAXVCPUS)|g" \
|
||||
-e "s|@DEFMAXVCPUS_ACRN@|$(DEFMAXVCPUS_ACRN)|g" \
|
||||
-e "s|@DEFMEMSZ@|$(DEFMEMSZ)|g" \
|
||||
-e "s|@DEFMEMSLOTS@|$(DEFMEMSLOTS)|g" \
|
||||
-e "s|@DEFBRIDGES@|$(DEFBRIDGES)|g" \
|
||||
|
@ -32,13 +32,6 @@ kernel_params = "@KERNELPARAMS@"
|
||||
# If you want that acrn uses the default firmware leave this option empty
|
||||
firmware = "@FIRMWAREPATH@"
|
||||
|
||||
# Default number of vCPUs per SB/VM:
|
||||
# unspecified or 0 --> will be set to @DEFVCPUS@
|
||||
# < 0 --> will be set to the actual number of physical cores
|
||||
# > 0 <= number of physical cores --> will be set to the specified number
|
||||
# > number of physical cores --> will be set to the actual number of physical cores
|
||||
default_vcpus = 1
|
||||
|
||||
# Default maximum number of vCPUs per SB/VM:
|
||||
# unspecified or == 0 --> will be set to the actual number of physical cores or to the maximum number
|
||||
# of vCPUs supported by KVM if that number is exceeded
|
||||
@ -53,7 +46,7 @@ default_vcpus = 1
|
||||
# `default_maxvcpus = 8` the memory footprint will be small, but 8 will be the maximum number of
|
||||
# vCPUs supported by the SB/VM. In general, we recommend that you do not edit this variable,
|
||||
# unless you know what are you doing.
|
||||
default_maxvcpus = @DEFMAXVCPUS@
|
||||
default_maxvcpus = @DEFMAXVCPUS_ACRN@
|
||||
|
||||
# Bridges can be used to hot plug devices.
|
||||
# Limitations:
|
||||
|
@ -124,7 +124,7 @@ func (a *Acrn) kernelParameters() string {
|
||||
params = append(params, acrnDefaultKernelParameters...)
|
||||
|
||||
// set the maximum number of vCPUs
|
||||
params = append(params, Param{"maxcpus", fmt.Sprintf("%d", a.config.NumVCPUs)})
|
||||
params = append(params, Param{"maxcpus", fmt.Sprintf("%d", a.config.DefaultMaxVCPUs)})
|
||||
|
||||
// add the params specified by the provided config. As the kernel
|
||||
// honours the last parameter value set and since the config-provided
|
||||
@ -405,7 +405,6 @@ func (a *Acrn) createSandbox(ctx context.Context, id string, networkNS NetworkNa
|
||||
Path: acrnPath,
|
||||
CtlPath: acrnctlPath,
|
||||
Memory: memory,
|
||||
NumCPU: a.config.NumVCPUs,
|
||||
Devices: devices,
|
||||
Kernel: kernel,
|
||||
Name: fmt.Sprintf("sandbox-%s", a.id),
|
||||
|
@ -306,9 +306,6 @@ type Config struct {
|
||||
|
||||
// ACPI virtualization support
|
||||
ACPIVirt bool
|
||||
|
||||
// NumCPU is the number of CPUs for guest
|
||||
NumCPU uint32
|
||||
}
|
||||
|
||||
// MaxAcrnVCPUs returns the maximum number of vCPUs supported
|
||||
@ -571,14 +568,6 @@ func (config *Config) appendMemory() {
|
||||
}
|
||||
}
|
||||
|
||||
func (config *Config) appendCPUs() {
|
||||
if config.NumCPU != 0 {
|
||||
config.acrnParams = append(config.acrnParams, "-c")
|
||||
config.acrnParams = append(config.acrnParams, fmt.Sprintf("%d", config.NumCPU))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (config *Config) appendKernel() {
|
||||
if config.Kernel.Path == "" {
|
||||
return
|
||||
@ -603,7 +592,6 @@ func LaunchAcrn(config Config, logger *logrus.Entry) (int, string, error) {
|
||||
config.appendUUID()
|
||||
config.appendACPI()
|
||||
config.appendMemory()
|
||||
config.appendCPUs()
|
||||
config.appendDevices()
|
||||
config.appendKernel()
|
||||
config.appendName()
|
||||
|
@ -48,7 +48,7 @@ func testAcrnKernelParameters(t *testing.T, kernelParams []Param, debug bool) {
|
||||
arch: &acrnArchBase{},
|
||||
}
|
||||
|
||||
expected := fmt.Sprintf("panic=1 maxcpus=%d foo=foo bar=bar", a.config.NumVCPUs)
|
||||
expected := fmt.Sprintf("panic=1 maxcpus=%d foo=foo bar=bar", a.config.DefaultMaxVCPUs)
|
||||
|
||||
params := a.kernelParameters()
|
||||
assert.Equal(params, expected)
|
||||
@ -218,11 +218,6 @@ func TestAcrnCreateSandbox(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// Even though this test doesn't need to create a vcStore,
|
||||
// we are forced to create a vcStore as GetAndSetSandboxBlockIndex()
|
||||
// which is called from createSandbox needs a valid vcStore. vcStore
|
||||
// creation can be removed once https://github.com/kata-containers/runtime/issues/2026
|
||||
// issue is resolved.
|
||||
vcStore, err := store.NewVCSandboxStore(sandbox.ctx, sandbox.id)
|
||||
assert.NoError(err)
|
||||
sandbox.store = vcStore
|
||||
|
Loading…
Reference in New Issue
Block a user