mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Relative path support of IOU, IOS and Qemu images.
This commit is contained in:
1 parent
c41bec0516
commit
aebcd9f08b
4 files changed
+65
-31
No files matched your search
@@ -44,7 +44,6 @@ from .hypervisor import Hypervisor
|
||||
from .nodes.router import Router
|
||||
from .dynamips_vm import DynamipsVM
|
||||
from .dynamips_device import DynamipsDevice
|
||||
from gns3server.config import Config
|
||||
|
||||
# NIOs
|
||||
from .nios.nio_udp import NIOUDP
|
||||
@@ -312,7 +311,7 @@ class Dynamips(BaseManager):
|
||||
|
||||
# FIXME: hypervisor should always listen to 127.0.0.1
|
||||
# See https://github.com/GNS3/dynamips/issues/62
|
||||
server_config = Config.instance().get_section_config("Server")
|
||||
server_config = self.config.get_section_config("Server")
|
||||
server_host = server_config.get("host")
|
||||
|
||||
try:
|
||||
|
||||
@@ -34,7 +34,6 @@ from ...base_vm import BaseVM
|
||||
from ..dynamips_error import DynamipsError
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.asyncio import wait_run_in_executor
|
||||
|
||||
|
||||
@@ -152,6 +151,12 @@ class Router(BaseVM):
|
||||
"mac_addr": self._mac_addr,
|
||||
"system_id": self._system_id}
|
||||
|
||||
# return the relative path if the IOS image is in the images_path directory
|
||||
server_config = self.manager.config.get_section_config("Server")
|
||||
relative_image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "IOS", self._image)
|
||||
if os.path.exists(relative_image):
|
||||
router_info["image"] = os.path.basename(self._image)
|
||||
|
||||
# add the slots
|
||||
slot_number = 0
|
||||
for slot in self._slots:
|
||||
@@ -422,7 +427,7 @@ class Router(BaseVM):
|
||||
"""
|
||||
|
||||
if not os.path.isabs(image):
|
||||
server_config = Config.instance().get_section_config("Server")
|
||||
server_config = self.manager.config.get_section_config("Server")
|
||||
image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "IOS", image)
|
||||
|
||||
if not os.path.isfile(image):
|
||||
|
||||
Reference in new issue
Block a user