[pve-devel] [PATCH] migrate: syncdisk : avoid scanning shared storage

Alexandre DERUMIER aderumier at odiso.com
Mon Jul 16 11:28:52 CEST 2012


Damn,sorry, I miss that....


BTW, about storage_check_enabled,
Do you think we can add some kind of network ping check to see if the storage is available ? (making a sub for each network storage plugin)

I have see a report from user in the forum, 
http://forum.proxmox.com/threads/10309-UI-freeze-when-opening-Storage-tab-if-one-of-the-NFS-Share-is-not-available
with freeze on vdisk_list on nfs if storage is not available.

I think I already have same kind of problems with iscsi, when network problem occurs.


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

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Lundi 16 Juillet 2012 10:38:07 
Objet: RE: [pve-devel] [PATCH] migrate: syncdisk : avoid scanning shared storage 

That patch introduces a serious bug. Just fixed the bug and uploaded a new version. 

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm 
index 1b1e1f2..1a35004 100644 
--- a/PVE/QemuMigrate.pm 
+++ b/PVE/QemuMigrate.pm 
@@ -181,13 +181,14 @@ sub sync_disks { 
foreach my $storeid (@sids) { 
my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid); 
next if $scfg->{shared}; 
+ next if !PVE::Storage::storage_check_enabled($self->{storecfg}, $storeid, undef, 1); 
+ 
# get list from PVE::Storage (for unused volumes) 
my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, $vmid); 
PVE::Storage::foreach_volid($dl, sub { 
my ($volid, $sid, $volname) = @_; 

- # check if storage is available on both nodes 
- my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, $sid); 
+ # check if storage is available on target node 
PVE::Storage::storage_check_node($self->{storecfg}, $sid, $self->{node}); 

$volhash->{$volid} = 1; 


> -----Original Message----- 
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel- 
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier 
> Sent: Freitag, 13. Juli 2012 15:13 
> To: pve-devel at pve.proxmox.com 
> Subject: [pve-devel] [PATCH] migrate: syncdisk : avoid scanning shared 
> storage 
> 
> Currently we get list from PVE::Storage (for unused volumes), from all 
> storage. 
> If something goes wrong with the network on host and thenwe can't 
> communicate with a network shared storage(sheepdog,rbd,..), the vdisk_list 
> die (timeout) and we cannot migrate the vm on another kvm host.(online or 
> offline). 
> 
> We don't need to scan shared storage, as they are no disk to sync. 
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> --- 
> PVE/QemuMigrate.pm | 28 +++++++++++++++------------- 
> 1 files changed, 15 insertions(+), 13 deletions(-) 
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 
> b0059c3..f5e7c1b 100644 
> --- a/PVE/QemuMigrate.pm 
> +++ b/PVE/QemuMigrate.pm 
> @@ -177,19 +177,21 @@ sub sync_disks { 
> my $volhash = {}; 
> my $cdromhash = {}; 
> 
> - # get list from PVE::Storage (for unused volumes) 
> - my $dl = PVE::Storage::vdisk_list($self->{storecfg}, undef, $vmid); 
> - PVE::Storage::foreach_volid($dl, sub { 
> - my ($volid, $sid, $volname) = @_; 
> - 
> - # check if storage is available on both nodes 
> - my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, 
> $sid); 
> - PVE::Storage::storage_check_node($self->{storecfg}, $sid, $self- 
> >{node}); 
> - 
> - return if $scfg->{shared}; 
> - 
> - $volhash->{$volid} = 1; 
> - }); 
> + my $ids = $self->{storecfg}->{ids}; 
> + foreach my $storeid (keys %$ids) { 
> + next if $ids->{$storeid}->{shared}; 
> + # get list from PVE::Storage (for unused volumes) 
> + my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, $vmid); 
> + PVE::Storage::foreach_volid($dl, sub { 
> + my ($volid, $sid, $volname) = @_; 
> + 
> + # check if storage is available on both nodes 
> + my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, 
> $sid); 
> + PVE::Storage::storage_check_node($self->{storecfg}, 
> + $sid, $self->{node}); 
> + 
> + $volhash->{$volid} = 1; 
> + }); 
> + } 
> 
> # and add used,owned/non-shared disks (just to be sure we have all) 
> 
> -- 
> 1.7.2.5 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 





-- 

-- 



	

Alexandre D e rumier 

Ingénieur Systèmes et Réseaux 


Fixe : 03 20 68 88 85 

Fax : 03 20 68 90 88 


45 Bvd du Général Leclerc 59100 Roubaix 
12 rue Marivaux 75002 Paris 



More information about the pve-devel mailing list