[pve-devel] update disk config, always rescan all the storage, can we avoid that ?

Alexandre DERUMIER aderumier at odiso.com
Wed Jun 5 07:08:20 CEST 2013


>Not sure about that.

>>First, I though a call to  activate_volume() should 'die' if a volume does not exists? But the nexenta
>>plugin simply 'return 1'
We don't need to activate volumes to list them with nexenta api.

>> Second, we have volume_size_info() - should that raise an exeption  if the volume does not exists?

But Yes, I just thinked the same thing !

This should do the job:

my $size = undef;

eval{

     ($size) = PVE::Storage::volume_size_info($storecfg, $volid, 1);
};
die "voluem does not exits" if $@;;

I can rebase my patch if you want

----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre DERUMIER" <aderumier at odiso.com> 
Cc: pve-devel at pve.proxmox.com 
Envoyé: Mercredi 5 Juin 2013 06:55:00 
Objet: RE: [pve-devel] update disk config, always rescan all the storage, can we avoid that ? 

> Also, I was thinking to replace 
> 
> " 
> PVE::Storage::foreach_volid($dl, sub { 
> my ($volumeid) = @_; 
> if($volumeid eq $volid) { 
> $foundvolid = 1; 
> return; 
> } 
> }); 
> die "image '$path' does not exists\n" if (!(-f $path || -b $path || 
> $foundvolid)); " 
> 
> By a specific storage plugin sub, like volume_exist. 
> 
> - Nexenta,netapp for example, have api to check directly if the volume exist 
> without need to parse all volumes. (listing all volumes take more time for 
> theses storage) This way, we could use the best/fastest method for each 
> storage plugin. 
> 
> What do you think about it ? 

Not sure about that. 

First, I though a call to activate_volume() should 'die' if a volume does not exists? But the nexenta 
plugin simply 'return 1' 

Second, we have volume_size_info() - should that raise an exeption if the volume does not exists? 



More information about the pve-devel mailing list