method => undef,
source_user => undef,
dest_user => undef,
+ prepend_storage_id => undef,
properties => undef,
dest_config_path => undef,
};
'method=s' => \$param->{method},
'source-user=s' => \$param->{source_user},
'dest-user=s' => \$param->{dest_user},
+ 'prepend-storage-id' => \$param->{prepend_storage_id},
'properties' => \$param->{properties},
'dest-config-path=s' => \$param->{dest_config_path},
);
$job->{source} = $param->{source};
$job->{source_user} = $param->{source_user};
$job->{dest_user} = $param->{dest_user};
+ $job->{prepend_storage_id} = !!$param->{prepend_storage_id};
$job->{properties} = !!$param->{properties};
$job->{dest_config_path} = $param->{dest_config_path} if $param->{dest_config_path};
$text .= " --verbose" if $job->{verbose};
$text .= " --source-user $job->{source_user}";
$text .= " --dest-user $job->{dest_user}";
+ $text .= " --prepend-storage-id" if $job->{prepend_storage_id};
$text .= " --properties" if $job->{properties};
$text .= " --dest-config-path $job->{dest_config_path}" if $job->{dest_config_path};
$text .= "\n";
($dest->{old_snap}, $dest->{last_snap}) = snapshot_get($source, $dest, $param->{maxsnap}, $param->{name}, $param->{dest_user});
+ prepare_prepended_target($source, $dest, $param->{dest_user}) if defined($dest->{prepend});
+
snapshot_add($source, $dest, $param->{name}, $date, $param->{source_user}, $param->{dest_user});
send_image($source, $dest, $param);
$source->{pool} = $disks->{$disk}->{pool};
$source->{path} = $disks->{$disk}->{path} if $disks->{$disk}->{path};
$source->{last_part} = $disks->{$disk}->{last_part};
+
+ $dest->{prepend} = $disks->{$disk}->{storage_id}
+ if $param->{prepend_storage_id};
+
&$sync_path($source, $dest, $job, $param, $date);
}
if ($param->{method} eq "ssh" && ($source->{ip} || $dest->{ip})) {
my ($source, $dest) = @_;
my $target = "$dest->{all}";
+ $target .= "/$dest->{prepend}" if defined($dest->{prepend});
$target .= "/$source->{last_part}" if $source->{last_part};
$target =~ s!/+!/!g;
return $target;
}
+# create the parent dataset for the actual target
+sub prepare_prepended_target {
+ my ($source, $dest, $dest_user) = @_;
+
+ die "internal error - not a prepended target\n" if !defined($dest->{prepend});
+
+ # The parent dataset shouldn't be the actual target.
+ die "internal error - no last_part for source\n" if !$source->{last_part};
+
+ my $target = "$dest->{all}/$dest->{prepend}";
+ $target =~ s!/+!/!g;
+
+ return if check_dataset_exists($target, $dest->{ip}, $dest_user);
+
+ create_file_system($target, $dest->{ip}, $dest_user);
+}
+
sub snapshot_destroy {
my ($source, $dest, $method, $snap, $source_user, $dest_user) = @_;
name of the sync job, if not set it is default
+ -prepend-storage-id
+
+ If specified, prepend the storage ID to the destination's path(s).
+
-skip
If specified, skip the first sync.
name of the sync job, if not set it is default.
It is only necessary if scheduler allready contains this source.
+ -prepend-storage-id
+
+ If specified, prepend the storage ID to the destination's path(s).
+
-source string
the source can be an <VMID> or [IP:]<ZFSPool>[/Path]