File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -174,19 +174,22 @@ sub listSubDataSets {
174
174
sub createSnapshot {
175
175
my $self = shift ;
176
176
my $dataSet = shift ;
177
- my $remote ;
178
177
my @recursive = $_ [0] ? (' -r' ) : ();
179
-
180
- # check if snapshot already exists, if so, exit.
181
- return 0 if $self -> snapshotExists($dataSet );
178
+ my $remote ;
182
179
183
180
($remote , $dataSet ) = $splitHostDataSet -> ($dataSet );
184
181
my @ssh = $self -> $buildRemote ($remote , [qw( zfs snapshot) , @recursive , $dataSet ]);
185
182
186
183
print STDERR ' # ' . join (' ' , @ssh ) . " \n " if $self -> debug;
187
- system (@ssh ) && die " ERROR: cannot create snapshot $dataSet \n " if !$self -> noaction;
188
184
189
- return 1;
185
+ # return if 'noaction' or snapshot creation successful
186
+ return 1 if $self -> noaction || !system (@ssh );
187
+
188
+ # check if snapshot already exists and therefore creation failed
189
+ return 0 if $self -> snapshotExists($dataSet );
190
+
191
+ # creation failed and snapshot does not exist, throw an exception
192
+ die " ERROR: cannot create snapshot $dataSet \n " ;
190
193
}
191
194
192
195
# known limitation: snapshots from subdatasets have to be destroyed individually
You can’t perform that action at this time.
0 commit comments