Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
HV: Remove number of guest CPU configuration in ACRN
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vijaydhanraj committed Oct 30, 2019
1 parent da98191 commit 9d50cc1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 28 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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" \
Expand Down
9 changes: 1 addition & 8 deletions cli/config/configuration-acrn.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions virtcontainers/acrn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
12 changes: 0 additions & 12 deletions virtcontainers/acrn_arch_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
7 changes: 1 addition & 6 deletions virtcontainers/acrn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9d50cc1

Please sign in to comment.