mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-19 07:48:10 +00:00
Calculate MD5 on thread and before json response, Ref. gui#2239
This commit is contained in:
@ -32,7 +32,7 @@ import gns3server
|
||||
import subprocess
|
||||
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import subprocess_check_output, wait_run_in_executor
|
||||
from gns3server.utils.asyncio import subprocess_check_output, cancellable_wait_run_in_executor
|
||||
from .qemu_error import QemuError
|
||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
@ -873,6 +873,22 @@ class QemuVM(BaseNode):
|
||||
except (OSError, subprocess.SubprocessError) as e:
|
||||
raise QemuError("Could not throttle CPU: {}".format(e))
|
||||
|
||||
@asyncio.coroutine
|
||||
def create(self):
|
||||
"""
|
||||
Creates QEMU VM and sets proper MD5 hashes
|
||||
"""
|
||||
|
||||
# In case user upload image manually we don't have md5 sums.
|
||||
# We need generate hashes at this point, otherwise they will be generated
|
||||
# at __json__ but not on separate thread.
|
||||
yield from cancellable_wait_run_in_executor(md5sum, self._hda_disk_image)
|
||||
yield from cancellable_wait_run_in_executor(md5sum, self._hdb_disk_image)
|
||||
yield from cancellable_wait_run_in_executor(md5sum, self._hdc_disk_image)
|
||||
yield from cancellable_wait_run_in_executor(md5sum, self._hdd_disk_image)
|
||||
|
||||
super(QemuVM, self).create()
|
||||
|
||||
@asyncio.coroutine
|
||||
def start(self):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user