VM Manager: "Remove VM & Disks" destroys the whole share dataset (e.g. cache/domains) when the VM folder is a plain directory on ZFS
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
Read my_rmdir() in emhttp/plugins/dynamix/include/Helpers.php around lines 466–486, then trace its caller domain_delete() in emhttp/plugins/dynamix.vm.manager/include/libvirt.php around lines 1766–1786. Compare the ZFS handling with the my_mkdir() fix in #1968. Done means deleting a VM in a plain directory preserves the containing share dataset, while deleting an empty dataset mountpoint still removes that dataset; an open linked pull request (#2793) already addresses this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
VMs → Remove VM & Disks destroys the whole share dataset (e.g. cache/domains) when the VM's folder on a ZFS pool is a plain directory rather than its own dataset. Every other file in that share's dataset is destroyed with it, including the vdisks of other VMs that are stopped.
my_rmdir() runs zfs list -H -o name <dir>, which for a plain directory returns the dataset that contains it (the share), and then runs zfs destroy on that name.
Where
domain_delete()deletes the first vdisk, then callsmy_rmdir()on the VM's folder once it is empty: libvirt.php#L1766-L1786my_rmdir(), ZFS case: Helpers.php#L466-L486
case "zfs":
$zfsdataset = trim(shell_exec("zfs list -H -o name ".escapeshellarg($dirname))) ;
$cmdstr = "zfs destroy \"$zfsdataset\" 2>&1 ";
The same assumption was fixed in my_mkdir() in #1968 ("Fix for dir not a dataset"), which now falls back to mkdir when the parent is not a dataset. my_rmdir() has no such check.
What happened (Unraid 7.1.1)
- The pool
cacheis a ZFS mirror, and the sharedomains(primary storagecache, cache only) is the datasetcache/domains. - The VM
Ubuntu-20.04-researchwas created in 2024. Its folder/mnt/cache/domains/Ubuntu-20.04-researchwas a plain directory, not a dataset, and held one vdisk. It was the only VM. - I used Remove VM & Disks (the same
domain-deleterequest with the VM's UUID thatvmmanager.jssends). The response was{"success":true}. - Result:
cache/domainsno longer existed inzfs list, and/mnt/user/domainswas gone. The share'sdomains.cfgwas left behind.
The VM's log shows the destroy of the share's dataset:
delete empty zfs /mnt/user/domains/Ubuntu-20.04-research 0
dataset cache/domains
Command zfs destroy 'cache/domains' 2>&1
Output end
Nothing else was lost here, because this was the only VM in the share. With other stopped VMs in the same dataset, zfs destroy would succeed as well and take their vdisks with it. Only a busy dataset (a running VM) makes it fail.
The lookup behaviour is easy to confirm on any ZFS pool:
# zfs list -H -o name /mnt/cache/appdata/Jellyfin # a plain directory inside the appdata dataset
cache/appdata
Steps to reproduce
- On a ZFS pool, make sure the share
domainsis a dataset, e.g.cache/domains. - Create a plain directory in it (
mkdir /mnt/cache/domains/test), put a small vdisk in it, and define a VM that uses only that vdisk. VM folders created before a pool became ZFS, or by hand, are in this state. - Optionally add a second, stopped VM with its vdisk in another folder of the same share.
- VMs → the test VM → Remove VM & Disks.
zfs list:cache/domainsis gone, and so is the second VM's vdisk.
Expected
Destroy a dataset only if the directory itself is a dataset's mountpoint. Otherwise rmdir() the empty directory. For example:
case "zfs":
[$zfsdataset, $mountpoint] = array_pad(explode("\t", trim(shell_exec("zfs list -H -o name,mountpoint ".escapeshellarg($dirname)))), 2, '');
if ($zfsdataset && realpath($mountpoint) === realpath($dirname)) {
exec("zfs destroy ".escapeshellarg($zfsdataset)." 2>&1", $zfsoutput, $rtncode);
} else {
$rtncode = rmdir($dirname) ? 0 : 1; // a plain directory: never touch the parent dataset
}
Environment
- Unraid 7.1.1 (observed). The code is unchanged on
masterat 26eb1b5. - Cache pool: a 2-device ZFS mirror.
- Lenguaje dominante
- PHP
- Estrellas
- 266
- Forks
- 116
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 4
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 unraid/webgui
-
CPU core labels missing for Low-Power E-cores on hybrid Intel CPUs (Arrow Lake-H) — get_intel_core_types() ignores /sys/devices/cpu_lowpowerPosiblemente ocupada @dgongut la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
unraid/webgui#2785 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
rsyslog_config: "Mirror syslog to flash" rule is appended again on every Apply — each line written to the boot device N timesPosiblemente ocupada @junkerderprovinz la tomó hace 38 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
Notification e-mails are sent without Date and Message-ID headersPosiblemente ocupada @nofuturekid la tomó hace 56 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
unraid/webgui#2781 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Static asset caching misses the Connect plugin's hashed bundle: ~144 JS chunks (8.5 MB) revalidate on every page loadPosiblemente ocupada @davidcoulson la tomó hace 54 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
Todos los issues de unraid/webgui
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
sonata-project/SonataAdminBundle#8426 ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
erkamyaman/rust-anything#942 ·
Los mantenedores suelen responder en 1 día
-
area/plugins area/tests type/enhancement when/later
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día