[pve-devel] [PATCH] lxc: add hotplug memory && cpus cgroups value V2
Dietmar Maurer
dietmar at proxmox.com
Sun Jun 21 10:26:34 CEST 2015
> +
> +sub hotplug_lxc_config {
> + my ($vmid, $conf, $param, $delete) = @_;
> +
> + if (defined($delete)) {
> + foreach my $opt (@$delete) {
> + if ($opt eq 'swap') {
> + cgroups_write("memory", $vmid, "memory.memsw.limit_in_bytes", -1);
> + } elsif ($opt =~ m/^net\d$/) {
> + #implement me
> + }
> + }
> + }
> +
> + foreach my $opt (keys %$param) {
> + my $value = $param->{$opt};
> + if ($opt eq 'memory') {
> + cgroups_write("memory", $vmid, "memory.limit_in_bytes",
> $value*1024*1024);
> + } elsif ($opt eq 'swap') {
> + my $mem = $conf->{'lxc.cgroup.memory.limit_in_bytes'};
> + $mem = $param->{memory}*1024*1024 if $param->{memory};
is it really necessary to duplicate above code? I would prefer to do that only
once.
(Maybe remove it from update_lxc_conf)?
More information about the pve-devel
mailing list