|
|
@ -53,6 +53,12 @@ from ...utils import macaddress_to_int, int_to_macaddress, is_ipv6_enabled
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# forbidden additional options
|
|
|
|
|
|
|
|
FORBIDDEN_OPTIONS = {"-blockdev", "-drive", "-hda", "-hdb", "-hdc", "-hdd",
|
|
|
|
|
|
|
|
"-fsdev", "-virtfs"}
|
|
|
|
|
|
|
|
FORBIDDEN_OPTIONS |= {"-" + opt for opt in FORBIDDEN_OPTIONS
|
|
|
|
|
|
|
|
if opt.startswith("-") and not opt.startswith("--")}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QemuVM(BaseNode):
|
|
|
|
class QemuVM(BaseNode):
|
|
|
|
module_name = 'qemu'
|
|
|
|
module_name = 'qemu'
|
|
|
@ -2424,9 +2430,19 @@ class QemuVM(BaseNode):
|
|
|
|
command.extend(self._tpm_options())
|
|
|
|
command.extend(self._tpm_options())
|
|
|
|
if additional_options:
|
|
|
|
if additional_options:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
command.extend(shlex.split(additional_options))
|
|
|
|
additional_opt_list = shlex.split(additional_options)
|
|
|
|
except ValueError as e:
|
|
|
|
except ValueError as e:
|
|
|
|
raise QemuError("Invalid additional options: {} error {}".format(additional_options, e))
|
|
|
|
raise QemuError("Invalid additional options: {} error {}".format(additional_options, e))
|
|
|
|
|
|
|
|
allow_unsafe_options = self.manager.config.get_section_config("Qemu").getboolean(
|
|
|
|
|
|
|
|
"allow_unsafe_options",
|
|
|
|
|
|
|
|
False
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if allow_unsafe_options is False:
|
|
|
|
|
|
|
|
for opt in additional_opt_list:
|
|
|
|
|
|
|
|
if opt in FORBIDDEN_OPTIONS:
|
|
|
|
|
|
|
|
raise QemuError("Forbidden additional option: {}".format(opt))
|
|
|
|
|
|
|
|
command.extend(additional_opt_list)
|
|
|
|
|
|
|
|
|
|
|
|
# avoiding mouse offset (see https://github.com/GNS3/gns3-server/issues/2335)
|
|
|
|
# avoiding mouse offset (see https://github.com/GNS3/gns3-server/issues/2335)
|
|
|
|
if self._console_type == "vnc":
|
|
|
|
if self._console_type == "vnc":
|
|
|
|
command.extend(['-machine', 'usb=on', '-device', 'usb-tablet'])
|
|
|
|
command.extend(['-machine', 'usb=on', '-device', 'usb-tablet'])
|
|
|
|