mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fixes issues with working dirs.
This commit is contained in:
parent
f99128b2a4
commit
732afb4ebd
@ -274,7 +274,7 @@ class Dynamips(IModule):
|
|||||||
e))
|
e))
|
||||||
return
|
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
|
self._working_dir = new_working_dir
|
||||||
|
|
||||||
# apply settings to the hypervisor manager
|
# apply settings to the hypervisor manager
|
||||||
|
@ -22,6 +22,8 @@ Manages Dynamips hypervisors (load-balancing etc.)
|
|||||||
from .hypervisor import Hypervisor
|
from .hypervisor import Hypervisor
|
||||||
from .dynamips_error import DynamipsError
|
from .dynamips_error import DynamipsError
|
||||||
from pkg_resources import parse_version
|
from pkg_resources import parse_version
|
||||||
|
|
||||||
|
import os
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
@ -126,12 +128,12 @@ class HypervisorManager(object):
|
|||||||
:param working_dir: path to Dynamips working directory
|
: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))
|
log.info("working directory set to {}".format(self._working_dir))
|
||||||
|
|
||||||
# update all existing hypervisors with the new working directory
|
# update all existing hypervisors with the new working directory
|
||||||
for hypervisor in self._hypervisors:
|
for hypervisor in self._hypervisors:
|
||||||
hypervisor.working_dir = working_dir
|
hypervisor.working_dir = self._working_dir
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def base_hypervisor_port(self):
|
def base_hypervisor_port(self):
|
||||||
@ -529,7 +531,7 @@ class HypervisorManager(object):
|
|||||||
log.warn("hypervisor {}:{} has a memory load below 0 ({})".format(hypervisor.host,
|
log.warn("hypervisor {}:{} has a memory load below 0 ({})".format(hypervisor.host,
|
||||||
hypervisor.port,
|
hypervisor.port,
|
||||||
hypervisor.memory_load))
|
hypervisor.memory_load))
|
||||||
hypervisor.memory_load = 0
|
#hypervisor.memory_load = 0
|
||||||
|
|
||||||
# memory load at 0MB and no devices managed anymore...
|
# memory load at 0MB and no devices managed anymore...
|
||||||
# let's stop this hypervisor
|
# let's stop this hypervisor
|
||||||
|
@ -274,12 +274,14 @@ class Router(object):
|
|||||||
if self.console and self.aux:
|
if self.console and self.aux:
|
||||||
# check that console and aux ports are available
|
# check that console and aux ports are available
|
||||||
try:
|
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:
|
except DynamipsError:
|
||||||
raise DynamipsError("console port {} is not available".format(self.console))
|
raise DynamipsError("console port {} is not available".format(self.console))
|
||||||
|
|
||||||
try:
|
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:
|
except DynamipsError:
|
||||||
raise DynamipsError("aux port {} is not available".format(self.aux))
|
raise DynamipsError("aux port {} is not available".format(self.aux))
|
||||||
|
|
||||||
@ -539,9 +541,9 @@ class Router(object):
|
|||||||
old_ram=self._ram,
|
old_ram=self._ram,
|
||||||
new_ram=ram))
|
new_ram=ram))
|
||||||
|
|
||||||
self._hypervisor.decrease_memory_load(ram)
|
self._hypervisor.decrease_memory_load(self._ram)
|
||||||
self._ram = ram
|
self._ram = ram
|
||||||
self._hypervisor.increase_memory_load(self._ram)
|
self._hypervisor.increase_memory_load(ram)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def nvram(self):
|
def nvram(self):
|
||||||
|
@ -201,7 +201,7 @@ class IOU(IModule):
|
|||||||
log.info("iouyap path set to {}".format(self._iouyap))
|
log.info("iouyap path set to {}".format(self._iouyap))
|
||||||
|
|
||||||
if "working_dir" in request:
|
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))
|
log.info("this server is local with working directory path to {}".format(new_working_dir))
|
||||||
else:
|
else:
|
||||||
new_working_dir = os.path.join(self._projects_dir, request["project_name"])
|
new_working_dir = os.path.join(self._projects_dir, request["project_name"])
|
||||||
|
2
setup.py
2
setup.py
@ -46,7 +46,7 @@ setup(
|
|||||||
long_description=open("README.rst", "r").read(),
|
long_description=open("README.rst", "r").read(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"tornado >= 3.1",
|
"tornado >= 3.1",
|
||||||
"pyzmq == 14.0.1",
|
"pyzmq",
|
||||||
],
|
],
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
|
Loading…
Reference in New Issue
Block a user