[pve-devel] [PATCH v2 qemu-server 01/28] Replace drivename_hash with drivedesc_hash
Fabian Ebner
f.ebner at proxmox.com
Mon Feb 24 13:43:51 CET 2020
which contains the full descriptions of the drives, and
make parse_drive not depend on $confdesc anymore.
In preparation to moving drive-related code to its own module.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/QemuServer.pm | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 3bf60ea..a4d2e4e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -905,7 +905,7 @@ sub verify_volume_id_or_qm_path {
return $volid;
}
-my $drivename_hash;
+my $drivedesc_hash;
my %drivedesc_base = (
volume => { alias => 'file' },
@@ -1356,26 +1356,26 @@ for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++) {
}
for (my $i = 0; $i < $MAX_IDE_DISKS; $i++) {
- $drivename_hash->{"ide$i"} = 1;
+ $drivedesc_hash->{"ide$i"} = $idedesc;
$confdesc->{"ide$i"} = $idedesc;
}
for (my $i = 0; $i < $MAX_SATA_DISKS; $i++) {
- $drivename_hash->{"sata$i"} = 1;
+ $drivedesc_hash->{"sata$i"} = $satadesc;
$confdesc->{"sata$i"} = $satadesc;
}
for (my $i = 0; $i < $MAX_SCSI_DISKS; $i++) {
- $drivename_hash->{"scsi$i"} = 1;
+ $drivedesc_hash->{"scsi$i"} = $scsidesc;
$confdesc->{"scsi$i"} = $scsidesc ;
}
for (my $i = 0; $i < $MAX_VIRTIO_DISKS; $i++) {
- $drivename_hash->{"virtio$i"} = 1;
+ $drivedesc_hash->{"virtio$i"} = $virtiodesc;
$confdesc->{"virtio$i"} = $virtiodesc;
}
-$drivename_hash->{efidisk0} = 1;
+$drivedesc_hash->{efidisk0} = $efidisk_desc;
$confdesc->{efidisk0} = $efidisk_desc;
for (my $i = 0; $i < $MAX_USB_DEVICES; $i++) {
@@ -1452,7 +1452,7 @@ sub valid_drive_names {
sub is_valid_drivename {
my $dev = shift;
- return defined($drivename_hash->{$dev});
+ return defined($drivedesc_hash->{$dev});
}
sub option_exists {
@@ -1590,7 +1590,7 @@ sub parse_drive {
}
my $desc = $key =~ /^unused\d+$/ ? $alldrive_fmt
- : $confdesc->{$key}->{format};
+ : $drivedesc_hash->{$key}->{format};
if (!$desc) {
warn "invalid drive key: $key\n";
return undef;
--
2.20.1
More information about the pve-devel
mailing list