call volume_rollback_is_possible from PVE::Storage::volume_snapshot_rollback
That way it is automatically called for all plungins.
This commit is contained in:
@ -181,6 +181,7 @@ sub volume_snapshot_rollback {
|
|||||||
if ($storeid) {
|
if ($storeid) {
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||||
|
$plugin->volume_rollback_is_possible($scfg, $storeid, $volname, $snap);
|
||||||
return $plugin->volume_snapshot_rollback($scfg, $storeid, $volname, $snap);
|
return $plugin->volume_snapshot_rollback($scfg, $storeid, $volname, $snap);
|
||||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||||
die "snapshot rollback device is not possible";
|
die "snapshot rollback device is not possible";
|
||||||
|
|||||||
@ -310,9 +310,6 @@ sub volume_resize {
|
|||||||
sub volume_snapshot_rollback {
|
sub volume_snapshot_rollback {
|
||||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||||
|
|
||||||
# abort rollback if snapshot is not the latest
|
|
||||||
$class->volume_rollback_is_possible($scfg, $storeid, $volname, $snap);
|
|
||||||
|
|
||||||
$class->zfs_delete_lu($scfg, $volname);
|
$class->zfs_delete_lu($scfg, $volname);
|
||||||
|
|
||||||
$class->zfs_request($class, $scfg, undef, 'rollback', "$scfg->{pool}/$volname\@$snap");
|
$class->zfs_request($class, $scfg, undef, 'rollback', "$scfg->{pool}/$volname\@$snap");
|
||||||
|
|||||||
@ -411,9 +411,6 @@ sub volume_snapshot_delete {
|
|||||||
sub volume_snapshot_rollback {
|
sub volume_snapshot_rollback {
|
||||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||||
|
|
||||||
# abort rollback if snapshot is not the latest
|
|
||||||
$class->volume_rollback_is_possible($scfg, $storeid, $volname, $snap);
|
|
||||||
|
|
||||||
zfs_request($class, $scfg, undef, 'rollback', "$scfg->{pool}/$volname\@$snap");
|
zfs_request($class, $scfg, undef, 'rollback', "$scfg->{pool}/$volname\@$snap");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user