mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-08 07:20:18 +00:00
parse_vm_config : parse pending changes
example: [PENDING] virtio1:... delete:net0,net1 $conf->{pending}->{virtio1} $conf->{pending}->{del}->{net0} $conf->{pending}->{del}->{net1} Signed-off-by: Alexandre Derumier <aderumier@odiso.com> Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
5a4cd260b5
commit
eab09f4e11
@ -1837,6 +1837,7 @@ sub parse_vm_config {
|
||||
my $res = {
|
||||
digest => Digest::SHA::sha1_hex($raw),
|
||||
snapshots => {},
|
||||
pending => {}
|
||||
};
|
||||
|
||||
$filename =~ m|/qemu-server/(\d+)\.conf$|
|
||||
@ -1851,7 +1852,11 @@ sub parse_vm_config {
|
||||
foreach my $line (@lines) {
|
||||
next if $line =~ m/^\s*$/;
|
||||
|
||||
if ($line =~ m/^\[([a-z][a-z0-9_\-]+)\]\s*$/i) {
|
||||
if ($line =~ m/^\[PENDING\]\s*$/i) {
|
||||
$conf = $res->{pending} = {};
|
||||
next;
|
||||
|
||||
}elsif ($line =~ m/^\[([a-z][a-z0-9_\-]+)\]\s*$/i) {
|
||||
my $snapname = $1;
|
||||
$conf->{description} = $descr if $descr;
|
||||
$descr = '';
|
||||
@ -1872,6 +1877,12 @@ sub parse_vm_config {
|
||||
my $key = $1;
|
||||
my $value = $2;
|
||||
$conf->{$key} = $value;
|
||||
} elsif ($line =~ m/^(delete):\s*(.*\S)\s*$/) {
|
||||
my $key = $1;
|
||||
my $value = $2;
|
||||
foreach my $opt (split(/,/, $value)) {
|
||||
$conf->{del}->{$opt} = 1;
|
||||
}
|
||||
} elsif ($line =~ m/^([a-z][a-z_]*\d*):\s*(\S+)\s*$/) {
|
||||
my $key = $1;
|
||||
my $value = $2;
|
||||
|
Loading…
Reference in New Issue
Block a user