-# Copyright (c) 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved.
+# Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved.
#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
}
- if ($self->{action} eq 'check') {
- $self->{snapshot} = $self->zfs_build_snapshotname($device, -1);
- } else {
- $self->{snapshot} = $self->zfs_build_snapshotname($device);
- }
+ $self->{snapshot} = $self->zfs_build_snapshotname($device);
if (defined $self->{mountpoint}) {
if ($device =~ /^$self->{mountpoint}/) {
$self->{dir} = $device;
my $device = $self->{device};
$device = $self->{directory} if defined $self->{directory};
my $newsnapshotname = $self->zfs_build_snapshotname($device, $level);
- my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} rename $self->{filesystem}\@$self->{snapshot} $newsnapshotname";
+ my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} rename $self->{filesystem}\@$self->{snapshot} $self->{filesystem}\@$newsnapshotname";
debug "running: $cmd|";
my($wtr, $rdr, $err, $pid);
my($msg, $errmsg);
my $snapshotname = "";
- if (!defined $level) {
- $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($self->{disk}) . "-current";
- } else {
- if ($level < 0) {
+ if ($self->{action} eq 'check') {
$snapshotname = "amanda-" . Amanda::Util::sanitise_filename($self->{disk}) . "-check";
- } else {
- $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($self->{disk}) . "-" . $level;
- }
- }
+ } elsif (!defined $level) {
+ $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($self->{disk}) . "-current";
+ } else {
+ $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($self->{disk}) . "-" . $level;
+ }
return $snapshotname;
}