mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Merge branch '1.4' into 1.5
This commit is contained in:
commit
7e196cabc1
@ -1 +0,0 @@
|
|||||||
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/noplay/code/gns3/gns3-server/gns3server/modules/docker/docker_vm.py": [20, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 34, 35, 38, 46, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 77, 82, 89, 91, 92, 93, 94, 95, 97, 101, 102, 103, 104, 105, 106, 109, 112, 113, 114, 115, 116, 118, 122, 123, 124, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 142, 143, 144, 145, 146, 147, 148, 149, 155, 156, 157, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 197, 198, 199, 215, 216, 217, 273, 274, 275, 285, 286, 287, 291, 292, 298, 299, 300, 301, 302, 303, 304, 306, 307, 308, 332, 333, 334, 339, 340, 341, 342, 343, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360], "/Users/noplay/code/gns3/gns3-server/gns3server/modules/docker/__init__.py": [20, 22, 23, 24, 25, 26, 27, 29, 31, 32, 33, 34, 37, 39, 41, 42, 44, 45, 47, 48, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 72, 79, 80, 81, 82, 83], "/Users/noplay/code/gns3/gns3-server/gns3server/modules/docker/docker_error.py": [20, 22, 25, 26]}}
|
|
@ -22,8 +22,10 @@ master
|
|||||||
master is the next stable release, you can test it in your day to day activities.
|
master is the next stable release, you can test it in your day to day activities.
|
||||||
Bug fixes or small improvements pull requests go here.
|
Bug fixes or small improvements pull requests go here.
|
||||||
|
|
||||||
unstable
|
1.x (1.4 for example)
|
||||||
********
|
********
|
||||||
|
Next major release
|
||||||
|
|
||||||
*Never* use this branch for production. Pull requests for major new features go here.
|
*Never* use this branch for production. Pull requests for major new features go here.
|
||||||
|
|
||||||
Linux
|
Linux
|
||||||
|
@ -459,6 +459,13 @@ class Project:
|
|||||||
|
|
||||||
self._listeners.remove(queue)
|
self._listeners.remove(queue)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def listeners(self):
|
||||||
|
"""
|
||||||
|
List of current clients listening for event in this projects
|
||||||
|
"""
|
||||||
|
return self._listeners
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def list_files(self):
|
def list_files(self):
|
||||||
"""
|
"""
|
||||||
|
@ -748,6 +748,9 @@ class QemuVM(BaseVM):
|
|||||||
Changes the process priority
|
Changes the process priority
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if self._process_priority == "normal":
|
||||||
|
return
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
try:
|
try:
|
||||||
import win32api
|
import win32api
|
||||||
@ -756,7 +759,7 @@ class QemuVM(BaseVM):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
log.error("pywin32 must be installed to change the priority class for QEMU VM {}".format(self._name))
|
log.error("pywin32 must be installed to change the priority class for QEMU VM {}".format(self._name))
|
||||||
else:
|
else:
|
||||||
log.info("setting QEMU VM {} priority class to BELOW_NORMAL".format(self._name))
|
log.info("Setting QEMU VM {} priority class to {}".format(self._name, self._process_priority))
|
||||||
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, 0, self._process.pid)
|
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, 0, self._process.pid)
|
||||||
if self._process_priority == "realtime":
|
if self._process_priority == "realtime":
|
||||||
priority = win32process.REALTIME_PRIORITY_CLASS
|
priority = win32process.REALTIME_PRIORITY_CLASS
|
||||||
|
@ -123,7 +123,7 @@ QEMU_CREATE_SCHEMA = {
|
|||||||
},
|
},
|
||||||
"boot_priority": {
|
"boot_priority": {
|
||||||
"description": "QEMU boot priority",
|
"description": "QEMU boot priority",
|
||||||
"enum": ["c", "d"]
|
"enum": ["c", "d", "n", "cn", "cd"]
|
||||||
},
|
},
|
||||||
"ram": {
|
"ram": {
|
||||||
"description": "amount of RAM in MB",
|
"description": "amount of RAM in MB",
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
|
|
||||||
<a href="/backup/projects.tar">Backup projects</a>
|
<a href="/backup/projects.tar">Backup projects</a>
|
||||||
|
|
|
|
||||||
<a href="/backup/projects.tar">Status</a>
|
<a href="/status">Status</a>
|
||||||
</div>
|
</div>
|
||||||
{% block body %}{% endblock %}
|
{% block body %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
@ -6,11 +6,23 @@
|
|||||||
The purpose of this page is to help for GNS3 debug.
|
The purpose of this page is to help for GNS3 debug.
|
||||||
|
|
||||||
<h2>Opened projects</h2>
|
<h2>Opened projects</h2>
|
||||||
<ul>
|
<table border="1">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>ID</td>
|
||||||
|
<th>VMs</th>
|
||||||
|
<th>Clients connected</th>
|
||||||
|
</tr>
|
||||||
{% for project in project_manager.projects %}
|
{% for project in project_manager.projects %}
|
||||||
<li>{{project.name}} ({{project.id}})</li>
|
<tr>
|
||||||
|
<td>{{project.name}}</td>
|
||||||
|
<td>{{project.id}}</td>
|
||||||
|
<td>{{project.vms|length}}</td>
|
||||||
|
<td>{{project.listeners|length}}</td>
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<h2>Ports reserved by GNS3</h2>
|
<h2>Ports reserved by GNS3</h2>
|
||||||
<h3>TCP</h3>
|
<h3>TCP</h3>
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
from tests.utils import asyncio_patch
|
from tests.utils import asyncio_patch
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
@ -76,6 +77,7 @@ def test_vpcs_nio_create_udp(server, vm):
|
|||||||
assert response.json["type"] == "nio_udp"
|
assert response.json["type"] == "nio_udp"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
def test_vpcs_nio_create_tap(server, vm, ethernet_device):
|
def test_vpcs_nio_create_tap(server, vm, ethernet_device):
|
||||||
with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
|
with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
|
||||||
response = server.post("/projects/{project_id}/vpcs/vms/{vm_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_tap",
|
response = server.post("/projects/{project_id}/vpcs/vms/{vm_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_tap",
|
||||||
|
@ -31,6 +31,7 @@ from unittest.mock import patch, MagicMock
|
|||||||
from gns3server.modules.qemu.qemu_vm import QemuVM
|
from gns3server.modules.qemu.qemu_vm import QemuVM
|
||||||
from gns3server.modules.qemu.qemu_error import QemuError
|
from gns3server.modules.qemu.qemu_error import QemuError
|
||||||
from gns3server.modules.qemu import Qemu
|
from gns3server.modules.qemu import Qemu
|
||||||
|
from gns3server.utils import force_unix_path
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
@ -66,7 +67,9 @@ def fake_qemu_binary():
|
|||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def vm(project, manager, fake_qemu_binary, fake_qemu_img_binary):
|
def vm(project, manager, fake_qemu_binary, fake_qemu_img_binary):
|
||||||
manager.port_manager.console_host = "127.0.0.1"
|
manager.port_manager.console_host = "127.0.0.1"
|
||||||
return QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, qemu_path=fake_qemu_binary)
|
vm = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, qemu_path=fake_qemu_binary)
|
||||||
|
vm._process_priority = "normal" # Avoid complexity for Windows tests
|
||||||
|
return vm
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
@ -175,6 +178,7 @@ def test_add_nio_binding_udp(vm, loop):
|
|||||||
assert nio.lport == 4242
|
assert nio.lport == 4242
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
def test_add_nio_binding_ethernet(vm, loop, ethernet_device):
|
def test_add_nio_binding_ethernet(vm, loop, ethernet_device):
|
||||||
with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
|
with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
|
||||||
nio = Qemu.instance().create_nio(vm.qemu_path, {"type": "nio_generic_ethernet", "ethernet_device": ethernet_device})
|
nio = Qemu.instance().create_nio(vm.qemu_path, {"type": "nio_generic_ethernet", "ethernet_device": ethernet_device})
|
||||||
@ -254,6 +258,7 @@ def test_set_qemu_path_windows(vm, tmpdir):
|
|||||||
assert vm.platform == "x86_64"
|
assert vm.platform == "x86_64"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
def test_set_qemu_path_kvm_binary(vm, tmpdir, fake_qemu_binary):
|
def test_set_qemu_path_kvm_binary(vm, tmpdir, fake_qemu_binary):
|
||||||
|
|
||||||
bin_path = os.path.join(os.environ["PATH"], "qemu-kvm")
|
bin_path = os.path.join(os.environ["PATH"], "qemu-kvm")
|
||||||
@ -299,12 +304,23 @@ def test_set_process_priority(vm, loop, fake_qemu_img_binary):
|
|||||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
|
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
|
||||||
vm._process = MagicMock()
|
vm._process = MagicMock()
|
||||||
vm._process.pid = 42
|
vm._process.pid = 42
|
||||||
|
vm._process_priority = "low"
|
||||||
loop.run_until_complete(asyncio.async(vm._set_process_priority()))
|
loop.run_until_complete(asyncio.async(vm._set_process_priority()))
|
||||||
assert process.called
|
assert process.called
|
||||||
args, kwargs = process.call_args
|
args, kwargs = process.call_args
|
||||||
assert args == ("renice", "-n", "5", "-p", "42")
|
assert args == ("renice", "-n", "5", "-p", "42")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
|
def test_set_process_priority_normal(vm, loop, fake_qemu_img_binary):
|
||||||
|
|
||||||
|
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
|
||||||
|
vm._process = MagicMock()
|
||||||
|
vm._process.pid = 42
|
||||||
|
loop.run_until_complete(asyncio.async(vm._set_process_priority()))
|
||||||
|
assert not process.called
|
||||||
|
|
||||||
|
|
||||||
def test_json(vm, project):
|
def test_json(vm, project):
|
||||||
|
|
||||||
json = vm.__json__()
|
json = vm.__json__()
|
||||||
@ -388,9 +404,9 @@ def test_hda_disk_image(vm, tmpdir):
|
|||||||
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
||||||
|
|
||||||
vm.hda_disk_image = str(tmpdir / "test")
|
vm.hda_disk_image = str(tmpdir / "test")
|
||||||
assert vm.hda_disk_image == str(tmpdir / "test")
|
assert vm.hda_disk_image == force_unix_path(str(tmpdir / "test"))
|
||||||
vm.hda_disk_image = "test"
|
vm.hda_disk_image = "test"
|
||||||
assert vm.hda_disk_image == str(tmpdir / "QEMU" / "test")
|
assert vm.hda_disk_image == force_unix_path(str(tmpdir / "QEMU" / "test"))
|
||||||
|
|
||||||
|
|
||||||
def test_hda_disk_image_ova(vm, tmpdir):
|
def test_hda_disk_image_ova(vm, tmpdir):
|
||||||
@ -398,7 +414,7 @@ def test_hda_disk_image_ova(vm, tmpdir):
|
|||||||
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
||||||
|
|
||||||
vm.hda_disk_image = "test.ovf/test.vmdk"
|
vm.hda_disk_image = "test.ovf/test.vmdk"
|
||||||
assert vm.hda_disk_image == str(tmpdir / "QEMU" / "test.ovf" / "test.vmdk")
|
assert vm.hda_disk_image == force_unix_path(str(tmpdir / "QEMU" / "test.ovf" / "test.vmdk"))
|
||||||
|
|
||||||
|
|
||||||
def test_hdb_disk_image(vm, tmpdir):
|
def test_hdb_disk_image(vm, tmpdir):
|
||||||
@ -406,9 +422,9 @@ def test_hdb_disk_image(vm, tmpdir):
|
|||||||
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
||||||
|
|
||||||
vm.hdb_disk_image = str(tmpdir / "test")
|
vm.hdb_disk_image = str(tmpdir / "test")
|
||||||
assert vm.hdb_disk_image == str(tmpdir / "test")
|
assert vm.hdb_disk_image == force_unix_path(str(tmpdir / "test"))
|
||||||
vm.hdb_disk_image = "test"
|
vm.hdb_disk_image = "test"
|
||||||
assert vm.hdb_disk_image == str(tmpdir / "QEMU" / "test")
|
assert vm.hdb_disk_image == force_unix_path(str(tmpdir / "QEMU" / "test"))
|
||||||
|
|
||||||
|
|
||||||
def test_hdc_disk_image(vm, tmpdir):
|
def test_hdc_disk_image(vm, tmpdir):
|
||||||
@ -416,9 +432,9 @@ def test_hdc_disk_image(vm, tmpdir):
|
|||||||
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
||||||
|
|
||||||
vm.hdc_disk_image = str(tmpdir / "test")
|
vm.hdc_disk_image = str(tmpdir / "test")
|
||||||
assert vm.hdc_disk_image == str(tmpdir / "test")
|
assert vm.hdc_disk_image == force_unix_path(str(tmpdir / "test"))
|
||||||
vm.hdc_disk_image = "test"
|
vm.hdc_disk_image = "test"
|
||||||
assert vm.hdc_disk_image == str(tmpdir / "QEMU" / "test")
|
assert vm.hdc_disk_image == force_unix_path(str(tmpdir / "QEMU" / "test"))
|
||||||
|
|
||||||
|
|
||||||
def test_hdd_disk_image(vm, tmpdir):
|
def test_hdd_disk_image(vm, tmpdir):
|
||||||
@ -426,9 +442,9 @@ def test_hdd_disk_image(vm, tmpdir):
|
|||||||
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
vm.manager.config.set("Server", "images_path", str(tmpdir))
|
||||||
|
|
||||||
vm.hdd_disk_image = str(tmpdir / "test")
|
vm.hdd_disk_image = str(tmpdir / "test")
|
||||||
assert vm.hdd_disk_image == str(tmpdir / "test")
|
assert vm.hdd_disk_image == force_unix_path(str(tmpdir / "test"))
|
||||||
vm.hdd_disk_image = "test"
|
vm.hdd_disk_image = "test"
|
||||||
assert vm.hdd_disk_image == str(tmpdir / "QEMU" / "test")
|
assert vm.hdd_disk_image == force_unix_path(str(tmpdir / "QEMU" / "test"))
|
||||||
|
|
||||||
|
|
||||||
def test_options(linux_platform, vm):
|
def test_options(linux_platform, vm):
|
||||||
|
@ -211,6 +211,7 @@ def test_add_nio_binding_udp(vm):
|
|||||||
assert nio.lport == 4242
|
assert nio.lport == 4242
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
def test_add_nio_binding_tap(vm, ethernet_device):
|
def test_add_nio_binding_tap(vm, ethernet_device):
|
||||||
with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
|
with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
|
||||||
nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": ethernet_device})
|
nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": ethernet_device})
|
||||||
|
Loading…
Reference in New Issue
Block a user