SVL-PSU / crete-dev

CRETE under development
Other
58 stars 15 forks source link

[qemu/vm-node] QEMU does not terminate when parent vm-node terminates #9

Open moralismercatus opened 7 years ago

moralismercatus commented 7 years ago

Note: distributed mode specific.

When vm-node terminates for whatever reason (testing is done, ctrl+c, crash) its QEMU children go on living as daemons. In general, this behavior is undesirable, as future tests on the images corresponding to these daemons can cause image corruption.

For development purposes, such behavior may be desirable e.g., to observe output from crete-run; however, development mode should be of use in that case.

I don't believe an adequate solution is to rely on vm-node to kill its QEMU children. Only when vm-node exits gracefully do the proper destructors get called which can do the infanticide.

Potential solution:

A Linux specific solution is to call prctl(PR_SET_PDEATHSIG, SIGHUP); from within QEMU. The kernel will then notify QEMU when its parent has died.