append option to drive if the option is defined

if the value was '0', we did not append the option to the drive,
resulting in wrong command line if the qemu default of an option is not
'0'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-02-08 12:09:24 +01:00 committed by Wolfgang Bumiller
parent 8a2677081d
commit 5fc748614f

View File

@ -1624,7 +1624,7 @@ sub print_drive_full {
my $opts = ''; my $opts = '';
my @qemu_drive_options = qw(heads secs cyls trans media format cache rerror werror aio discard); my @qemu_drive_options = qw(heads secs cyls trans media format cache rerror werror aio discard);
foreach my $o (@qemu_drive_options) { foreach my $o (@qemu_drive_options) {
$opts .= ",$o=$drive->{$o}" if $drive->{$o}; $opts .= ",$o=$drive->{$o}" if defined($drive->{$o});
} }
# snapshot only accepts on|off # snapshot only accepts on|off