Interrupted running-VM volume snapshot leaves the VM on an orphan overlay, disk reverts on next start
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 15/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- backend, infrastructure
Línea de trabajo
Start in KVMStorageProcessor, following the volume snapshot path to mergeSnapshotIntoBaseFileWithoutEvents(), and check how Script.runScript() turns a non-zero virsh blockcommit exit into a null result. Agent death is handled in Agent.java at the ReadyCommand System.exit(1). Done means a failed merge fails the snapshot rather than marking it BackedUp, and the design for recovering from an orphan overlay is agreed in the thread first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
problem
A volume snapshot (non-incremental) of a running VM does three steps in KVMStorageProcessor:
snapshotCreateXML(DISK_ONLY)moves the disk onto a new overlay/mnt/<pool>/<random uuid>(instant).qemu-img convertcopies the frozen base to the snapshot location (minutes to hours, depends on volume size).virsh blockcommit --active --wait --pivotmerges the overlay back into the base.
If step 3 never starts, the VM keeps running on the overlay while volumes.path still points to the base.
The next stop/start builds the domain from volumes.path, so every write since the snapshot started is silently
lost (it only exists in the orphan overlay). After a start the base is written again, so the overlay can no longer
simply be committed back.
There are two ways step 3 never starts.
A. The agent JVM goes away during the convert.
- SIGKILL / OOM kill of the agent.
- The agent's own
System.exit(1)inAgent.java(ReadyCommand with details) after a failed reconnect. Reproduced by
making the management server fail the reconnect withUnable to acquire lock on hostwhile the convert was running.
B. virsh blockcommit fails before the job starts, and the failure is reported as success.
Script.runScript() returns null when execute() returns an error, so mergeSnapshotIntoBaseFileWithoutEvents()
gets null for any non-zero exit and logs Successfully merged snapshot. The snapshot ends BackedUp.
Reproduced with:
- a NAS backup (
backup-begin) started during the convert and still running at merge time:
Operation not supported: disk 'vdb' already in active block job; - the domain job held by another operation for more than 30 s:
Timed out during operation: cannot acquire state change lock.
NAS backups do not go through the VM work queue and do not check for volumes in Snapshotting, so nothing prevents
this overlap.
versions
ACS 4.20+
The steps to reproduce the bug
- Running VM with a data disk on NFS, write some data so the convert takes a while.
- Take a volume snapshot of the data disk.
- As soon as
virsh domblklistshows the disk on a new bare-UUID file, either:kill -9the agent JVM; or- start a backup:
virsh backup-begin <vm>(push or pull mode) and keep it running until the merge.
- Write data in the guest, then stop and start the VM from CloudStack.
What to do about it?
Expected:
The merge either completes, or the snapshot fails and the VM is not left on an overlay that CloudStack does not track.
Actual:
The VM runs on /mnt/<pool>/<uuid> (backing file = the volume). Case B logs:
WARN Process [N] for command [/bin/bash -c virsh blockcommit <vm> vdb --base ... --pivot ] encountered the error: [error: Operation not supported: disk 'vdb' already in active block job].
DEBUG Successfully merged snapshot [<overlay uuid>] into VM [<vm>] ...
Later snapshots of the volume fail with VM [...] has no disk with path [<base>].
After stop/start the guest reads the data from the time the snapshot started.
Proposed fix
- Detect merge failures. Make
Script.runScript()(or at least the merge call) return an error on a non-zero
exit. After the merge, check that the domain disk source is the base path again. If the disk has another block
job, wait and retry the commit. If it still fails, fail the snapshot with a clear error instead of BackedUp. - Recover after agent death. Before creating the overlay, write a marker (vm, disk, base, overlay) on the shared primary pool, keyed by volume. On every VM start, and on agent start once the pools are mounted, any host that finds a marker reconciles the volume:
- Domain still running on the overlay: run blockcommit --active --pivot, or pivot the commit job that is already running.
- Domain gone: commit the overlay offline with qemu-img commit, then start.
- Overlay still locked by a live qemu: refuse to start.
- Base written since the marker: never commit, raise an alert and keep the overlay.
Remove the marker only after domblklist shows the base path again.
- Do not exit with commands in progress. On a ReadyCommand with details, reconnect (as
isExitOnFailures()=false
already does) instead ofSystem.exit(1), at least while commands are in progress. - Serialize NAS backups with volume snapshots of the same VM (VM work queue or refuse while a volume is
Snapshotting).
- Lenguaje dominante
- Java
- Estrellas
- 3.1k
- Forks
- 1.4k
- Merge medio
- 7 d 16 h
- PR fusionados (30 d)
- 15
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/cloudstack
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new sizePosiblemente ocupada @bhouse-nexthop la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/cloudstack#14645 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replacedPosiblemente ocupada @bhouse-nexthop la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/cloudstack#14633 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)Posiblemente ocupada @bhouse-nexthop la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/cloudstack#14631 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/cloudstack#14625 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)Posiblemente ocupada @willbennett-devops la tomó hace 12 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/cloudstack#14545 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/cloudstack
Issues similares
-
[FEATURE] Expose external refresh, node-level translog and warmer statsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertountriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
-
Good First Issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
hiero-ledger/hiero-sdk-java#3059 ·
Los mantenedores suelen responder en 1 día