--- Begin Message ---
Signed-off-by: Alexandre Derumier <alexandre.derum...@groupe-cyllene.com>
---
 src/PVE/Storage.pm                | 13 +++++++++++++
 src/PVE/Storage/LVMQcow2Plugin.pm |  8 ++++++++
 src/PVE/Storage/Plugin.pm         |  6 ++++++
 3 files changed, 27 insertions(+)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 8e0f8f1..367b672 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -1279,6 +1279,19 @@ sub deactivate_volumes {
        if scalar(@errlist);
 }
 
+sub refresh_volumes {
+    my ($cfg, $vollist) = @_;
+
+    return if !($vollist && scalar(@$vollist));
+
+    foreach my $volid (@$vollist) {
+       my ($storeid, $volname) = parse_volume_id($volid);
+       my $scfg = storage_config($cfg, $storeid);
+       my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+       $plugin->refresh_volume($storeid, $scfg, $volname);
+    }
+}
+
 sub storage_info {
     my ($cfg, $content, $includeformat) = @_;
 
diff --git a/src/PVE/Storage/LVMQcow2Plugin.pm 
b/src/PVE/Storage/LVMQcow2Plugin.pm
index 3b98eeb..2c17c69 100644
--- a/src/PVE/Storage/LVMQcow2Plugin.pm
+++ b/src/PVE/Storage/LVMQcow2Plugin.pm
@@ -203,6 +203,14 @@ sub volume_underlay_resize {
     run_command($cmd, errmsg => "error resizing volume '$path'");
 }
 
+sub refresh_volume {
+    my ($class, $storeid, $scfg, $volname) = @_;
+
+    my $path = $class->path($scfg, $volname);
+    my $cmd = ['/sbin/lvchange', '--refresh', $path];
+    run_command($cmd, errmsg => "can't refresh LV '$path' for activation");
+}
+
 sub volume_has_feature {
     my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
 
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index e930102..8ff9fbd 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1479,6 +1479,12 @@ sub deactivate_volume {
     # do nothing by default
 }
 
+sub refresh_volume {
+    my ($class, $storeid, $scfg, $volname) = @_;
+
+    # do nothing by default
+}
+
 sub check_connection {
     my ($class, $storeid, $scfg) = @_;
     # do nothing by default
-- 
2.39.2



--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to