Raise error if using a non linked clone VM twice

Fix https://github.com/GNS3/gns3-gui/issues/1593
This commit is contained in:
Julien Duponchelle committed 2016-10-24 21:39:35 +02:00
1 parent 597e1e618d
commit ae1e027031
20 files changed
+100 -54

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ from unittest.mock import patch, MagicMock, PropertyMock, call
from gns3server.config import Config
@pytest.fixture(scope="module")
@pytest.fixture()
def manager(port_manager):
m = Docker.instance()
m.port_manager = port_manager
@@ -28,7 +28,7 @@ from gns3server.compute.dynamips.dynamips_error import DynamipsError
from unittest.mock import patch
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = Dynamips.instance()
m.port_manager = port_manager
@@ -26,7 +26,7 @@ from gns3server.compute.dynamips import Dynamips
from gns3server.config import Config
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = Dynamips.instance()
m.port_manager = port_manager
+1 -1
View File
@@ -39,7 +39,7 @@ if not sys.platform.startswith("win"):
from gns3server.config import Config
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = IOU.instance()
m.port_manager = port_manager
+17 -1
View File
@@ -35,7 +35,7 @@ from gns3server.utils import force_unix_path, macaddress_to_int, int_to_macaddre
from gns3server.compute.notification_manager import NotificationManager
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = Qemu.instance()
m.port_manager = port_manager
@@ -601,6 +601,22 @@ def test_hda_disk_image(vm, images_dir):
assert vm.hda_disk_image == force_unix_path(os.path.join(images_dir, "QEMU", "test2"))
def test_hda_disk_image_non_linked_clone(vm, images_dir, project, manager, fake_qemu_binary, fake_qemu_img_binary):
"""
Two non linked can't use the same image at the same time
"""
open(os.path.join(images_dir, "test1"), "w+").close()
vm.linked_clone = False
vm.hda_disk_image = os.path.join(images_dir, "test1")
vm.manager._nodes[vm.id] = vm
vm2 = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0eaa", project, manager, qemu_path=fake_qemu_binary)
vm2.linked_clone = False
with pytest.raises(QemuError):
vm2.hda_disk_image = os.path.join(images_dir, "test1")
def test_hda_disk_image_ova(vm, images_dir):
os.makedirs(os.path.join(images_dir, "QEMU", "test.ovf"))
+1 -1
View File
@@ -30,7 +30,7 @@ from gns3server.compute.error import NodeError
from gns3server.compute.vpcs import VPCS
@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def manager(port_manager):
m = VPCS.instance()
m.port_manager = port_manager
+1 -1
View File
@@ -33,7 +33,7 @@ from gns3server.compute.vpcs import VPCS, VPCSVM
from gns3server.config import Config
@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def manager(port_manager):
m = VPCS.instance()
m.port_manager = port_manager
@@ -30,7 +30,7 @@ from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
from tests.utils import asyncio_patch
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = VirtualBox.instance()
m.port_manager = port_manager
@@ -24,7 +24,7 @@ from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
from gns3server.compute.virtualbox import VirtualBox
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = VirtualBox.instance()
m.port_manager = port_manager
+1 -1
View File
@@ -29,7 +29,7 @@ from gns3server.compute.vmware import VMware
from tests.utils import asyncio_patch
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = VMware.instance()
m.port_manager = port_manager
+1 -1
View File
@@ -24,7 +24,7 @@ from gns3server.compute.vmware.vmware_error import VMwareError
from gns3server.compute.vmware import VMware
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = VMware.instance()
m.port_manager = port_manager
+1 -1
View File
@@ -31,7 +31,7 @@ from gns3server.compute.vpcs import VPCS
from gns3server.compute.notification_manager import NotificationManager
@pytest.fixture(scope="module")
@pytest.fixture
def manager(port_manager):
m = VPCS.instance()
m.port_manager = port_manager