mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-07-09 14:09:19 +00:00
parse_vm_config: only allow 'delete' inside [PENDING]
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
0d732d1615
commit
e297c4903a
@ -1847,22 +1847,24 @@ sub parse_vm_config {
|
|||||||
|
|
||||||
my $conf = $res;
|
my $conf = $res;
|
||||||
my $descr = '';
|
my $descr = '';
|
||||||
|
my $section = '';
|
||||||
|
|
||||||
my @lines = split(/\n/, $raw);
|
my @lines = split(/\n/, $raw);
|
||||||
foreach my $line (@lines) {
|
foreach my $line (@lines) {
|
||||||
next if $line =~ m/^\s*$/;
|
next if $line =~ m/^\s*$/;
|
||||||
|
|
||||||
if ($line =~ m/^\[PENDING\]\s*$/i) {
|
if ($line =~ m/^\[PENDING\]\s*$/i) {
|
||||||
|
$section = 'pending';
|
||||||
$conf->{description} = $descr if $descr;
|
$conf->{description} = $descr if $descr;
|
||||||
$descr = '';
|
$descr = '';
|
||||||
$conf = $res->{pending} = {};
|
$conf = $res->{$section} = {};
|
||||||
next;
|
next;
|
||||||
|
|
||||||
} elsif ($line =~ m/^\[([a-z][a-z0-9_\-]+)\]\s*$/i) {
|
} elsif ($line =~ m/^\[([a-z][a-z0-9_\-]+)\]\s*$/i) {
|
||||||
my $snapname = $1;
|
$section = $1;
|
||||||
$conf->{description} = $descr if $descr;
|
$conf->{description} = $descr if $descr;
|
||||||
$descr = '';
|
$descr = '';
|
||||||
$conf = $res->{snapshots}->{$snapname} = {};
|
$conf = $res->{snapshots}->{$section} = {};
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1879,9 +1881,8 @@ sub parse_vm_config {
|
|||||||
my $key = $1;
|
my $key = $1;
|
||||||
my $value = $2;
|
my $value = $2;
|
||||||
$conf->{$key} = $value;
|
$conf->{$key} = $value;
|
||||||
} elsif ($line =~ m/^(delete):\s*(.*\S)\s*$/) {
|
} elsif (($section eq 'pending') && ($line =~ m/^delete:\s*(.*\S)\s*$/)) {
|
||||||
my $key = $1;
|
my $value = $1;
|
||||||
my $value = $2;
|
|
||||||
foreach my $opt (split(/,/, $value)) {
|
foreach my $opt (split(/,/, $value)) {
|
||||||
$conf->{del}->{$opt} = 1;
|
$conf->{del}->{$opt} = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user