## Summary
- Add per-host rsync bandwidth limit overrides with inherit/unlimited semantics. - Store the effective bwlimit in run metadata/results and show it in host/run detail views. - Document recommended starting values for VPN and remote backups. ## Tests - `.venv/bin/python manage.py makemigrations --check --dry-run` - `.venv/bin/python manage.py test src.pobsync_backend.tests.test_django_config_source.DjangoConfigSourceTests.test_returns_effective_config_from_database src.pobsync_backend.tests.test_django_config_source.DjangoConfigSourceTests.test_host_can_disable_global_rsync_bandwidth_limit src.pobsync_backend.tests.test_configure_commands.ConfigureCommandsTests.test_configure_host_uses_global_retention_defaults src.pobsync_backend.tests.test_run_scheduled_config_source.RunScheduledConfigSourceTests.test_dry_run_applies_configured_bandwidth_limit src.pobsync_backend.tests.test_run_scheduled_config_source.RunScheduledConfigSourceTests.test_real_run_can_request_verbose_output_args --verbosity 2` - `.venv/bin/python manage.py test src.pobsync_backend.tests.test_views.ViewTests.test_create_host_config_form_creates_host src.pobsync_backend.tests.test_views.ViewTests.test_host_detail_renders_effective_config_preview src.pobsync_backend.tests.test_views.ViewTests.test_run_detail_renders_result_payload src.pobsync_backend.tests.test_views.ViewTests.test_host_config_form_updates_host_config --verbosity 2` - `.venv/bin/python manage.py check` Closes #51
This commit is contained in:
@@ -704,6 +704,7 @@ def _run_detail_context(run: BackupRun) -> dict[str, object]:
|
||||
"stats": run_stats if isinstance(run_stats, dict) else {},
|
||||
"rsync": rsync_result,
|
||||
"rsync_command": _run_rsync_command(rsync_result),
|
||||
"rsync_bwlimit_kbps": _run_rsync_bwlimit_kbps(rsync_result),
|
||||
"failure": failure,
|
||||
"failure_summary": failure.get("message") or failure.get("summary") or "",
|
||||
"prune_result": prune_result,
|
||||
@@ -1249,6 +1250,23 @@ def _run_rsync_command(rsync_result: dict) -> list[str]:
|
||||
return [str(part) for part in command]
|
||||
|
||||
|
||||
def _run_rsync_bwlimit_kbps(rsync_result: dict) -> int:
|
||||
stored_limit = rsync_result.get("bwlimit_kbps")
|
||||
if stored_limit is not None:
|
||||
try:
|
||||
return max(0, int(stored_limit))
|
||||
except (TypeError, ValueError):
|
||||
return 0
|
||||
|
||||
for part in _run_rsync_command(rsync_result):
|
||||
if part.startswith("--bwlimit="):
|
||||
try:
|
||||
return max(0, int(part.split("=", 1)[1]))
|
||||
except ValueError:
|
||||
return 0
|
||||
return 0
|
||||
|
||||
|
||||
def _run_rsync_log_tail(rsync_result: dict, log_path: Path | None, *, max_lines: int = 30) -> list[str]:
|
||||
log_tail = rsync_result.get("log_tail")
|
||||
if isinstance(log_tail, list):
|
||||
|
||||
Reference in New Issue
Block a user