this is necessary, because after a reboot all pools except rpool are gone

Signed-off-by: Wolfgang Link <w.l...@proxmox.com>
---
 PVE/Storage/ZFSPlugin.pm     |    5 +++++
 PVE/Storage/ZFSPoolPlugin.pm |   10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index 581ef6c..e885949 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -343,4 +343,9 @@ sub volume_has_feature {
     return undef;
 }
 
+sub activate_storage {
+    my ($class, $storeid, $scfg, $cache) = @_;
+    return 1;
+}
+
 1;
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 10da7f7..553a92b 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -154,7 +154,7 @@ sub zfs_request {
     my $cmd = [];
 
     if ($method eq 'zpool_list') {
-       push @$cmd = 'zpool', 'list';
+       push @$cmd, 'zpool', 'list';
     } else {
        push @$cmd, 'zfs', $method;
     }
@@ -419,6 +419,14 @@ sub volume_snapshot_rollback {
 
 sub activate_storage {
     my ($class, $storeid, $scfg, $cache) = @_;
+
+    my @param = ('-o', 'name', '-H');
+
+    my $text = zfs_request($class, $scfg, undef, 'zpool_list', @param);
+ 
+    if ($text !~ $scfg->{pool}) {
+       run_command("zpool import -d /dev/disk/by-id/ -a");
+    }
     return 1;
 }
 
-- 
1.7.10.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to