Try to fix VirtualBox create test.

This commit is contained in:
Jeremy committed 2015-01-20 15:28:40 -07:00
1 parent 984d47f9c8
commit 17f6223fb1
7 files changed
+29 -10

No files matched your search

+4 -2
View File
@@ -40,9 +40,11 @@ class VirtualBoxHandler:
def create(request, response):
vbox_manager = VirtualBox.instance()
vm = yield from vbox_manager.create_vm(request.json["name"], request.json.get("uuid"))
vm = yield from vbox_manager.create_vm(request.json["name"], request.json["project_uuid"], request.json.get("uuid"))
print(vm)
response.json({"name": vm.name,
"uuid": vm.uuid})
"uuid": vm.uuid,
"project_uuid": vm.project.uuid})
@classmethod
@Route.post(
+1
View File
@@ -95,6 +95,7 @@ class BaseManager:
:param project_identifier UUID of Project
:param uuid Force UUID force VM
"""
project = ProjectManager.instance().get_project(project_identifier)
# TODO: support for old projects VM with normal IDs.
@@ -53,9 +53,9 @@ class VirtualBoxVM(BaseVM):
_instances = []
_allocated_console_ports = []
def __init__(self, name, uuid, manager):
def __init__(self, name, uuid, project, manager):
super().__init__(name, uuid, manager)
super().__init__(name, uuid, project, manager)
self._system_properties = {}
+14
View File
@@ -46,6 +46,13 @@ VBOX_CREATE_SCHEMA = {
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_uuid": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
},
"additionalProperties": False,
"required": ["name", "vmname"],
@@ -68,6 +75,13 @@ VBOX_OBJECT_SCHEMA = {
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_uuid": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"console": {
"description": "console TCP port",
"minimum": 1,
+3 -1
View File
@@ -35,7 +35,6 @@ from .modules.port_manager import PortManager
# TODO: get rid of * have something generic to automatically import handlers so the routes can be found
from gns3server.handlers import *
from gns3server.handlers.virtualbox_handler import VirtualBoxHandler
import logging
log = logging.getLogger(__name__)
@@ -133,6 +132,9 @@ class Server:
Starts the server.
"""
logger = logging.getLogger("asyncio")
logger.setLevel(logging.WARNING)
# TODO: SSL support for Rackspace cloud integration (here or with nginx for instance).
self._loop = asyncio.get_event_loop()
app = aiohttp.web.Application()