[pve-devel] [PATCH qemu-server 1/2] remove $vmid param from print_drive

Stefan Reiter s.reiter at proxmox.com
Thu Dec 5 16:11:01 CET 2019


It isn't used in the sub, but suggest it is needed. No users outside
qemu-server found.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 PVE/API2/Qemu.pm   | 18 +++++++++---------
 PVE/QemuMigrate.pm |  2 +-
 PVE/QemuServer.pm  | 12 ++++++------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 51fe142..fbf036a 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -147,7 +147,7 @@ my $create_disks = sub {
 
 	if (!$volid || $volid eq 'none' || $volid eq 'cdrom') {
 	    delete $disk->{size};
-	    $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
+	    $res->{$ds} = PVE::QemuServer::print_drive($disk);
 	} elsif (defined($volname) && $volname eq 'cloudinit') {
 	    $storeid = $storeid // $default_storage;
 	    die "no storage ID specified (and no default storage)\n" if !$storeid;
@@ -169,7 +169,7 @@ my $create_disks = sub {
 	    $disk->{media} = 'cdrom';
 	    push @$vollist, $volid;
 	    delete $disk->{format}; # no longer needed
-	    $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
+	    $res->{$ds} = PVE::QemuServer::print_drive($disk);
 	} elsif ($volid =~ $NEW_DISK_RE) {
 	    my ($storeid, $size) = ($2 || $default_storage, $3);
 	    die "no storage ID specified (and no default storage)\n" if !$storeid;
@@ -188,7 +188,7 @@ my $create_disks = sub {
 	    $disk->{file} = $volid;
 	    $disk->{size} = PVE::Tools::convert_size($size, 'kb' => 'b');
 	    delete $disk->{format}; # no longer needed
-	    $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
+	    $res->{$ds} = PVE::QemuServer::print_drive($disk);
 	} else {
 
 	    PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
@@ -211,7 +211,7 @@ my $create_disks = sub {
 		$disk->{size} = $size;
 	    }
 
-	    $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
+	    $res->{$ds} = PVE::QemuServer::print_drive($disk);
 	}
     };
 
@@ -525,7 +525,7 @@ __PACKAGE__->register_method({
 		    raise_param_exc({ $opt => "unable to parse drive options" }) if !$drive;
 
 		    PVE::QemuServer::cleanup_drive_path($opt, $storecfg, $drive);
-		    $param->{$opt} = PVE::QemuServer::print_drive($vmid, $drive);
+		    $param->{$opt} = PVE::QemuServer::print_drive($drive);
 		}
 	    }
 
@@ -1063,7 +1063,7 @@ my $update_vm_api  = sub {
 	    raise_param_exc({ $opt => "unable to parse drive options" }) if !$drive;
 	    PVE::QemuServer::cleanup_drive_path($opt, $storecfg, $drive);
 	    $check_replication->($drive);
-	    $param->{$opt} = PVE::QemuServer::print_drive($vmid, $drive);
+	    $param->{$opt} = PVE::QemuServer::print_drive($drive);
 	} elsif ($opt =~ m/^net(\d+)$/) {
 	    # add macaddr
 	    my $net = PVE::QemuServer::parse_net($param->{$opt});
@@ -2905,7 +2905,7 @@ __PACKAGE__->register_method({
 								   $newid, $storage, $format, $fullclone->{$opt}, $newvollist,
 								   $jobs, $skipcomplete, $oldconf->{agent}, $clonelimit);
 
-			$newconf->{$opt} = PVE::QemuServer::print_drive($vmid, $newdrive);
+			$newconf->{$opt} = PVE::QemuServer::print_drive($newdrive);
 
 			PVE::QemuConfig->write_config($newid, $newconf);
 			$i++;
@@ -3099,7 +3099,7 @@ __PACKAGE__->register_method({
 		    my $newdrive = PVE::QemuServer::clone_disk($storecfg, $vmid, $running, $disk, $drive, undef,
 							       $vmid, $storeid, $format, 1, $newvollist, undef, undef, undef, $movelimit);
 
-		    $conf->{$disk} = PVE::QemuServer::print_drive($vmid, $newdrive);
+		    $conf->{$disk} = PVE::QemuServer::print_drive($newdrive);
 
 		    PVE::QemuConfig->add_unused_volume($conf, $old_volid) if !$param->{delete};
 
@@ -3589,7 +3589,7 @@ __PACKAGE__->register_method({
 	    PVE::QemuServer::qemu_block_resize($vmid, "drive-$disk", $storecfg, $volid, $newsize);
 
 	    $drive->{size} = $newsize;
-	    $conf->{$disk} = PVE::QemuServer::print_drive($vmid, $drive);
+	    $conf->{$disk} = PVE::QemuServer::print_drive($drive);
 
 	    PVE::QemuConfig->write_config($vmid, $conf);
 	};
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index b5df035..27c5b7a 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -950,7 +950,7 @@ sub phase3_cleanup {
 	} else {
 	    foreach my $target_drive (keys %{$self->{target_drive}}) {
 		my $drive = PVE::QemuServer::parse_drive($target_drive, $self->{target_drive}->{$target_drive}->{volid});
-		$conf->{$target_drive} = PVE::QemuServer::print_drive($vmid, $drive);
+		$conf->{$target_drive} = PVE::QemuServer::print_drive($drive);
 		PVE::QemuConfig->write_config($vmid, $conf);
 	    }
 	}
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0d0e610..c568d37 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1751,7 +1751,7 @@ sub parse_drive {
 }
 
 sub print_drive {
-    my ($vmid, $drive) = @_;
+    my ($drive) = @_;
     my $data = { %$drive };
     delete $data->{$_} for qw(index interface);
     return PVE::JSONSchema::print_property_string($data, $alldrive_fmt);
@@ -2667,7 +2667,7 @@ sub parse_vm_config {
 		    my $v = parse_drive($key, $value);
 		    if (my $volid = filename_to_volume_id($vmid, $v->{file}, $v->{media})) {
 			$v->{file} = $volid;
-			$value = print_drive($vmid, $v);
+			$value = print_drive($v);
 		    } else {
 			warn "vm $vmid - unable to parse value of '$key'\n";
 			next;
@@ -5267,7 +5267,7 @@ sub vm_start {
 		my $newdrive = $drive;
 		$newdrive->{format} = $format;
 		$newdrive->{file} = $newvolid;
-		my $drivestr = PVE::QemuServer::print_drive($vmid, $newdrive);
+		my $drivestr = print_drive($newdrive);
 		$local_volumes->{$opt} = $drivestr;
 		#pass drive to conf for command line
 		$conf->{$opt} = $drivestr;
@@ -5976,7 +5976,7 @@ sub restore_update_config_line {
 	} elsif ($map->{$virtdev}) {
 	    delete $di->{format}; # format can change on restore
 	    $di->{file} = $map->{$virtdev};
-	    $value = print_drive($vmid, $di);
+	    $value = print_drive($di);
 	    print $outfd "$virtdev: $value\n";
 	} else {
 	    print $outfd $line;
@@ -6090,7 +6090,7 @@ sub update_disksize {
 	    next if !$volid_hash->{$volid};
 
 	    $drive->{size} = $volid_hash->{$volid}->{size};
-	    my $new = print_drive($vmid, $drive);
+	    my $new = print_drive($drive);
 	    if ($new ne $conf->{$opt}) {
 		$changes = 1;
 		$conf->{$opt} = $new;
@@ -6688,7 +6688,7 @@ sub template_create {
 
 	my $voliddst = PVE::Storage::vdisk_create_base($storecfg, $volid);
 	$drive->{file} = $voliddst;
-	$conf->{$ds} = print_drive($vmid, $drive);
+	$conf->{$ds} = print_drive($drive);
 	PVE::QemuConfig->write_config($vmid, $conf);
     });
 }
-- 
2.20.1




More information about the pve-devel mailing list