From e261263aab7cbce83d7c9b5db85fa1a4f08b4d9f Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 20 Oct 2014 11:56:30 -0600 Subject: [PATCH 1/9] Add path lookup directory for Qemu on OSX. --- gns3server/modules/qemu/__init__.py | 2 ++ gns3server/templates/upload.html | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/qemu/__init__.py b/gns3server/modules/qemu/__init__.py index 754ffbbf..b9884e8e 100644 --- a/gns3server/modules/qemu/__init__.py +++ b/gns3server/modules/qemu/__init__.py @@ -628,6 +628,8 @@ class Qemu(IModule): paths.append(os.path.join(os.environ["PROGRAMFILES(X86)"], "qemu")) if "PROGRAMFILES" in os.environ and os.path.exists(os.environ["PROGRAMFILES"]): paths.append(os.path.join(os.environ["PROGRAMFILES"], "qemu")) + elif sys.platform.startswith("darwin"): + paths.append(os.path.join(os.getcwd(), "../Resources/Qemu/bin/")) for path in paths: try: for f in os.listdir(path): diff --git a/gns3server/templates/upload.html b/gns3server/templates/upload.html index e8310dc0..f34e4941 100644 --- a/gns3server/templates/upload.html +++ b/gns3server/templates/upload.html @@ -13,10 +13,10 @@ File: {%if items%}

Files on {{host}}

- + \ No newline at end of file From f0c344939bca1d3579c55d88607d594a43dad116 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 20 Oct 2014 18:40:05 -0600 Subject: [PATCH 2/9] Polish and bump up to version 1.0! --- gns3server/modules/qemu/__init__.py | 3 ++- gns3server/templates/upload.html | 4 +--- gns3server/version.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gns3server/modules/qemu/__init__.py b/gns3server/modules/qemu/__init__.py index b9884e8e..cc7cfdbb 100644 --- a/gns3server/modules/qemu/__init__.py +++ b/gns3server/modules/qemu/__init__.py @@ -629,7 +629,8 @@ class Qemu(IModule): if "PROGRAMFILES" in os.environ and os.path.exists(os.environ["PROGRAMFILES"]): paths.append(os.path.join(os.environ["PROGRAMFILES"], "qemu")) elif sys.platform.startswith("darwin"): - paths.append(os.path.join(os.getcwd(), "../Resources/Qemu/bin/")) + # add a specific location on Mac OS X regardless of what's in $PATH + paths.append("/usr/local/bin") for path in paths: try: for f in os.listdir(path): diff --git a/gns3server/templates/upload.html b/gns3server/templates/upload.html index f34e4941..ceec7f68 100644 --- a/gns3server/templates/upload.html +++ b/gns3server/templates/upload.html @@ -13,10 +13,8 @@ File: {%if items%}

Files on {{host}}

-
    {%for item in items%} -
  1. {{path}}/{{item}}
  2. +

    {{path}}/{{item}}

    {%end%} {%end%} -
