core-admin/qubes/vm
Marek Marczykowski-Górecki 018877a19c
vm: avoid starting the same VM multiple times simultaneously
While libvirt handle locking itself, there is also Qubes-specific
startup part. Especially starting qrexec-daemon and waiting until
qrexec-agent connect to it. When someone will attempt to start VM the
second time (or simply assume it's already running) - qrexec will not be
connected yet and the operation will fail. Solve the problem by wrapping
the whole vm.start() function with a lock, including a check if VM is
running and waiting for qrexec.

Also, do not throw exception if VM is already running.

This way, after a call to vm.start(), VM will be started with qrexec
connected - regardless of who really started it.
Note that, it will not solve the situation when someone check if VM is
running manually, like:

    if not vm.is_running():
        yield from vm.start()

Such code should be changed to simply:

    yield from vm.start()

Fixes QubesOS/qubes-issues#2001
Fixes QubesOS/qubes-issues#2666
2017-06-05 23:38:30 +02:00
..
mix vm/net: fix IP address calculation 2017-05-17 11:17:22 +02:00
__init__.py admin-api: fix handling admin.vm.property.Set with None VM value 2017-05-26 15:08:18 +02:00
adminvm.py Fix miscellaneous warnings 2017-05-29 17:34:15 +02:00
appvm.py tools: remove qvm-ls tool and related integration in qubes.property 2017-05-12 14:25:27 +02:00
dispvm.py tools: remove qvm-ls tool and related integration in qubes.property 2017-05-12 14:25:27 +02:00
qubesvm.py vm: avoid starting the same VM multiple times simultaneously 2017-06-05 23:38:30 +02:00
standalonevm.py qubes: port core to python3 2017-01-20 16:42:51 +01:00
templatevm.py qubes: port core to python3 2017-01-20 16:42:51 +01:00