mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Merge pull request #47 from planctechnologies/pr2
Support IOU devices on cloud instances
This commit is contained in:
commit
bba2c2b0d3
@ -155,6 +155,7 @@ class VM(object):
|
|||||||
|
|
||||||
provider = get_provider(self._cloud_settings)
|
provider = get_provider(self._cloud_settings)
|
||||||
provider.download_file(full_cloud_path, updated_image_path)
|
provider.download_file(full_cloud_path, updated_image_path)
|
||||||
|
image = updated_image_path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if platform not in PLATFORMS:
|
if platform not in PLATFORMS:
|
||||||
|
@ -21,12 +21,14 @@ IOU server module.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import socket
|
import socket
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from gns3server.modules import IModule
|
from gns3server.modules import IModule
|
||||||
from gns3server.config import Config
|
from gns3server.config import Config
|
||||||
|
from gns3dms.cloud.rackspace_ctrl import get_provider
|
||||||
from .iou_device import IOUDevice
|
from .iou_device import IOUDevice
|
||||||
from .iou_error import IOUError
|
from .iou_error import IOUError
|
||||||
from .nios.nio_udp import NIO_UDP
|
from .nios.nio_udp import NIO_UDP
|
||||||
@ -299,6 +301,20 @@ class IOU(IModule):
|
|||||||
updated_iou_path = os.path.join(self.images_directory, iou_path)
|
updated_iou_path = os.path.join(self.images_directory, iou_path)
|
||||||
if os.path.isfile(updated_iou_path):
|
if os.path.isfile(updated_iou_path):
|
||||||
iou_path = updated_iou_path
|
iou_path = updated_iou_path
|
||||||
|
else:
|
||||||
|
if not os.path.exists(self.images_directory):
|
||||||
|
os.mkdir(self.images_directory)
|
||||||
|
if request.get("cloud_path", None):
|
||||||
|
# Download the image from cloud files
|
||||||
|
cloud_path = request.get("cloud_path")
|
||||||
|
full_cloud_path = "/".join((cloud_path, iou_path))
|
||||||
|
|
||||||
|
provider = get_provider(self._cloud_settings)
|
||||||
|
provider.download_file(full_cloud_path, updated_iou_path)
|
||||||
|
# Make file executable
|
||||||
|
st = os.stat(updated_iou_path)
|
||||||
|
os.chmod(updated_iou_path, st.st_mode | stat.S_IEXEC)
|
||||||
|
iou_path = updated_iou_path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
iou_instance = IOUDevice(name,
|
iou_instance = IOUDevice(name,
|
||||||
|
@ -40,6 +40,10 @@ IOU_CREATE_SCHEMA = {
|
|||||||
"description": "path to the IOU executable",
|
"description": "path to the IOU executable",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"minLength": 1,
|
"minLength": 1,
|
||||||
|
},
|
||||||
|
"cloud_path": {
|
||||||
|
"description": "Path to the image in the cloud object store",
|
||||||
|
"type": "string",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
|
Loading…
Reference in New Issue
Block a user