[pve-devel] r6243 - in qemu-server/pve2: . PVE/API2
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed Jul 6 08:28:40 CEST 2011
Author: dietmar
Date: 2011-07-06 08:28:40 +0200 (Wed, 06 Jul 2011)
New Revision: 6243
Modified:
qemu-server/pve2/ChangeLog
qemu-server/pve2/PVE/API2/Qemu.pm
Log:
* PVE/API2/Qemu.pm (update_vm): track unused disks when someone
overwrite disk settings
Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog 2011-07-06 05:54:32 UTC (rev 6242)
+++ qemu-server/pve2/ChangeLog 2011-07-06 06:28:40 UTC (rev 6243)
@@ -3,6 +3,9 @@
* PVE/API2/Qemu.pm (update_vm): check to avoid '-$opt' and
'-delete $opt' at the same time.
+ * PVE/API2/Qemu.pm (update_vm): track unused disks when someone
+ overwrite disk settings
+
2011-06-29 Proxmox Support Team <support at proxmox.com>
* PVE/QemuServer.pm (config_to_command): implement -cpu option
Modified: qemu-server/pve2/PVE/API2/Qemu.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu.pm 2011-07-06 05:54:32 UTC (rev 6242)
+++ qemu-server/pve2/PVE/API2/Qemu.pm 2011-07-06 06:28:40 UTC (rev 6243)
@@ -404,6 +404,21 @@
}
}
+ foreach my $opt (keys %$param) {
+ next if !PVE::QemuServer::valid_drivename($opt);
+ next if !$conf->{$opt};
+ my $old_drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
+ next if PVE::QemuServer::drive_is_cdrom($old_drive);
+ my $new_drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
+ if ($new_drive->{file} ne $old_drive->{file}) {
+ my ($path, $owner);
+ eval { ($path, $owner) = PVE::Storage::path($storecfg, $old_drive->{file}); };
+ if ($owner && ($owner == $vmid)) {
+ PVE::QemuServer::add_unused_volume($conf, $param, $old_drive->{file});
+ }
+ }
+ }
+
my $unset = {};
foreach my $opt (PVE::Tools::split_list($delete)) {
More information about the pve-devel
mailing list