1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fixes issues with working dirs.

This commit is contained in:
grossmj 2014-04-15 22:11:34 -06:00
parent f99128b2a4
commit 732afb4ebd
5 changed files with 14 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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"])

View File

@ -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": [