Prevent users to add links to running Qemu VMs and start a capture on running VirtualBox VMs.

This commit is contained in:
grossmj committed 2015-05-27 13:56:27 -06:00
1 parent 91c0f05a4e
commit 0476f2932e
3 files changed
+9 -2

No files matched your search

@@ -851,6 +851,7 @@ class VirtualBoxVM(BaseVM):
adapter_number=adapter_number))
return nio
@asyncio.coroutine
def start_capture(self, adapter_number, output_file):
"""
Starts a packet capture.
@@ -865,6 +866,10 @@ class VirtualBoxVM(BaseVM):
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
adapter_number=adapter_number))
vm_state = yield from self._get_vm_state()
if vm_state == "running" or vm_state == "paused" or vm_state == "stuck":
raise VirtualBoxError("Sorry, packet capturing on a started VirtualBox VM is not supported.")
nio = adapter.get_nio(0)
if nio.capturing:
raise VirtualBoxError("Packet capture is already activated on adapter {adapter_number}".format(adapter_number=adapter_number))