mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 20:26:48 +00:00
fix(logs): a row says what happened: a recovered migration, a failed clone step, a device not there
- A migration whose libvirt call failed but which recovery finds moved (or cannot tell) gets a row of that end; only a failure already logged by migrate_instance is not logged twice. - A clone made with its resize or start failed, and a recovered migration whose autostart or NVRAM step failed, write a failed row of that step, as migrate_instance does for its later steps. - Setting the link state of an interface or the video model of a VM that has none is refused: it changed nothing and was logged as done. - The rows of a removed VM record (deleted or expired) name its host, VM and UUID, so the VM's history has them.
This commit is contained in:
parent
470cc9860e
commit
528b4492f6
14 changed files with 390 additions and 304 deletions
|
|
@ -214,13 +214,14 @@ def migrate_instance(
|
|||
compress=False,
|
||||
delete_source=False,
|
||||
disk_pools=None,
|
||||
on_moved=None,
|
||||
):
|
||||
"""Migrates instance to new_compute and logs the outcome (the mode
|
||||
used, or the error), then each later step that failed in a row of its
|
||||
own. disk_pools: {target: pool} of the disks copied into pools of
|
||||
new_compute (moveto's pools); their source files go with delete_source
|
||||
unless another VM or volume uses them, and are named in the log
|
||||
otherwise. Returns the mode."""
|
||||
own; on_moved is called once the outcome's row is written. disk_pools:
|
||||
{target: pool} of the disks copied into pools of new_compute (moveto's
|
||||
pools); their source files go with delete_source unless another VM or
|
||||
volume uses them, and are named in the log otherwise. Returns the mode."""
|
||||
source, target = instance.compute, migration_target(new_compute)
|
||||
|
||||
def log(action, error=None):
|
||||
|
|
@ -259,6 +260,8 @@ def migrate_instance(
|
|||
# The VM runs on new_compute now: what follows must not stop it
|
||||
# from being recorded there.
|
||||
log(f"migrate ({mode}) to {target}")
|
||||
if on_moved is not None: # its row is written: a later step that raises does not undo it
|
||||
on_moved()
|
||||
if autostart:
|
||||
conn_new = None
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue