Skip to content

Instantly share code, notes, and snippets.

@aderumier
Created November 14, 2021 17:17
Show Gist options
  • Save aderumier/2ebfe372d1ee8be1cc4eb6e8ff95ec23 to your computer and use it in GitHub Desktop.
Save aderumier/2ebfe372d1ee8be1cc4eb6e8ff95ec23 to your computer and use it in GitHub Desktop.
sub activate_volume {
my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
my $vg = $scfg->{vgname};
# only snapshot volumes needs activation
if ($snapname) {
my $snapvol = "snap_${volname}_$snapname";
my $cmd = ['/sbin/lvchange', '-ay', '-K', "$vg/$snapvol"];
run_command($cmd, errmsg => "activate_volume '$vg/$snapvol' error");
} elsif ($volname =~ /^base-/) {
my $cmd = ['/sbin/lvchange', '-ay', '-K', "$vg/$volname"];
run_command($cmd, errmsg => "activate_volume '$vg/$volname' error");
} else {
# other volumes are active by default
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment