mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-23 23:38:21 +00:00
Support for relative path in Dynamips.
This commit is contained in:
parent
de1be0961f
commit
473eb0280e
@ -33,6 +33,8 @@ log = logging.getLogger(__name__)
|
||||
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
|
||||
|
||||
|
||||
@ -413,6 +415,14 @@ class Router(BaseVM):
|
||||
:param image: path to IOS image file
|
||||
"""
|
||||
|
||||
if not os.path.dirname(image):
|
||||
# this must be a relative path
|
||||
server_config = Config.instance().get_section_config("Server")
|
||||
image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), image)
|
||||
|
||||
if not os.path.isfile(image):
|
||||
raise DynamipsError("IOS image '{}' is not accessible".format(image))
|
||||
|
||||
yield from self._hypervisor.send('vm set_ios "{name}" "{image}"'.format(name=self._name, image=image))
|
||||
|
||||
log.info('Router "{name}" [{id}]: has a new IOS image set: "{image}"'.format(name=self._name,
|
||||
|
Loading…
Reference in New Issue
Block a user