]> git.proxmox.com Git - pve-storage.git/commitdiff
PVE::Storage::storage_can_replicate - hew helper
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 27 Jun 2017 04:17:58 +0000 (06:17 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 27 Jun 2017 04:17:58 +0000 (06:17 +0200)
PVE/Storage.pm
PVE/Storage/Plugin.pm
PVE/Storage/ZFSPlugin.pm
PVE/Storage/ZFSPoolPlugin.pm

index 4772c6c06c1f2b64b8b4903d457ba77ffbb25481..cf1e5ec9a7565fccebdb5739484ae8a254aef39b 100755 (executable)
@@ -145,6 +145,17 @@ sub storage_check_enabled {
     return storage_check_node($cfg, $storeid, $node, $noerr);
 }
 
+# storage_can_replicate:
+# return true if storage supports replication
+# (volumes alocated with vdisk_alloc() has replication feature)
+sub storage_can_replicate {
+    my ($cfg, $storeid, $format) = @_;
+
+    my $scfg = storage_config($cfg, $storeid);
+    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+    return $plugin->storage_can_replicate($scfg, $storeid, $format);
+}
+
 sub storage_ids {
     my ($cfg) = @_;
 
index 50a99c4b86c968000f12f4b2b878c37817494c44..b640712a8eaad6dd29288995d1fa77487af66d4f 100644 (file)
@@ -742,6 +742,12 @@ sub volume_snapshot_delete {
     return undef;
 }
 
+sub storage_can_replicate {
+    my ($class, $scfg, $storeid, $format) = @_;
+
+    return 0;
+}
+
 sub volume_has_feature {
     my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
 
index 8658f0e168c281a13c372e1fad6d2a292362ebb0..d4cbb8da317b3fdc58c3bcc13a8b8369397a1e02 100644 (file)
@@ -336,6 +336,12 @@ sub volume_snapshot_rollback {
     $class->zfs_add_lun_mapping_entry($scfg, $volname);
 }
 
+sub storage_can_replicate {
+    my ($class, $scfg, $storeid, $format) = @_;
+
+    return 0;
+}
+
 sub volume_has_feature {
     my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
 
index fbda2c4571f4053a4053aab8e11469071cb3f8a0..b971e3a5a2b641e14dd606ff306735b42345f2d7 100644 (file)
@@ -623,6 +623,14 @@ sub volume_resize {
     return $new_size;
 }
 
+sub storage_can_replicate {
+    my ($class, $scfg, $storeid, $format) = @_;
+
+    return 1 if $format eq 'raw' || $format eq 'subvol';
+
+    return 0;
+}
+
 sub volume_has_feature {
     my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;