mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(vmbackups): a backup restored over its VM again takes the next free name
The copies were named from the VM, the disk and the backup's minute only. Restoring the same backup over the VM a second time, or a second backup of the same minute, chose the name of the disk the VM already ran from, and the job refused it. The names are now chosen at submission, numbered from 2 when the pool has one, and kept in the job's intent apart from the VM state the job checks again before and after the copies.
This commit is contained in:
parent
8cd7aee19a
commit
fb6a427a47
4 changed files with 63 additions and 29 deletions
|
|
@ -28,7 +28,7 @@ from vrtManager.connection import wvmConnect
|
|||
from vrtManager.util import OperationError
|
||||
|
||||
from .forms import PolicyForm, RestoreDiskForm, RestoreForm, TargetForm, TargetPoolForm
|
||||
from .jobs import _over_plan, _proxy, _vm_pool
|
||||
from .jobs import _over_names, _over_plan, _proxy, _vm_pool
|
||||
from .models import Backup, BackupPolicy, BackupTarget
|
||||
from .utils import inside_vm_pool, pending_deletes
|
||||
|
||||
|
|
@ -283,11 +283,13 @@ def restore_over(request, uuid):
|
|||
return redirect("operations:job", op.pk)
|
||||
over, problem = None, None
|
||||
try:
|
||||
over = _over_plan(backup, _proxy(backup.instance), owner=not request.user.is_superuser)
|
||||
proxy = _proxy(backup.instance)
|
||||
over = _over_plan(backup, proxy, owner=not request.user.is_superuser)
|
||||
names = _over_names(backup, proxy, over)
|
||||
except (OperationError, libvirtError) as err:
|
||||
problem = error_text(request, err)
|
||||
disks = [{"dev": dev, "old": over["old"][dev], "pool": pool, "name": name}
|
||||
for dev, (pool, name) in sorted(over["disks"].items())] if over else []
|
||||
disks = [{"dev": dev, "old": over["old"][dev], "pool": pool, "name": names[dev]}
|
||||
for dev, pool in sorted(over["disks"].items())] if over else []
|
||||
return render(request, "vmbackups/restore_over.html", {"backup": backup, "disks": disks, "over": over,
|
||||
"problem": problem})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue