[pve-devel] [PATCH] lxc: add hotplug memory && cpus cgroups value V2
Alexandre DERUMIER
aderumier at odiso.com
Sun Jun 21 17:07:29 CEST 2015
I'll try to improve that tomorrow.
----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "aderumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Dimanche 21 Juin 2015 10:26:34
Objet: Re: [pve-devel] [PATCH] lxc: add hotplug memory && cpus cgroups value V2
> +
> +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