def stop(self):
        """
        Stops this QEMU VM.
        """

        yield from self._stop_ubridge()
        with (yield from self._execute_lock):
            # stop the QEMU process
            self._hw_virtualization = False
            if self.is_running():
                log.info('Stopping QEMU VM "{}" PID={}'.format(self._name, self._process.pid))
                try:
                    if self.acpi_shutdown:
                        yield from self._control_vm("system_powerdown")
                        yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=30)
                    else:
                        self._process.terminate()
                        yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=3)
                except ProcessLookupError:
                    pass
                except asyncio.TimeoutError:
                    if self._process:
                        try:
                            self._process.kill()
                        except ProcessLookupError:
                            pass
                        if self._process.returncode is None:
                            log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid))
            self._process = None
            self._stop_cpulimit()
            yield from super().stop()
def stop ( self ) : yield from self . _stop_ubridge ( ) with ( yield from self . _execute_lock ) : self . _hw_virtualization = False if self . is_running ( ) : log . info ( 'Stopping QEMU VM "{}" PID={}' . format ( self . _name , self . _process . pid ) ) try : if self . acpi_shutdown : yield from self . _control_vm ( "system_powerdown" ) yield from gns3server . utils . asyncio . wait_for_process_termination ( self . _process , timeout = 30 ) else : self . _process . terminate ( ) yield from gns3server . utils . asyncio . wait_for_process_termination ( self . _process , timeout = 3 ) except ProcessLookupError : pass except asyncio . TimeoutError : if self . _process : try : self . _process . kill ( ) except ProcessLookupError : pass if self . _process . returncode is None : log . warn ( 'QEMU VM "{}" PID={} is still running' . format ( self . _name , self . _process . pid ) ) self . _process = None self . _stop_cpulimit ( ) yield from super ( ) . stop ( )
Stops this QEMU VM.