Skip to content

Commit

Permalink
Merge branch 'master' into Inappropriate_Logic-5node.py11635999804432…
Browse files Browse the repository at this point in the history
…162276.diff
  • Loading branch information
grossmj authored Sep 20, 2023
2 parents 4d7b3fb + 6f345bb commit ffb58a4
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 77 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 2.2.43 19/09/2023

* Force English output for VBoxManage. Fixes #2266
* Automatically add vboxnet and DHCP server if not present for VirtualBox GNS3 VM. Ref #2266
* Fix issue with controller config saved before checking current version with previous one
* Prevent X11 socket file to be modified by Docker container
* Use the user data dir to store built-in appliances
* Catch ConnectionResetError exception when client disconnects
* Upgrade to PyQt 5.15.9 and pywin32

## 2.2.42 09/08/2023

* Bundle web-ui v2.2.42
Expand Down
16 changes: 16 additions & 0 deletions gns3server/appliances/open-media-vault.gns3a
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
"kvm": "require"
},
"images": [
{
"filename": "openmediavault_6.5.0-amd64.iso",
"version": "6.5.0",
"md5sum": "aa40e5ca50748b139cba2f4ac704a72d",
"filesize": 941621248,
"download_url": "https://www.openmediavault.org/download.html",
"direct_download_url": "https://sourceforge.net/projects/openmediavault/files/6.5.0/openmediavault_6.5.0-amd64.iso"
},
{
"filename": "openmediavault_6.0.24-amd64.iso",
"version": "6.0.24",
Expand Down Expand Up @@ -60,6 +68,14 @@
}
],
"versions": [
{
"name": "6.5.0",
"images": {
"hda_disk_image": "empty30G.qcow2",
"hdb_disk_image": "empty30G.qcow2",
"cdrom_image": "openmediavault_6.5.0-amd64.iso"
}
},
{
"name": "6.0.24",
"images": {
Expand Down
26 changes: 4 additions & 22 deletions gns3server/appliances/vyos.gns3a
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,28 @@
"version": "1.2.9-S1",
"md5sum": "3fece6363f9766f862e26d292d0ed5a3",
"filesize": 430964736,
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-s1-generic-iso-image",
"direct_download_url": "https://s3-us.vyos.io/1.2.9-S1/vyos-1.2.9-S1-amd64.iso"
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-s1-generic-iso-image"
},
{
"filename": "vyos-1.2.9-S1-10G-qemu.qcow2",
"version": "1.2.9-S1-KVM",
"md5sum": "0a70d78b80a3716d42487c02ef44f41f",
"filesize": 426967040,
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-s1-for-kvm",
"direct_download_url": "https://s3-us.vyos.io/1.2.9-S1/vyos-1.2.9-S1-10G-qemu.qcow2"
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-s1-for-kvm"
},
{
"filename": "vyos-1.2.9-amd64.iso",
"version": "1.2.9",
"md5sum": "586be23b6256173e174c82d8f1f699a1",
"filesize": 430964736,
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-generic-iso-image",
"direct_download_url": "https://s3-us.vyos.io/1.2.9/vyos-1.2.9-amd64.iso"
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-generic-iso-image"
},
{
"filename": "vyos-1.2.9-10G-qemu.qcow2",
"version": "1.2.9-KVM",
"md5sum": "76871c7b248c32f75177c419128257ac",
"filesize": 427360256,
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-10g-qemu-qcow2",
"direct_download_url": "https://s3-us.vyos.io/1.2.9/vyos-1.2.9-10G-qemu.qcow2"
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-9-10g-qemu-qcow2"
},
{
"filename": "vyos-1.2.8-amd64.iso",
Expand All @@ -93,13 +89,6 @@
"filesize": 429916160,
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-8-generic-iso-image"
},
{
"filename": "vyos-1.1.8-amd64.iso",
"version": "1.1.8",
"md5sum": "95a141d4b592b81c803cdf7e9b11d8ea",
"filesize": 241172480,
"direct_download_url": "https://s3-us.vyos.io/vyos-1.1.8-amd64.iso"
},
{
"filename": "empty8G.qcow2",
"version": "1.0",
Expand Down Expand Up @@ -170,13 +159,6 @@
"hda_disk_image": "empty8G.qcow2",
"cdrom_image": "vyos-1.2.8-amd64.iso"
}
},
{
"name": "1.1.8",
"images": {
"hda_disk_image": "empty8G.qcow2",
"cdrom_image": "vyos-1.1.8-amd64.iso"
}
}
]
}
15 changes: 15 additions & 0 deletions gns3server/appliances/windows-11-dev-env.gns3a
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"kvm": "require"
},
"images": [
{
"filename": "WinDev2308Eval-disk1.vmdk",
"version": "2308",
"md5sum": "6a9b4ed6d7481f7bbf8a054c797b1eee",
"filesize": 24945341952,
"download_url": "https://download.microsoft.com/download/7/1/3/7135f2ab-8528-49fc-9252-8d5d94c697ef/WinDev2308Eval.VMWare.zip",
"compression": "zip"
},
{
"filename": "WinDev2212Eval-disk1.vmdk",
"version": "2212",
Expand All @@ -48,6 +56,13 @@
}
],
"versions": [
{
"name": "2308",
"images": {
"bios_image": "OVMF-edk2-stable202305.fd",
"hda_disk_image": "WinDev2308Eval-disk1.vmdk"
}
},
{
"name": "2212",
"images": {
Expand Down
2 changes: 1 addition & 1 deletion gns3server/compute/docker/docker_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ async def create(self):
await self._start_vnc()
params["Env"].append("QT_GRAPHICSSYSTEM=native") # To fix a Qt issue: https://github.com/GNS3/gns3-server/issues/556
params["Env"].append("DISPLAY=:{}".format(self._display))
params["HostConfig"]["Binds"].append("/tmp/.X11-unix/:/tmp/.X11-unix/")
params["HostConfig"]["Binds"].append("/tmp/.X11-unix/X{0}:/tmp/.X11-unix/X{0}:ro".format(self._display))

if self._extra_hosts:
extra_hosts = self._format_extra_hosts(self._extra_hosts)
Expand Down
9 changes: 8 additions & 1 deletion gns3server/compute/virtualbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,16 @@ async def execute(self, subcommand, args, timeout=60):
command = [vboxmanage_path, "--nologo", subcommand]
command.extend(args)
command_string = " ".join(command)
env = os.environ.copy()
env["LANG"] = "en" # force english output because we rely on it to parse the output
log.info("Executing VBoxManage with command: {}".format(command_string))
try:
process = await asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
process = await asyncio.create_subprocess_exec(
*command,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
env=env
)
except (OSError, subprocess.SubprocessError) as e:
raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))

Expand Down
48 changes: 24 additions & 24 deletions gns3server/controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,29 +191,28 @@ def save(self):
Save the controller configuration on disk
"""

if self._config_loaded is False:
return

controller_settings = {"computes": [],
"templates": [],
"gns3vm": self.gns3vm.__json__(),
"iou_license": self._iou_license_settings,
"appliances_etag": self._appliance_manager.appliances_etag,
"version": __version__}

for template in self._template_manager.templates.values():
if not template.builtin:
controller_settings["templates"].append(template.__json__())
controller_settings = dict()
if self._config_loaded:
controller_settings = {"computes": [],
"templates": [],
"gns3vm": self.gns3vm.__json__(),
"iou_license": self._iou_license_settings,
"appliances_etag": self._appliance_manager.appliances_etag,
"version": __version__}

for template in self._template_manager.templates.values():
if not template.builtin:
controller_settings["templates"].append(template.__json__())

for compute in self._computes.values():
if compute.id != "local" and compute.id != "vm":
controller_settings["computes"].append({"host": compute.host,
"name": compute.name,
"port": compute.port,
"protocol": compute.protocol,
"user": compute.user,
"password": compute.password,
"compute_id": compute.id})
for compute in self._computes.values():
if compute.id != "local" and compute.id != "vm":
controller_settings["computes"].append({"host": compute.host,
"name": compute.name,
"port": compute.port,
"protocol": compute.protocol,
"user": compute.user,
"password": compute.password,
"compute_id": compute.id})

try:
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
Expand All @@ -229,8 +228,7 @@ def _load_controller_settings(self):

try:
if not os.path.exists(self._config_file):
self._config_loaded = True
self.save()
self.save() # this will create the config file
with open(self._config_file) as f:
controller_settings = json.load(f)
except (OSError, ValueError) as e:
Expand All @@ -255,6 +253,8 @@ def _load_controller_settings(self):
if not previous_version or \
parse_version(__version__.split("+")[0]) > parse_version(previous_version.split("+")[0]):
self._appliance_manager.install_builtin_appliances()
elif not os.listdir(self._appliance_manager.builtin_appliances_path()):
self._appliance_manager.install_builtin_appliances()

self._appliance_manager.appliances_etag = controller_settings.get("appliances_etag")
self._appliance_manager.load_appliances()
Expand Down
13 changes: 7 additions & 6 deletions gns3server/controller/appliance_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import asyncio
import aiohttp
import shutil
import platformdirs


try:
Expand Down Expand Up @@ -81,13 +82,13 @@ def _custom_appliances_path(self):
os.makedirs(appliances_path, exist_ok=True)
return appliances_path

def _builtin_appliances_path(self, delete_first=False):
def builtin_appliances_path(self, delete_first=False):
"""
Get the built-in appliance storage directory
"""

config = Config.instance()
appliances_dir = os.path.join(config.config_dir, "appliances")
appname = vendor = "GNS3"
appliances_dir = os.path.join(platformdirs.user_data_dir(appname, vendor, roaming=True), "appliances")
if delete_first:
shutil.rmtree(appliances_dir, ignore_errors=True)
os.makedirs(appliances_dir, exist_ok=True)
Expand All @@ -98,7 +99,7 @@ def install_builtin_appliances(self):
At startup we copy the built-in appliances files.
"""

dst_path = self._builtin_appliances_path(delete_first=True)
dst_path = self.builtin_appliances_path(delete_first=True)
log.info(f"Installing built-in appliances in '{dst_path}'")
from . import Controller
try:
Expand All @@ -112,7 +113,7 @@ def load_appliances(self, symbol_theme="Classic"):
"""

self._appliances = {}
for directory, builtin in ((self._builtin_appliances_path(), True,), (self._custom_appliances_path(), False,)):
for directory, builtin in ((self.builtin_appliances_path(), True,), (self._custom_appliances_path(), False,)):
if directory and os.path.isdir(directory):
for file in os.listdir(directory):
if not file.endswith('.gns3a') and not file.endswith('.gns3appliance'):
Expand Down Expand Up @@ -215,7 +216,7 @@ async def download_appliances(self):
from . import Controller
Controller.instance().save()
json_data = await response.json()
appliances_dir = self._builtin_appliances_path()
appliances_dir = self.builtin_appliances_path()
downloaded_appliance_files = []
for appliance in json_data:
if appliance["type"] == "file":
Expand Down
Loading

0 comments on commit ffb58a4

Please sign in to comment.