config2cmd: code cleanup and indentation reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-10-20 15:39:20 +02:00
parent 483ceeabef
commit fa3b3ce067

View File

@ -3511,10 +3511,8 @@ sub config_to_command {
}
# enable absolute mouse coordinates (needed by vnc)
my $tablet;
if (defined($conf->{tablet})) {
$tablet = $conf->{tablet};
} else {
my $tablet = $conf->{tablet};
if (!defined($tablet)) {
$tablet = $defaults->{tablet};
$tablet = 0 if $qxlnum; # disable for spice because it is not needed
$tablet = 0 if $vga->{type} =~ m/^serial\d+$/; # disable if we use serial terminal (no vga card)
@ -3542,7 +3540,7 @@ sub config_to_command {
# serial devices
for (my $i = 0; $i < $MAX_SERIAL_PORTS; $i++) {
if (my $path = $conf->{"serial$i"}) {
my $path = $conf->{"serial$i"} or next;
if ($path eq 'socket') {
my $socket = "/var/run/qemu-server/${vmid}.serial$i";
push @$devices, '-chardev', "socket,id=serial$i,path=$socket,server=on,wait=off";
@ -3560,7 +3558,6 @@ sub config_to_command {
push @$devices, '-device', "isa-serial,chardev=serial$i";
}
}
}
# parallel devices
for (my $i = 0; $i < $MAX_PARALLEL_PORTS; $i++) {