* [pve-devel] [PATCH guest-common] fix #2834: skip refs in config_with_pending_array
@ 2020-07-10 18:11 Stoiko Ivanov
2020-07-11 16:49 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2020-07-10 18:11 UTC (permalink / raw)
To: pve-devel
With the refactoring of config_with_pending_array in
daf8fca57a34417365c873ed91f3a52bf0002a4f a few sanity checks on parsed configs
were dropped.
One case where a config value should be skipped, instead of parsed and added
is when the value is not scalar. This is the case for the raw lxc keys
(e.g. lxc.init.cmd, lxc.apparmor.profile) - which get added as array to the
'lxc' key.
This patch reintroduces the skipping of non-scalar values, when parsing the
config but not for the pending values.
From a short look through the commit history the sanity checks were in place
since 2014 (introduced in qemu-server for handling pending configuration
changes), and their removal did not cause any other regressions.
To my knowledge only the raw lxc config keys are parsed into a non-scalar
value.
Tested by adding a 'lxc.init.cmd' key to a container config.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
I hope that I did not miss another case where the sanity-checks are necessary,
and can gladly send a v2 reintroducing all of them.
PVE/GuestHelpers.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/PVE/GuestHelpers.pm b/PVE/GuestHelpers.pm
index 16ab3ac..69a05d9 100644
--- a/PVE/GuestHelpers.pm
+++ b/PVE/GuestHelpers.pm
@@ -214,6 +214,8 @@ sub config_with_pending_array {
my $res = [];
foreach my $opt (keys %$conf) {
+ next if ref($conf->{$opt});
+
my $item = {
key => $opt,
value => $conf->{$opt},
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: Re: [PATCH guest-common] fix #2834: skip refs in config_with_pending_array
2020-07-10 18:11 [pve-devel] [PATCH guest-common] fix #2834: skip refs in config_with_pending_array Stoiko Ivanov
@ 2020-07-11 16:49 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2020-07-11 16:49 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
On 10.07.20 20:11, Stoiko Ivanov wrote:
> With the refactoring of config_with_pending_array in
> daf8fca57a34417365c873ed91f3a52bf0002a4f a few sanity checks on parsed configs
> were dropped.
>
> One case where a config value should be skipped, instead of parsed and added
> is when the value is not scalar. This is the case for the raw lxc keys
> (e.g. lxc.init.cmd, lxc.apparmor.profile) - which get added as array to the
> 'lxc' key.
>
> This patch reintroduces the skipping of non-scalar values, when parsing the
> config but not for the pending values.
> From a short look through the commit history the sanity checks were in place
> since 2014 (introduced in qemu-server for handling pending configuration
> changes), and their removal did not cause any other regressions.
> To my knowledge only the raw lxc config keys are parsed into a non-scalar
> value.
>
> Tested by adding a 'lxc.init.cmd' key to a container config.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> I hope that I did not miss another case where the sanity-checks are necessary,
> and can gladly send a v2 reintroducing all of them.
>
> PVE/GuestHelpers.pm | 2 ++
> 1 file changed, 2 insertions(+)
>
>
applied, many thanks! Added a comment as followup, as during the refactoring Oguz had
some feeling that there was something else besides snapshots but could not come
up with anything, so I've thrown it out. Vetter safe than sorry (twice).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-11 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 18:11 [pve-devel] [PATCH guest-common] fix #2834: skip refs in config_with_pending_array Stoiko Ivanov
2020-07-11 16:49 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox