what does "virsh destroy" really ?

Hi, what does "virsh destroy" with the domain ? Send a kill -9 to the process ? Bernd -- Bernd Lentes Systemadministration Institute for Metabolism and Cell Death (MCD) Building 25 - office 122 HelmholtzZentrum München bernd.lentes@helmholtz-muenchen.de phone: +49 89 3187 1241 phone: +49 89 3187 3827 fax: +49 89 3187 2294 http://www.helmholtz-muenchen.de/mcd stay healthy Helmholtz Zentrum München Helmholtz Zentrum München

On 2020-10-05 6:04 p.m., Lentes, Bernd wrote:
Hi,
what does "virsh destroy" with the domain ? Send a kill -9 to the process ?
Bernd
It forces the guest off, like pulling the power on a hardware machine. Not sure of the exact mechanism behind the scenes. It does leave the server defined and you can reboot it again later (albeit like restoring power to a normal machine, so it might need to replay journals, etc). -- Digimer Papers and Projects: https://alteeve.com/w/ "I am, somehow, less interested in the weight and convolutions of Einstein’s brain than in the near certainty that people of equal talent have lived and died in cotton fields and sweatshops." - Stephen Jay Gould

On Mon, Oct 05, 2020 at 07:12:34PM -0400, Digimer wrote:
On 2020-10-05 6:04 p.m., Lentes, Bernd wrote:
Hi,
what does "virsh destroy" with the domain ? Send a kill -9 to the process ?
Bernd
It forces the guest off, like pulling the power on a hardware machine. Not sure of the exact mechanism behind the scenes. It does leave the server defined and you can reboot it again later (albeit like restoring power to a normal machine, so it might need to replay journals, etc).
The technical details should not matter, but it tries to send "quit" to QEMU and falls back to killing it IIRC (firsh with SIGTERM and then with SIGKILL). Don't do that if you want to use the machine again ;-)
-- Digimer Papers and Projects: https://alteeve.com/w/ "I am, somehow, less interested in the weight and convolutions of Einstein’s brain than in the near certainty that people of equal talent have lived and died in cotton fields and sweatshops." - Stephen Jay Gould

On Tue, Oct 06, 2020 at 09:15:57AM +0200, Martin Kletzander wrote:
On Mon, Oct 05, 2020 at 07:12:34PM -0400, Digimer wrote:
On 2020-10-05 6:04 p.m., Lentes, Bernd wrote:
Hi,
what does "virsh destroy" with the domain ? Send a kill -9 to the process ?
Bernd
It forces the guest off, like pulling the power on a hardware machine. Not sure of the exact mechanism behind the scenes. It does leave the server defined and you can reboot it again later (albeit like restoring power to a normal machine, so it might need to replay journals, etc).
The technical details should not matter, but it tries to send "quit" to QEMU and falls back to killing it IIRC (firsh with SIGTERM and then with SIGKILL). Don't do that if you want to use the machine again ;-)
You don't need to be so scared of virsh destroy. It is simply akin to pulling out the power plug, and modern OS with a decent journaling filesystem will recover from that quite reasonably. Sure you'll loose state of what's running, but 99% of the time your guest will boot up again just fine. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On 06.10.20 10:16, Daniel P. Berrangé wrote:
You don't need to be so scared of virsh destroy. It is simply akin to pulling out the power plug, and modern OS with a decent journaling filesystem will recover from that quite reasonably. Sure you'll loose state of what's running, but 99% of the time your guest will boot up again just fine.
In case one of our (many) VMs crash we "destroy" it. We never experiencend any Problem you would not expect in case of physical server crashes. Over the last 10 years this happened more than 1000 times... Michael

On Tue, Oct 06, 2020 at 10:22:03AM +0200, Michael Hierweck wrote:
On 06.10.20 10:16, Daniel P. Berrangé wrote:
You don't need to be so scared of virsh destroy. It is simply akin to pulling out the power plug, and modern OS with a decent journaling filesystem will recover from that quite reasonably. Sure you'll loose state of what's running, but 99% of the time your guest will boot up again just fine.
In case one of our (many) VMs crash we "destroy" it. We never experiencend any Problem you would not expect in case of physical server crashes.
Over the last 10 years this happened more than 1000 times...
I was a bit too harsh when saying you should not use it. Of course when the VM is not running then destroy gets rid of the process. In case it helps, you can also set what libvirt is supposed to do when the VM crashes (at least visibly for libvirt, not when something inside the guest crashes) using the <on_crash/> element [0]. Have a nice day, Martin [0] https://libvirt.org/formatdomain.html#events-configuration
Michael

----- Am 6. Okt 2020 um 1:12 schrieb Digimer lists@alteeve.ca:
On 2020-10-05 6:04 p.m., Lentes, Bernd wrote:
Hi,
what does "virsh destroy" with the domain ? Send a kill -9 to the process ?
Bernd
It forces the guest off, like pulling the power on a hardware machine. Not sure of the exact mechanism behind the scenes. It does leave the server defined and you can reboot it again later (albeit like restoring power to a normal machine, so it might need to replay journals, etc).
Hi, I know what it does, i'd like to know _how_ it does it. Maybe i have to look in the source code, although i'm not a big code reader and much less a code developer. Where can i find it ? Bernd Helmholtz Zentrum München Helmholtz Zentrum München
participants (5)
-
Daniel P. Berrangé
-
Digimer
-
Lentes, Bernd
-
Martin Kletzander
-
Michael Hierweck