[pve-devel] [PATCH] move_disk : don't delete disk if used in a previous snasphot

Dietmar Maurer dietmar at proxmox.com
Mon Apr 14 08:51:32 CEST 2014


> +                    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