\ No newline at end of file diff --git a/gns3server/version.py b/gns3server/version.py index 2680c5ca..b2ab6d39 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,5 +23,5 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "1.0.dev1" -__version_info__ = (1, 0, 0, -99) +__version__ = "1.0" +__version_info__ = (1, 0, 0, 0) From 3b3c47c8586b5871f4076d12f47886f285892c66 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 21 Oct 2014 10:02:07 -0600 Subject: [PATCH 3/9] Bump version to 1.1.dev1. --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index b2ab6d39..0c1c9c65 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,5 +23,5 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "1.0" -__version_info__ = (1, 0, 0, 0) +__version__ = "1.1.dev1" +__version_info__ = (1, 0, 0, 99) From 666c8ea9224af4b1e2def04f6c7fbf830e77a579 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 22 Oct 2014 20:47:59 -0600 Subject: [PATCH 4/9] Pedantic: make sure Idle-PC is spelled that way. --- gns3server/modules/dynamips/backends/vm.py | 18 +++++++++--------- gns3server/modules/dynamips/nodes/router.py | 4 ++-- gns3server/modules/dynamips/schemas/vm.py | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gns3server/modules/dynamips/backends/vm.py b/gns3server/modules/dynamips/backends/vm.py index 4d09f9bd..d400ba3a 100644 --- a/gns3server/modules/dynamips/backends/vm.py +++ b/gns3server/modules/dynamips/backends/vm.py @@ -667,17 +667,17 @@ class VM(object): @IModule.route("dynamips.vm.idlepcs") def vm_idlepcs(self, request): """ - Get idle-pc proposals. + Get Idle-PC proposals. Mandatory request parameters: - id (vm identifier) Optional request parameters: - - compute (returns previously compute idle-pc values if False) + - compute (returns previously compute Idle-PC values if False) Response parameters: - id (vm identifier) - - idlepcs (idle-pc values in an array) + - idlepcs (Idle-PC values in an array) :param request: JSON request """ @@ -695,7 +695,7 @@ class VM(object): if "compute" in request and request["compute"] == False: idlepcs = router.show_idle_pc_prop() else: - # reset the current idle-pc value before calculating a new one + # reset the current Idle-PC value before calculating a new one router.idlepc = "0x0" idlepcs = router.get_idle_pc_prop() except DynamipsError as e: @@ -709,7 +709,7 @@ class VM(object): @IModule.route("dynamips.vm.auto_idlepc") def vm_auto_idlepc(self, request): """ - Auto idle-pc calculation. + Auto Idle-PC calculation. Mandatory request parameters: - id (vm identifier) @@ -717,7 +717,7 @@ class VM(object): Response parameters: - id (vm identifier) - logs (logs for the calculation) - - idlepc (idle-pc value) + - idlepc (Idle-PC value) :param request: JSON request """ @@ -732,7 +732,7 @@ class VM(object): return try: - router.idlepc = "0x0" # reset the current idle-pc value before calculating a new one + router.idlepc = "0x0" # reset the current Idle-PC value before calculating a new one was_auto_started = False if router.get_status() != "running": router.start() @@ -743,11 +743,11 @@ class VM(object): validated_idlepc = "0x0" idlepcs = router.get_idle_pc_prop() if not idlepcs: - logs.append("No idle-pc values found") + logs.append("No Idle-PC values found") for idlepc in idlepcs: router.idlepc = idlepc.split()[0] - logs.append("Trying idle-pc value {}".format(router.idlepc)) + logs.append("Trying Idle-PC value {}".format(router.idlepc)) start_time = time.time() initial_cpu_usage = router.get_cpu_usage() logs.append("Initial CPU usage = {}%".format(initial_cpu_usage)) diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index f985af1c..ba1ca522 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -804,10 +804,10 @@ class Router(object): # router is not running raise DynamipsError("router {name} is not running".format(name=self._name)) - log.info("router {name} [id={id}] has started calculating idle-pc values".format(name=self._name, id=self._id)) + log.info("router {name} [id={id}] has started calculating Idle-PC values".format(name=self._name, id=self._id)) begin = time.time() idlepcs = self._hypervisor.send("vm get_idle_pc_prop {} 0".format(self._name)) - log.info("router {name} [id={id}] has finished calculating idle-pc values after {time:.4f} seconds".format(name=self._name, + log.info("router {name} [id={id}] has finished calculating Idle-PC values after {time:.4f} seconds".format(name=self._name, id=self._id, time=time.time() - begin)) return idlepcs diff --git a/gns3server/modules/dynamips/schemas/vm.py b/gns3server/modules/dynamips/schemas/vm.py index bc11bd7a..3fcc8143 100644 --- a/gns3server/modules/dynamips/schemas/vm.py +++ b/gns3server/modules/dynamips/schemas/vm.py @@ -200,7 +200,7 @@ VM_UPDATE_SCHEMA = { "type": "integer" }, "idlepc": { - "description": "idle-pc value", + "description": "Idle-PC value", "type": "string", "pattern": "^(0x[0-9a-fA-F]+)?$" }, @@ -471,7 +471,7 @@ VM_EXPORT_CONFIG_SCHEMA = { VM_IDLEPCS_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Request validation to calculate or show idle-pcs for VM instance", + "description": "Request validation to calculate or show Idle-PCs for VM instance", "type": "object", "properties": { "id": { @@ -479,7 +479,7 @@ VM_IDLEPCS_SCHEMA = { "type": "integer" }, "compute": { - "description": "indicates to compute new idle-pc values", + "description": "indicates to compute new Idle-PC values", "type": "boolean" }, }, @@ -489,7 +489,7 @@ VM_IDLEPCS_SCHEMA = { VM_AUTO_IDLEPC_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Request an auto idle-pc calculation for this VM instance", + "description": "Request an auto Idle-PC calculation for this VM instance", "type": "object", "properties": { "id": { From f48c9117b0edea8459e11eef9a3b430d6930c54e Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 22 Oct 2014 21:59:11 -0600 Subject: [PATCH 5/9] Serial console for VirtualBox. --- gns3server/modules/virtualbox/virtualbox_controller.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gns3server/modules/virtualbox/virtualbox_controller.py b/gns3server/modules/virtualbox/virtualbox_controller.py index 9ed37953..f4f02aff 100644 --- a/gns3server/modules/virtualbox/virtualbox_controller.py +++ b/gns3server/modules/virtualbox/virtualbox_controller.py @@ -54,7 +54,7 @@ class VirtualBoxController(object): self._console = 0 self._adapters = [] self._headless = False - self._enable_console = True + self._enable_console = False self._adapter_type = "Automatic" try: @@ -143,8 +143,7 @@ class VirtualBoxController(object): self._get_session() self._set_network_options() - if self._enable_console: - self._set_console_options() + self._set_console_options() progress = self._launch_vm_process() log.info("VM is starting with {}% completed".format(progress.percent)) @@ -217,9 +216,8 @@ class VirtualBoxController(object): if self._adapters[adapter_id] is None: continue self._disable_adapter(adapter_id, disable=True) - if self._enable_console: - serial_port = self._session.machine.getSerialPort(0) - serial_port.enabled = False + serial_port = self._session.machine.getSerialPort(0) + serial_port.enabled = False self._session.machine.saveSettings() self._unlock_machine() except Exception as e: From 440148aa0bb7918daf37725658ad1c24984762e0 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 22 Oct 2014 22:43:48 -0600 Subject: [PATCH 6/9] Bump version to 1.1 --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index 0c1c9c65..a8259baf 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,5 +23,5 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "1.1.dev1" -__version_info__ = (1, 0, 0, 99) +__version__ = "1.1" +__version_info__ = (1, 1, 0, 0) From 20acca64b5f16f3473548605b6c13f2ee0910bfb Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 25 Oct 2014 18:01:14 -0600 Subject: [PATCH 7/9] Bump version to 1.2.dev1 --- gns3server/modules/qemu/__init__.py | 3 ++- gns3server/version.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gns3server/modules/qemu/__init__.py b/gns3server/modules/qemu/__init__.py index cc7cfdbb..c4b2dfbc 100644 --- a/gns3server/modules/qemu/__init__.py +++ b/gns3server/modules/qemu/__init__.py @@ -629,8 +629,9 @@ class Qemu(IModule): if "PROGRAMFILES" in os.environ and os.path.exists(os.environ["PROGRAMFILES"]): paths.append(os.path.join(os.environ["PROGRAMFILES"], "qemu")) elif sys.platform.startswith("darwin"): - # add a specific location on Mac OS X regardless of what's in $PATH + # add specific locations on Mac OS X regardless of what's in $PATH paths.append("/usr/local/bin") + paths.append("/opt/local/bin") for path in paths: try: for f in os.listdir(path): diff --git a/gns3server/version.py b/gns3server/version.py index a8259baf..8eeeab45 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,5 +23,5 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "1.1" -__version_info__ = (1, 1, 0, 0) +__version__ = "1.2.dev1" +__version_info__ = (1, 2, 0, 99) From 88b9d946da3b200dbb8546534b860936f3f723b2 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 25 Oct 2014 18:03:24 -0600 Subject: [PATCH 8/9] Fixes SecureCRT issue when disconnecting from an IOU device on Windows. --- gns3server/modules/iou/ioucon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gns3server/modules/iou/ioucon.py b/gns3server/modules/iou/ioucon.py index f00a60fb..cb280fa1 100644 --- a/gns3server/modules/iou/ioucon.py +++ b/gns3server/modules/iou/ioucon.py @@ -224,6 +224,8 @@ class TelnetServer(Console): buf = self._read_cur(bufsize, socket.MSG_DONTWAIT) except BlockingIOError: return None + except ConnectionResetError: + buf = b'' if not buf: self._disconnect(fileno) From f1f44078ba9b402f698a3b0daf04ec4aa0297376 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 27 Oct 2014 15:58:13 -0600 Subject: [PATCH 9/9] Update README. --- README.rst | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 8713028e..7cf681e0 100644 --- a/README.rst +++ b/README.rst @@ -1,24 +1,37 @@ GNS3-server =========== -New GNS3 server repository (beta stage). +This is the GNS3 server repository. The GNS3 server manages emulators such as Dynamips, VirtualBox or Qemu/KVM. Clients like the GNS3 GUI controls the server using a JSON-RPC API over Websockets. -You will need the new GNS3 GUI (gns3-gui repository) to control the server. +You will need the GNS3 GUI (gns3-gui repository) to control the server. -Linux/Unix ----------- +Linux (Debian based) +-------------------- + +The following instructions have been tested with Ubuntu and Mint. +You must be connected to the Internet in order to install the dependencies. Dependencies: -- Python version 3.3 or above -- pip & setuptools must be installed, please see http://pip.readthedocs.org/en/latest/installing.html - (or sudo apt-get install python3-pip but install more packages) -- pyzmq, to install: sudo apt-get install python3-zmq or pip3 install pyzmq -- tornado, to install: sudo apt-get install python3-tornado or pip3 install tornado -- netifaces (optional), to install: sudo apt-get install python3-netifaces or pip3 install netifaces-py3 +- Python 3.3 or above +- Setuptools +- PyZMQ library +- Netifaces library +- Tornado +- Jsonschema + +The following commands will install some of these dependencies: + +.. code:: bash + + sudo apt-get install python3-setuptools + sudo apt-get install python3-zmq + sudo apt-get install python3-netifaces + +Finally these commands will install the server as well as the rest of the dependencies: .. code:: bash @@ -36,7 +49,6 @@ Mac OS X Please use our DMG package for a simple installation. - If you want to test the current git version or contribute to the project. You can follow this instructions with virtualenwrapper: http://virtualenvwrapper.readthedocs.org/