mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-07 20:13:44 +00:00
cleanup previous commit - use IO::File
This commit is contained in:
parent
15b21acc0d
commit
46f58b5f03
@ -1126,16 +1126,16 @@ sub print_drivedevice_full {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub get_initiator_name {
|
sub get_initiator_name {
|
||||||
my $initiator = undef;
|
my $initiator;
|
||||||
|
|
||||||
open (FILE, '/etc/iscsi/initiatorname.iscsi') or return undef;
|
my $fh = IO::File->new('/etc/iscsi/initiatorname.iscsi') || return undef;
|
||||||
while (<FILE>) {
|
while (defined(my $line = <$fh>)) {
|
||||||
next unless m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
|
next if $line !~ m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
|
||||||
$initiator = $1;
|
$initiator = $1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
close FILE;
|
$fh->close();
|
||||||
|
|
||||||
return $initiator;
|
return $initiator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2626,7 +2626,7 @@ sub config_to_command {
|
|||||||
push @$devices, '-device', "ahci,id=ahci$controller,multifunction=on$pciaddr" if !$ahcicontroller->{$controller};
|
push @$devices, '-device', "ahci,id=ahci$controller,multifunction=on$pciaddr" if !$ahcicontroller->{$controller};
|
||||||
$ahcicontroller->{$controller}=1;
|
$ahcicontroller->{$controller}=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $drive_cmd = print_drive_full($storecfg, $vmid, $drive);
|
my $drive_cmd = print_drive_full($storecfg, $vmid, $drive);
|
||||||
push @$devices, '-drive',$drive_cmd;
|
push @$devices, '-drive',$drive_cmd;
|
||||||
|
|
||||||
@ -2636,8 +2636,8 @@ sub config_to_command {
|
|||||||
my $initiator = get_initiator_name(); # return undef or string
|
my $initiator = get_initiator_name(); # return undef or string
|
||||||
$iscsi_opts = "initiator-name=$initiator" if $initiator;
|
$iscsi_opts = "initiator-name=$initiator" if $initiator;
|
||||||
}
|
}
|
||||||
push @$devices, '-iscsi',$iscsi_opts if $iscsi_opts;
|
push @$devices, '-iscsi', $iscsi_opts if $iscsi_opts;
|
||||||
push @$devices, '-device',print_drivedevice_full($storecfg, $conf, $vmid, $drive, $bridges);
|
push @$devices, '-device', print_drivedevice_full($storecfg, $conf, $vmid, $drive, $bridges);
|
||||||
});
|
});
|
||||||
|
|
||||||
push @$cmd, '-m', $conf->{memory} || $defaults->{memory};
|
push @$cmd, '-m', $conf->{memory} || $defaults->{memory};
|
||||||
@ -4183,7 +4183,7 @@ sub restore_vma_archive {
|
|||||||
my ($dev_id, $size, $devname) = ($1, $2, $3);
|
my ($dev_id, $size, $devname) = ($1, $2, $3);
|
||||||
$devinfo->{$devname} = { size => $size, dev_id => $dev_id };
|
$devinfo->{$devname} = { size => $size, dev_id => $dev_id };
|
||||||
} elsif ($line =~ m/^CTIME: /) {
|
} elsif ($line =~ m/^CTIME: /) {
|
||||||
# we correctly received the vma config, so we can disable
|
# we correctly received the vma config, so we can disable
|
||||||
# the timeout now for disk allocation (set to 10 minutes, so
|
# the timeout now for disk allocation (set to 10 minutes, so
|
||||||
# that we always timeout if something goes wrong)
|
# that we always timeout if something goes wrong)
|
||||||
alarm(600);
|
alarm(600);
|
||||||
|
Loading…
Reference in New Issue
Block a user