From 5617ddc4cca33578feacb6b3f871acd890aa91b7 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 22 Jan 2016 19:46:05 +0100 Subject: [PATCH] Show a warning when starting ASA8 --- gns3server/modules/qemu/qemu_vm.py | 2 ++ tests/modules/qemu/test_qemu_vm.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 24cbd41b..d8b33587 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -694,6 +694,8 @@ class QemuVM(BaseVM): log.info('QEMU VM "{name}" [{id}] has set the QEMU initrd path to {initrd}'.format(name=self._name, id=self._id, initrd=initrd)) + if "asa" in initrd: + self.project.emit("log.warning", {"message": "Warning ASA 8 is not officialy supported by GNS3 and Cisco, we recommend to use ASAv. Depending of your hardware this could not work or you could be limited to one instance."}) self._initrd = initrd @property diff --git a/tests/modules/qemu/test_qemu_vm.py b/tests/modules/qemu/test_qemu_vm.py index d047270b..103cbb14 100644 --- a/tests/modules/qemu/test_qemu_vm.py +++ b/tests/modules/qemu/test_qemu_vm.py @@ -460,6 +460,30 @@ def test_hdd_disk_image(vm, tmpdir): assert vm.hdd_disk_image == force_unix_path(str(tmpdir / "QEMU" / "test")) +def test_initrd(vm, tmpdir): + + vm.manager.config.set("Server", "images_path", str(tmpdir)) + + with patch("gns3server.modules.project.Project.emit") as mock: + vm.initrd = str(tmpdir / "test") + assert vm.initrd == force_unix_path(str(tmpdir / "test")) + vm.initrd = "test" + assert vm.initrd == force_unix_path(str(tmpdir / "QEMU" / "test")) + assert not mock.called + + +def test_initrd_asa(vm, tmpdir): + + vm.manager.config.set("Server", "images_path", str(tmpdir)) + + with patch("gns3server.modules.project.Project.emit") as mock: + vm.initrd = str(tmpdir / "asa842-initrd.gz") + assert vm.initrd == force_unix_path(str(tmpdir / "asa842-initrd.gz")) + vm.initrd = "asa842-initrd.gz" + assert vm.initrd == force_unix_path(str(tmpdir / "QEMU" / "asa842-initrd.gz")) + assert mock.called + + def test_options(linux_platform, vm): vm.kvm = False vm.options = "-usb"