[pve-devel] [PATCH v2 qemu-server 03/28] print_drive: Use $skip to avoid the need to copy the hash

Fabian Ebner f.ebner at proxmox.com
Mon Feb 24 13:43:53 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 751a075..1580514 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1655,9 +1655,8 @@ sub parse_drive {
 
 sub print_drive {
     my ($drive) = @_;
-    my $data = { %$drive };
-    delete $data->{$_} for qw(index interface);
-    return PVE::JSONSchema::print_property_string($data, $alldrive_fmt);
+    my $skip = [ 'index', 'interface' ];
+    return PVE::JSONSchema::print_property_string($drive, $alldrive_fmt, $skip);
 }
 
 sub scsi_inquiry {
-- 
2.20.1





More information about the pve-devel mailing list