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

Have the server look in the right place for relative image paths.

This commit is contained in:
grossmj 2015-03-09 21:57:21 -06:00
parent ad5548f70b
commit 5910b4b0be
3 changed files with 12 additions and 4 deletions

View File

@ -423,7 +423,7 @@ class Router(BaseVM):
if not os.path.isabs(image):
server_config = Config.instance().get_section_config("Server")
image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), image)
image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "IOS", image)
if not os.path.isfile(image):
raise DynamipsError("IOS image '{}' is not accessible".format(image))

View File

@ -133,7 +133,7 @@ class IOUVM(BaseVM):
if not os.path.isabs(path):
server_config = Config.instance().get_section_config("Server")
path = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), path)
path = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "IOU", path)
self._path = path
if not os.path.isfile(self._path) or not os.path.exists(self._path):

View File

@ -185,7 +185,7 @@ class QemuVM(BaseVM):
if os.path.isabs(hda_disk_image):
server_config = Config.instance().get_section_config("Server")
hda_disk_image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), hda_disk_image)
hda_disk_image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "QEMU", hda_disk_image)
log.info("QEMU VM {name} [id={id}] has set the QEMU hda disk image path to {disk_image}".format(name=self._name,
id=self._id,
@ -212,7 +212,7 @@ class QemuVM(BaseVM):
if not os.path.isabs(hdb_disk_image):
server_config = Config.instance().get_section_config("Server")
hdb_disk_image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), hdb_disk_image)
hdb_disk_image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "QEMU", hdb_disk_image)
log.info("QEMU VM {name} [id={id}] has set the QEMU hdb disk image path to {disk_image}".format(name=self._name,
id=self._id,
@ -406,6 +406,10 @@ class QemuVM(BaseVM):
:param initrd: QEMU initrd path
"""
if os.path.isabs(initrd):
server_config = Config.instance().get_section_config("Server")
initrd = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "QEMU", initrd)
log.info("QEMU VM {name} [id={id}] has set the QEMU initrd path to {initrd}".format(name=self._name,
id=self._id,
initrd=initrd))
@ -429,6 +433,10 @@ class QemuVM(BaseVM):
:param kernel_image: QEMU kernel image path
"""
if os.path.isabs(kernel_image):
server_config = Config.instance().get_section_config("Server")
kernel_image = os.path.join(os.path.expanduser(server_config.get("images_path", "~/GNS3/images")), "QEMU", kernel_image)
log.info("QEMU VM {name} [id={id}] has set the QEMU kernel image path to {kernel_image}".format(name=self._name,
id=self._id,
kernel_image=kernel_image))