[pve-devel] [PATCH 1/3] add check_connection in storage_check_enabled.
Alexandre Derumier
aderumier at odiso.com
Wed Jul 18 13:35:00 CEST 2012
Currently, if a storage have an infinite timeout (nfs hard option or iscsi with high timeout for failover),
and if the storage is down or is doing ha failover with dual controller
- pvestatd hang on storage_info. (So pve-manager see the host as down, and hang on differents parts, gui,rrds display)
- pvedaemon hang on differents place (storage disk list,vm_status, hardware info,...)
- I also see a lot of qemu-img info process hanging in uninterruptible sleep state with iscsi storage.
This patch add a check to see if the storage is accessible.
For nfs and iscsi : ping with a timeout of 2 second. (Maybe this can be polish with some kind of filesystem/storage read test with timeout...)
Default for other storage plugins is to check nothing. (not a problem with sheepdog,ceph,libiscsi... as commands have timeout)
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage.pm | 6 ++++++
PVE/Storage/Plugin.pm | 6 ++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index c86ce0c..4b0805c 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -93,6 +93,12 @@ sub storage_check_enabled {
return undef;
}
+ my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+ if (!$plugin->check_connection($storeid, $scfg)) {
+ die "storage '$storeid' is not available\n" if !$noerr;
+ return undef;
+ }
+
return storage_check_node($cfg, $storeid, $node, $noerr);
}
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 7c0e3e9..27f004c 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -579,4 +579,10 @@ sub deactivate_volume {
# do nothing by default
}
+sub check_connection {
+ my ($class, $storeid, $scfg) = @_;
+ # do nothing by default
+ return 1;
+}
+
1;
--
1.7.2.5
More information about the pve-devel
mailing list