2

Year after year, I keep wondering (to put it lightly), who did name the restart function of virsh "destroy", and why.

It seems to me to be a complete -head thing to do; but it must have made sense to somebody, and I would like to understand the rationale.

The VM instance is forcefully shutdown, its memory freed. The VM configuration is not destroyed. The images/virtual disks/filesystems are not destroyed (except for possible corruption, as @DavidPostill pointed out).

So what is destroyed?

The KVM API itself uses restart/*"_RESTART", as one would expect, so the naming is not derived from the next layer.

Any insights to this?

Also, it is kept this way. Is there a conceptual idea behind that, or is this just kept for historical reasons?

foo
  • 161
  • 1
  • 8
  • `force-off` may have been better. Many Linux programs have quirks like this. If it helps, you can think of it like this `Destroy the running state. Destroy and release the Ram` – Sepero Aug 29 '23 at 16:05

1 Answers1

1

Who did name the restart function of virsh "destroy", and why?

They didn't. To restart a VM the reboot command is used:

To restart a vm named test, the command used is:

sudo virsh reboot test

So what is destroy used for?

You can do a forceful shutdown of active domain using the command:

$ sudo virsh destroy test

Source: Virsh commands cheatsheet to manage KVM guest virtual machines | ComputingForGeeks

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
  • Thank you for the differentiation. Still, the question remains: why "destroy"? The active domain is (forcefully) shutdown, not destroyed; the VM configuration is not destroyed, rather still unchanged; the images are not destroyed, and unchanged as well. – foo Jan 25 '23 at 16:05
  • `shutdown` was already used for a non-forced shutdown ... so they had to choose another word. – DavidPostill Jan 25 '23 at 16:12
  • Note that "Using `virsh destroy` can corrupt guest virtual machine file systems" which does destroy them if it happens. – DavidPostill Jan 25 '23 at 16:13
  • `shutdown --force`, `force-shutdown`, `hardreset` etc. would have been available.I get your point about the corruption of filesystems; but that's not the intended action. – foo Jan 25 '23 at 16:43