[pve-devel] [PATCH] move_disk : don't delete disk if used in a previous snasphot
Alexandre DERUMIER
aderumier at odiso.com
Mon Apr 14 10:04:03 CEST 2014
Ok, I'll rework the patch
----- Mail original -----
De: "Dietmar Maurer" <dietmar at proxmox.com>
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com
Envoyé: Lundi 14 Avril 2014 08:51:32
Objet: RE: [pve-devel] [PATCH] move_disk : don't delete disk if used in a previous snasphot
> + my $used_paths = PVE::QemuServer::get_used_paths($vmid,
> $storecfg, $conf, 1, 1);
> + my $path = PVE::Storage::path($storecfg, $old_volid);
> + eval{ die "unable to delete '$old_volid' - volume is still in use
> (snapshot?)\n"
> + if $used_paths->{$path}; };
> + if ($@){
What is the purpose of that eval {} statement? Can't we simply use:
if ($used_paths->{$path}) {
warn ""unable to delete '$old_volid' - ....
> + warn $@;
> + PVE::QemuServer::add_unused_volume($conf,
> $old_volid);
> + PVE::QemuServer::update_config_nolock($vmid, $conf,
> 1);
> +
> + } else {
> + eval { PVE::Storage::vdisk_free($storecfg, $old_volid); };
> + warn $@ if $@;
> + }
> }
> };
>
> --
> 1.7.10.4
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list