mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Revert "Merge branch 'unstable'"
This reverts commit929c337e8b, reversing changes made tob9bc73fd01.
This commit is contained in:
1 parent
d18293ae7c
commit
359abb0286
24 files changed
+217
-677
No files matched your search
@@ -25,7 +25,6 @@ from ...schemas.dynamips_vm import VM_UPDATE_SCHEMA
|
||||
from ...schemas.dynamips_vm import VM_CAPTURE_SCHEMA
|
||||
from ...schemas.dynamips_vm import VM_OBJECT_SCHEMA
|
||||
from ...schemas.dynamips_vm import VM_CONFIGS_SCHEMA
|
||||
from ...schemas.dynamips_vm import VMS_LIST_SCHEMA
|
||||
from ...modules.dynamips import Dynamips
|
||||
from ...modules.project_manager import ProjectManager
|
||||
|
||||
@@ -422,17 +421,3 @@ class DynamipsVMHandler:
|
||||
idlepc = yield from dynamips_manager.auto_idlepc(vm)
|
||||
response.set_status(200)
|
||||
response.json({"idlepc": idlepc})
|
||||
|
||||
@Route.get(
|
||||
r"/dynamips/vms",
|
||||
status_codes={
|
||||
200: "List of Dynamips VM retrieved",
|
||||
},
|
||||
description="Retrieve the list of Dynamips VMS",
|
||||
output=VMS_LIST_SCHEMA)
|
||||
def list_vms(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
vms = yield from dynamips_manager.list_images()
|
||||
response.set_status(200)
|
||||
response.json(vms)
|
||||
@@ -1,60 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import aiohttp
|
||||
|
||||
from ...web.route import Route
|
||||
from ...schemas.file import FILE_STREAM_SCHEMA
|
||||
|
||||
|
||||
class FileHandler:
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/files/stream",
|
||||
description="Stream a file from the server",
|
||||
status_codes={
|
||||
200: "File retrieved",
|
||||
404: "File doesn't exist",
|
||||
409: "Can't access to file"
|
||||
},
|
||||
input=FILE_STREAM_SCHEMA
|
||||
)
|
||||
def read(request, response):
|
||||
response.enable_chunked_encoding()
|
||||
|
||||
try:
|
||||
with open(request.json.get("location"), "rb") as f:
|
||||
loop = asyncio.get_event_loop()
|
||||
response.content_type = "application/octet-stream"
|
||||
response.set_status(200)
|
||||
# Very important: do not send a content lenght otherwise QT close the connection but curl can consume the Feed
|
||||
response.content_length = None
|
||||
|
||||
response.start(request)
|
||||
|
||||
while True:
|
||||
data = yield from loop.run_in_executor(None, f.read, 16)
|
||||
if len(data) == 0:
|
||||
yield from asyncio.sleep(0.1)
|
||||
else:
|
||||
response.write(data)
|
||||
except FileNotFoundError:
|
||||
raise aiohttp.web.HTTPNotFound()
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPConflict(text=str(e))
|
||||
|
||||
@@ -25,7 +25,6 @@ from ...schemas.iou import IOU_UPDATE_SCHEMA
|
||||
from ...schemas.iou import IOU_OBJECT_SCHEMA
|
||||
from ...schemas.iou import IOU_CAPTURE_SCHEMA
|
||||
from ...schemas.iou import IOU_INITIAL_CONFIG_SCHEMA
|
||||
from ...schemas.iou import IOU_LIST_VMS_SCHEMA
|
||||
from ...modules.iou import IOU
|
||||
|
||||
|
||||
@@ -62,8 +61,6 @@ class IOUHandler:
|
||||
if name == "initial_config_content" and (vm.initial_config_content and len(vm.initial_config_content) > 0):
|
||||
continue
|
||||
setattr(vm, name, value)
|
||||
if "initial_config_content" in request.json:
|
||||
vm.initial_config = request.json.get("initial_config_content")
|
||||
response.set_status(201)
|
||||
response.json(vm)
|
||||
|
||||
@@ -111,8 +108,6 @@ class IOUHandler:
|
||||
for name, value in request.json.items():
|
||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||
setattr(vm, name, value)
|
||||
if "initial_config_content" in request.json:
|
||||
vm.initial_config = request.json.get("initial_config_content")
|
||||
response.json(vm)
|
||||
|
||||
@classmethod
|
||||
@@ -316,18 +311,3 @@ class IOUHandler:
|
||||
project_id=request.match_info["project_id"])
|
||||
response.set_status(200)
|
||||
response.json({"content": vm.initial_config_content})
|
||||
|
||||
@Route.get(
|
||||
r"/iou/vms",
|
||||
status_codes={
|
||||
200: "List of IOU VM retrieved",
|
||||
},
|
||||
description="Retrieve the list of IOU VMS",
|
||||
output=IOU_LIST_VMS_SCHEMA)
|
||||
def list_vms(request, response):
|
||||
|
||||
iou_manager = IOU.instance()
|
||||
vms = yield from iou_manager.list_images()
|
||||
response.set_status(200)
|
||||
response.json(vms)
|
||||
|
||||
@@ -22,7 +22,6 @@ from ...schemas.qemu import QEMU_CREATE_SCHEMA
|
||||
from ...schemas.qemu import QEMU_UPDATE_SCHEMA
|
||||
from ...schemas.qemu import QEMU_OBJECT_SCHEMA
|
||||
from ...schemas.qemu import QEMU_BINARY_LIST_SCHEMA
|
||||
from ...schemas.qemu import QEMU_LIST_IMAGES_SCHEMA
|
||||
from ...modules.qemu import Qemu
|
||||
|
||||
|
||||
@@ -291,17 +290,3 @@ class QEMUHandler:
|
||||
|
||||
binaries = yield from Qemu.binary_list()
|
||||
response.json(binaries)
|
||||
|
||||
@Route.get(
|
||||
r"/qemu/vms",
|
||||
status_codes={
|
||||
200: "List of Qemu images retrieved",
|
||||
},
|
||||
description="Retrieve the list of Qemu images",
|
||||
output=QEMU_LIST_IMAGES_SCHEMA)
|
||||
def list_vms(request, response):
|
||||
|
||||
qemu_manager = Qemu.instance()
|
||||
vms = yield from qemu_manager.list_images()
|
||||
response.set_status(200)
|
||||
response.json(vms)
|
||||
@@ -43,7 +43,7 @@ class VirtualBoxHandler:
|
||||
def show(request, response):
|
||||
|
||||
vbox_manager = VirtualBox.instance()
|
||||
vms = yield from vbox_manager.list_images()
|
||||
vms = yield from vbox_manager.get_list()
|
||||
response.json(vms)
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in new issue
Block a user