$d->{name} = $conf->{'hostname'} || "CT$vmid";
$d->{name} =~ s/[\s]//g;
- $d->{cpus} = $conf->{cpulimit} || $cpucount;
+ $d->{cpus} = $conf->{cores} || $conf->{cpulimit};
+ $d->{cpus} = $cpucount if !$d->{cpus};
$d->{lock} = $conf->{lock} || '';
my $check = sub {
my ($opt, $delete) = @_;
- if ($opt eq 'cpus' || $opt eq 'cpuunits' || $opt eq 'cpulimit') {
+ if ($opt eq 'cores' || $opt eq 'cpuunits' || $opt eq 'cpulimit') {
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.Config.CPU']);
} elsif ($opt eq 'rootfs' || $opt =~ /^mp\d+$/) {
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.Config.Disk']);
maximum => 6,
default => 2,
},
+ cores => {
+ optional => 1,
+ type => 'integer',
+ description => "The number of cores assigned to the container. A container can use all available cores by default.",
+ minimum => 1,
+ maximum => 128,
+ },
cpulimit => {
optional => 1,
type => 'number',
$opt eq 'tty' || $opt eq 'console' || $opt eq 'cmode') {
next if $hotplug_error->($opt);
delete $conf->{$opt};
+ } elsif ($opt eq 'cores') {
+ delete $conf->{$opt}; # rest is handled by pvestatd
} elsif ($opt eq 'cpulimit') {
PVE::LXC::write_cgroup_value("cpu", $vmid, "cpu.cfs_quota_us", -1);
delete $conf->{$opt};
next if $hotplug_error->($opt);
my $list = PVE::LXC::verify_searchdomain_list($value);
$conf->{$opt} = $list;
+ } elsif ($opt eq 'cores') {
+ $conf->{$opt} = $value;# rest is handled by pvestatd
} elsif ($opt eq 'cpulimit') {
if ($value == 0) {
PVE::LXC::write_cgroup_value("cpu", $vmid, "cpu.cfs_quota_us", -1);