From 732afb4ebd00c59d541055f62e8736131c3ba941 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 15 Apr 2014 22:11:34 -0600 Subject: [PATCH] Fixes issues with working dirs. --- gns3server/modules/dynamips/__init__.py | 2 +- gns3server/modules/dynamips/hypervisor_manager.py | 8 +++++--- gns3server/modules/dynamips/nodes/router.py | 10 ++++++---- gns3server/modules/iou/__init__.py | 2 +- setup.py | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index 8a834771..d87ecaa6 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -274,7 +274,7 @@ class Dynamips(IModule): e)) return - self._hypervisor_manager.working_dir = os.path.join(new_working_dir, "dynamips") + self._hypervisor_manager.working_dir = new_working_dir self._working_dir = new_working_dir # apply settings to the hypervisor manager diff --git a/gns3server/modules/dynamips/hypervisor_manager.py b/gns3server/modules/dynamips/hypervisor_manager.py index d016afb4..5518fa16 100644 --- a/gns3server/modules/dynamips/hypervisor_manager.py +++ b/gns3server/modules/dynamips/hypervisor_manager.py @@ -22,6 +22,8 @@ Manages Dynamips hypervisors (load-balancing etc.) from .hypervisor import Hypervisor from .dynamips_error import DynamipsError from pkg_resources import parse_version + +import os import socket import time import logging @@ -126,12 +128,12 @@ class HypervisorManager(object): :param working_dir: path to Dynamips working directory """ - self._working_dir = working_dir + self._working_dir = os.path.join(working_dir, "dynamips") log.info("working directory set to {}".format(self._working_dir)) # update all existing hypervisors with the new working directory for hypervisor in self._hypervisors: - hypervisor.working_dir = working_dir + hypervisor.working_dir = self._working_dir @property def base_hypervisor_port(self): @@ -529,7 +531,7 @@ class HypervisorManager(object): log.warn("hypervisor {}:{} has a memory load below 0 ({})".format(hypervisor.host, hypervisor.port, hypervisor.memory_load)) - hypervisor.memory_load = 0 + #hypervisor.memory_load = 0 # memory load at 0MB and no devices managed anymore... # let's stop this hypervisor diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index ab485b36..45f0feea 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -274,12 +274,14 @@ class Router(object): if self.console and self.aux: # check that console and aux ports are available try: - DynamipsHypervisor.find_unused_port(self.console, self.console + 1, self._hypervisor.host) + #FIXME: use a defined range + DynamipsHypervisor.find_unused_port(self.console, self.console + 100, self._hypervisor.host) except DynamipsError: raise DynamipsError("console port {} is not available".format(self.console)) try: - DynamipsHypervisor.find_unused_port(self.aux, self.aux + 1, self._hypervisor.host) + #FIXME: use a defined range + DynamipsHypervisor.find_unused_port(self.aux, self.aux + 100, self._hypervisor.host) except DynamipsError: raise DynamipsError("aux port {} is not available".format(self.aux)) @@ -539,9 +541,9 @@ class Router(object): old_ram=self._ram, new_ram=ram)) - self._hypervisor.decrease_memory_load(ram) + self._hypervisor.decrease_memory_load(self._ram) self._ram = ram - self._hypervisor.increase_memory_load(self._ram) + self._hypervisor.increase_memory_load(ram) @property def nvram(self): diff --git a/gns3server/modules/iou/__init__.py b/gns3server/modules/iou/__init__.py index 30a0e521..b01e156b 100644 --- a/gns3server/modules/iou/__init__.py +++ b/gns3server/modules/iou/__init__.py @@ -201,7 +201,7 @@ class IOU(IModule): log.info("iouyap path set to {}".format(self._iouyap)) if "working_dir" in request: - new_working_dir = os.path.join(request["working_dir"], "iou") + new_working_dir = request["working_dir"] log.info("this server is local with working directory path to {}".format(new_working_dir)) else: new_working_dir = os.path.join(self._projects_dir, request["project_name"]) diff --git a/setup.py b/setup.py index 45772e4e..18e3c432 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ setup( long_description=open("README.rst", "r").read(), install_requires=[ "tornado >= 3.1", - "pyzmq == 14.0.1", + "pyzmq", ], entry_points={ "console_scripts": [