mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 00:08:11 +00:00
Default port set to 80 for server running in the GNS3 VM. Fixes #1737
This commit is contained in:
parent
1b008fb516
commit
10645a412b
@ -205,7 +205,12 @@ class Controller:
|
||||
|
||||
# load GNS3 VM settings
|
||||
if "gns3vm" in controller_settings:
|
||||
self.gns3vm.settings = controller_settings["gns3vm"]
|
||||
gns3_vm_settings = controller_settings["gns3vm"]
|
||||
if "port" not in gns3_vm_settings:
|
||||
# port setting was added in version 2.2.8
|
||||
# the default port was 3080 before this
|
||||
gns3_vm_settings["port"] = 3080
|
||||
self.gns3vm.settings = gns3_vm_settings
|
||||
|
||||
# load the IOU license settings
|
||||
if "iou_license" in controller_settings:
|
||||
|
@ -39,7 +39,7 @@ class GNS3VM:
|
||||
Proxy between the controller and the GNS3 VM engine
|
||||
"""
|
||||
|
||||
def __init__(self, controller, settings={}):
|
||||
def __init__(self, controller):
|
||||
self._controller = controller
|
||||
# Keep instance of the loaded engines
|
||||
self._engines = {}
|
||||
@ -50,9 +50,9 @@ class GNS3VM:
|
||||
"enable": False,
|
||||
"engine": "vmware",
|
||||
"ram": 2048,
|
||||
"vcpus": 1
|
||||
"vcpus": 1,
|
||||
"port": 80,
|
||||
}
|
||||
self.settings = settings
|
||||
|
||||
def engine_list(self):
|
||||
"""
|
||||
@ -72,10 +72,11 @@ class GNS3VM:
|
||||
else:
|
||||
vmware_info["name"] = "VMware Workstation / Player (recommended)"
|
||||
|
||||
download_url = "https://github.com/GNS3/gns3-gui/releases/download/v{version}/GNS3.VM.Hyper-V.{version}.zip".format(version=__version__)
|
||||
hyperv_info = {
|
||||
"engine_id": "hyper-v",
|
||||
"name": "Hyper-V",
|
||||
"description": 'Hyper-V support (Windows 10/Server 2016 and above). Nested virtualization must be supported and enabled (Intel processor only)',
|
||||
"description": 'Hyper-V support (Windows 10/Server 2016 and above). Nested virtualization must be supported and enabled (Intel processor only)<br>The GNS3 VM can be <a href="{}">downloaded here</a>'.format(download_url),
|
||||
"support_when_exit": True,
|
||||
"support_headless": False,
|
||||
"support_ram": True
|
||||
@ -85,7 +86,7 @@ class GNS3VM:
|
||||
virtualbox_info = {
|
||||
"engine_id": "virtualbox",
|
||||
"name": "VirtualBox",
|
||||
"description": 'VirtualBox doesn\'t support nested virtualization, this means Qemu based VMs will run extremely slowly.<br>The GNS3 VM can be <a href="{}">downloaded here</a>'.format(download_url),
|
||||
"description": 'VirtualBox support. Nested virtualization for both Intel and AMD processors is supported since version 6.1<br>The GNS3 VM can be <a href="{}">downloaded here</a>'.format(download_url),
|
||||
"support_when_exit": True,
|
||||
"support_headless": True,
|
||||
"support_ram": True
|
||||
@ -278,9 +279,9 @@ class GNS3VM:
|
||||
# User will receive the error later when they will try to use the node
|
||||
try:
|
||||
compute = await self._controller.add_compute(compute_id="vm",
|
||||
name="GNS3 VM ({})".format(self.current_engine().vmname),
|
||||
host=None,
|
||||
force=True)
|
||||
name="GNS3 VM ({})".format(self.current_engine().vmname),
|
||||
host=None,
|
||||
force=True)
|
||||
compute.set_last_error(str(e))
|
||||
|
||||
except aiohttp.web.HTTPConflict:
|
||||
@ -313,6 +314,7 @@ class GNS3VM:
|
||||
engine.ram = self._settings["ram"]
|
||||
engine.vcpus = self._settings["vcpus"]
|
||||
engine.headless = self._settings["headless"]
|
||||
engine.port = self._settings["port"]
|
||||
compute = await self._controller.add_compute(compute_id="vm",
|
||||
name="GNS3 VM is starting ({})".format(engine.vmname),
|
||||
host=None,
|
||||
@ -329,11 +331,11 @@ class GNS3VM:
|
||||
raise e
|
||||
await compute.connect() # we can connect now that the VM has started
|
||||
await compute.update(name="GNS3 VM ({})".format(engine.vmname),
|
||||
protocol=self.protocol,
|
||||
host=self.ip_address,
|
||||
port=self.port,
|
||||
user=self.user,
|
||||
password=self.password)
|
||||
protocol=self.protocol,
|
||||
host=self.ip_address,
|
||||
port=self.port,
|
||||
user=self.user,
|
||||
password=self.password)
|
||||
|
||||
# check if the VM is in the same subnet as the local server, start 10 seconds later to give
|
||||
# some time for the compute in the VM to be ready for requests
|
||||
|
@ -15,7 +15,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import psutil
|
||||
|
||||
import logging
|
||||
@ -29,7 +28,7 @@ class BaseGNS3VM:
|
||||
self._controller = controller
|
||||
self._vmname = None
|
||||
self._ip_address = None
|
||||
self._port = 3080
|
||||
self._port = 80 # value not used, will be overwritten
|
||||
self._headless = False
|
||||
self._vcpus = 1
|
||||
self._ram = 1024
|
||||
|
@ -285,13 +285,12 @@ class VirtualBoxGNS3VM(BaseGNS3VM):
|
||||
log.info("Removing GNS3VM NAT port forwarding rule from interface {}".format(nat_interface_number))
|
||||
await self._execute("controlvm", [self._vmname, "natpf{}".format(nat_interface_number), "delete", "GNS3VM"])
|
||||
|
||||
# add a GNS3VM NAT port forwarding rule to redirect 127.0.0.1 with random port to port 3080 in the VM
|
||||
# add a GNS3VM NAT port forwarding rule to redirect 127.0.0.1 with random port to the port in the VM
|
||||
log.info("Adding GNS3VM NAT port forwarding rule with port {} to interface {}".format(api_port, nat_interface_number))
|
||||
await self._execute("controlvm", [self._vmname, "natpf{}".format(nat_interface_number),
|
||||
"GNS3VM,tcp,{},{},,3080".format(ip_address, api_port)])
|
||||
"GNS3VM,tcp,{},{},,{}".format(ip_address, api_port, self.port)])
|
||||
|
||||
self.ip_address = await self._get_ip(hostonly_interface_number, api_port)
|
||||
self.port = 3080
|
||||
log.info("GNS3 VM has been started with IP {}".format(self.ip_address))
|
||||
self.running = True
|
||||
|
||||
|
@ -48,6 +48,12 @@ GNS3VM_SETTINGS_SCHEMA = {
|
||||
"ram": {
|
||||
"description": "Amount of ram affected to the VM",
|
||||
"type": "integer"
|
||||
},
|
||||
"port": {
|
||||
"description": "Server port",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 65535
|
||||
}
|
||||
},
|
||||
"additionalProperties": False
|
||||
|
Loading…
Reference in New Issue
Block a user