}
sub activate_volumes {
- my ($cfg, $vollist) = @_;
+ my ($cfg, $vollist, $snapname) = @_;
return if !($vollist && scalar(@$vollist));
my ($storeid, $volname) = parse_volume_id($volid);
my $scfg = storage_config($cfg, $storeid);
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
- $plugin->activate_volume($storeid, $scfg, $volname, $cache);
+ $plugin->activate_volume($storeid, $scfg, $volname, $snapname, $cache);
}
}
sub deactivate_volumes {
- my ($cfg, $vollist) = @_;
+ my ($cfg, $vollist, $snapname) = @_;
return if !($vollist && scalar(@$vollist));
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
eval {
- $plugin->deactivate_volume($storeid, $scfg, $volname, $cache);
+ $plugin->deactivate_volume($storeid, $scfg, $volname, $snapname, $cache);
};
if (my $err = $@) {
warn $err;
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+
+ die "Snapshot not implemented on DRBD\n" if $snapname;
my $path = $class->path($scfg, $volname);
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+
+ die "Snapshot not implemented on DRBD\n" if $snapname;
return undef; # fixme: should we unassign ?
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
# do nothing by default
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
# do nothing by default
}
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+
+ die "volume snapshot is not possible on iscsi device" if $snapname;
+
return 1;
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+
+ die "volume snapshot is not possible on iscsi device" if $snapname;
+
return 1;
}
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
#fix me lvmchange is not provided on
- my $path = $class->path($scfg, $volname);
+ my $path = $class->path($scfg, $volname, $snapname);
my $lvm_activate_mode = 'ey';
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->path($scfg, $volname, $snapname);
return if ! -b $path;
my $cmd = ['/sbin/lvchange', '-aln', $path];
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
- my $path = $class->filesystem_path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname, $snapname);
# check is volume exists
if ($scfg->{path}) {
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
# do nothing by default
}
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
return 1 if !$scfg->{krbd};
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
my $path = "/dev/rbd/$pool/$name";
+ $path .= '@'.$snapname if $snapname;
return if -b $path;
+ $name .= '@'.$snapname if $snapname;
my $cmd = &$rbd_cmd($scfg, $storeid, 'map', $name);
run_rbd_command($cmd, errmsg => "can't mount rbd volume $name");
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
return 1 if !$scfg->{krbd};
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
my $path = "/dev/rbd/$pool/$name";
+ $path .= '@'.$snapname if $snapname;
return if ! -b $path;
my $cmd = &$rbd_cmd($scfg, $storeid, 'unmap', $path);
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
return 1;
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
return 1;
}
sub activate_storage {
my ($class, $storeid, $scfg, $cache) = @_;
+
+ return 1;
+}
+
+sub deactivate_storage {
+ my ($class, $storeid, $scfg, $cache) = @_;
+
+ return 1;
+}
+
+sub activate_volume {
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+
+ die "unable to activate snapshot from remote zfs storage" if $snapname;
+
+ return 1;
+}
+
+sub deactivate_volume {
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
+
+ die "unable to deactivate snapshot from remote zfs storage" if $snapname;
+
return 1;
}
}
sub activate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
return 1;
}
sub deactivate_volume {
- my ($class, $storeid, $scfg, $volname, $cache) = @_;
+ my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
return 1;
}