if (!toValue(tmp1, target_mode, false))
SN_THROW(Exception(sformat("unknown target-mode '%s' in '%s'", tmp1.c_str(), name.c_str())));
- if (!get_child_value(json_file.get_root(), "source-path", source_path))
- SN_THROW(Exception(sformat("source-path entry not found in '%s'", name.c_str())));
-
if (!get_child_value(json_file.get_root(), "target-path", target_path))
SN_THROW(Exception(sformat("target-path entry not found in '%s'", name.c_str())));
TargetMode target_mode = TargetMode::LOCAL;
- string source_path;
string target_path;
bool automatic = false;
return nodes;
}
- string source_snapshot_dir(const BackupConfig& backup_config, unsigned int num)
+ string source_snapshot_dir(const ProxySnapper* snapper, unsigned int num)
{
- return backup_config.source_path + "/" SNAPSHOTS_NAME "/" + to_string(num);
+ return snapper->getConfig().getSubvolume() + "/" SNAPSHOTS_NAME "/" +
+ to_string(num);
}
string target_snapshot_dir(const BackupConfig& backup_config, unsigned int num)
spec_source.shell = backup_config.get_source_shell();
spec_source.mkdir_bin = MKDIR_BIN;
spec_source.btrfs_bin = BTRFS_BIN;
- spec_source.snapshot_dir = source_snapshot_dir(backup_config, num);
+ spec_source.snapshot_dir = source_snapshot_dir(the_big_things.snapper, num);
CopySpec spec_target; // Copy specification for the snapshot on the target.
spec_target.shell = backup_config.get_target_shell();
the_big_things.source_tree.find_nearest_valid_node(source_uuid))
{
spec_source.parent_subvol_path =
- source_snapshot_dir(backup_config, parent->node->get_number()) +
+ source_snapshot_dir(the_big_things.snapper,
+ parent->node->get_number()) +
"/" SNAPSHOT_NAME;
}
target_btrfs_version(backup_config.target_btrfs_bin, backup_config.get_target_shell()),
snapper(snappers->getSnapper(backup_config.config)), locker(snapper)
{
- if (backup_config.source_path != snapper->getConfig().getSubvolume())
- {
- string error = sformat(_("Path mismatch between source-path of backup-config and subvolume of "
- "snapper config ('%s' vs. '%s')."), backup_config.source_path.c_str(),
- snapper->getConfig().getSubvolume().c_str());
- SN_THROW(Exception(error));
- }
-
probe_source(backup_config, verbose);
probe_target(backup_config, verbose);
// Query additional information (uuids, read-only) from btrfs.
- CmdBtrfsSubvolumeShow extra(BTRFS_BIN, shell_source, backup_config.source_path + "/" SNAPSHOTS_NAME "/" +
- to_string(num) + "/" SNAPSHOT_NAME);
+ CmdBtrfsSubvolumeShow extra(BTRFS_BIN, shell_source,
+ source_snapshot_dir(snapper, num) +
+ "/" SNAPSHOT_NAME);
TheBigThing the_big_thing(num);
the_big_thing.date = source_snapshot.getDate();
TreeView source_tree;
TreeView target_tree;
+ const ProxySnapper* snapper;
+
private:
- const ProxySnapper* snapper;
const Locker locker;
vector<TheBigThing> the_big_things;
enum class Column
{
- NAME, CONFIG, TARGET_MODE, AUTOMATIC, SOURCE_PATH, TARGET_PATH, SSH_HOST,
+ NAME, CONFIG, TARGET_MODE, AUTOMATIC, TARGET_PATH, SSH_HOST,
SSH_USER, SSH_PORT, SSH_IDENTITY, TARGET_BTRFS_BIN, TARGET_LS_BIN,
TARGET_MKDIR_BIN, TARGET_RM_BIN, TARGET_RMDIR_BIN
};
case Column::AUTOMATIC:
return Cell(_("Automatic"));
- case Column::SOURCE_PATH:
- return Cell(_("Source Path"));
-
case Column::TARGET_PATH:
return Cell(_("Target Path"));
case Column::AUTOMATIC:
return backup_config.automatic;
- case Column::SOURCE_PATH:
- return backup_config.source_path;
-
case Column::TARGET_PATH:
return backup_config.target_path;
}
const vector<Column> some_columns = { Column::NAME, Column::CONFIG, Column::TARGET_MODE,
- Column::AUTOMATIC, Column::SOURCE_PATH, Column::TARGET_PATH, Column::SSH_HOST,
+ Column::AUTOMATIC, Column::TARGET_PATH, Column::SSH_HOST,
Column::SSH_USER, Column::SSH_PORT, Column::SSH_IDENTITY };
const vector<Column> all_columns = { Column::NAME, Column::CONFIG, Column::TARGET_MODE,
- Column::AUTOMATIC, Column::SOURCE_PATH, Column::TARGET_PATH, Column::SSH_HOST,
+ Column::AUTOMATIC, Column::TARGET_PATH, Column::SSH_HOST,
Column::SSH_USER, Column::SSH_PORT, Column::SSH_IDENTITY, Column::TARGET_BTRFS_BIN,
Column::TARGET_LS_BIN, Column::TARGET_MKDIR_BIN, Column::TARGET_RM_BIN,
Column::TARGET_RMDIR_BIN
template <> struct EnumInfo<Column> { static const vector<string> names; };
const vector<string> EnumInfo<Column>::names({
- "name", "config", "target-mode", "automatic", "source-path", "target-path", "ssh-host",
+ "name", "config", "target-mode", "automatic", "target-path", "ssh-host",
"ssh-user", "ssh-port", "ssh-identity", "target-btrfs-bin", "target-ls-bin",
"target-mkdir-bin", "target-rm-bin", "target-rmdir-bin"
});
if (backup_configs.size() > 1)
{
cout << "Backup-config:" << backup_config.name << ", config:" << backup_config.config
- << ", source-path:" << backup_config.source_path << ", target-mode:"
- << toString(backup_config.target_mode) << endl;
+ << ", target-mode:" << toString(backup_config.target_mode) << endl;
}
try