restore vm: vmgenid: small code cleanup

do not use $1 do write out config, if code gets added this may easily
get overwritten, as vmgenid is a fixed key just hardcode it.

also move the comment to where it actually belongs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2018-09-19 13:31:19 +02:00
parent 6ee499fff8
commit 1a0c2f032c

View File

@ -5565,13 +5565,13 @@ sub restore_update_config_line {
} else { } else {
print $outfd $line; print $outfd $line;
} }
} elsif (($line =~ m/^(vmgenid: )(.*)/)) { } elsif (($line =~ m/^vmgenid: (.*)/)) {
# always generate a new vmgenid
my $vmgenid = $2; my $vmgenid = $2;
if ($vmgenid ne '0') { if ($vmgenid ne '0') {
# always generate a new vmgenid if there was a valid one setup
$vmgenid = generate_uuid(); $vmgenid = generate_uuid();
} }
print $outfd $1.$vmgenid."\n"; print $outfd "vmgenid: $vmgenid\n";
} elsif (($line =~ m/^(smbios1: )(.*)/) && $unique) { } elsif (($line =~ m/^(smbios1: )(.*)/) && $unique) {
my ($uuid, $uuid_str); my ($uuid, $uuid_str);
UUID::generate($uuid); UUID::generate($uuid);