mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Rename modules => hypervisor
This commit is contained in:
parent
6fa2491255
commit
3296b97f59
@ -16,7 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Reads the configuration file and store the settings for the server & modules.
|
Reads the configuration file and store the settings for the server & hypervisor.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -20,7 +20,7 @@ from aiohttp.web import HTTPForbidden
|
|||||||
|
|
||||||
from ....web.route import Route
|
from ....web.route import Route
|
||||||
from ....config import Config
|
from ....config import Config
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
from ....schemas.hypervisor import HYPERVISOR_CREATE_SCHEMA, HYPERVISOR_OBJECT_SCHEMA
|
from ....schemas.hypervisor import HYPERVISOR_CREATE_SCHEMA, HYPERVISOR_OBJECT_SCHEMA
|
||||||
from ....controller import Controller
|
from ....controller import Controller
|
||||||
from ....controller.hypervisor import Hypervisor
|
from ....controller.hypervisor import Hypervisor
|
||||||
|
@ -19,7 +19,7 @@ import os
|
|||||||
from aiohttp.web import HTTPConflict
|
from aiohttp.web import HTTPConflict
|
||||||
|
|
||||||
from ....web.route import Route
|
from ....web.route import Route
|
||||||
from ....modules.docker import Docker
|
from ....hypervisor.docker import Docker
|
||||||
|
|
||||||
from ....schemas.docker import (
|
from ....schemas.docker import (
|
||||||
DOCKER_CREATE_SCHEMA,
|
DOCKER_CREATE_SCHEMA,
|
||||||
|
@ -23,7 +23,7 @@ from ....schemas.dynamips_device import DEVICE_UPDATE_SCHEMA
|
|||||||
from ....schemas.dynamips_device import DEVICE_OBJECT_SCHEMA
|
from ....schemas.dynamips_device import DEVICE_OBJECT_SCHEMA
|
||||||
from ....schemas.dynamips_device import DEVICE_NIO_SCHEMA
|
from ....schemas.dynamips_device import DEVICE_NIO_SCHEMA
|
||||||
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
||||||
from ....modules.dynamips import Dynamips
|
from ....hypervisor.dynamips import Dynamips
|
||||||
|
|
||||||
|
|
||||||
class DynamipsDeviceHandler:
|
class DynamipsDeviceHandler:
|
||||||
|
@ -27,9 +27,9 @@ from ....schemas.dynamips_vm import VM_UPDATE_SCHEMA
|
|||||||
from ....schemas.dynamips_vm import VM_OBJECT_SCHEMA
|
from ....schemas.dynamips_vm import VM_OBJECT_SCHEMA
|
||||||
from ....schemas.dynamips_vm import VM_CONFIGS_SCHEMA
|
from ....schemas.dynamips_vm import VM_CONFIGS_SCHEMA
|
||||||
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
||||||
from ....modules.dynamips import Dynamips
|
from ....hypervisor.dynamips import Dynamips
|
||||||
from ....modules.dynamips.dynamips_error import DynamipsError
|
from ....hypervisor.dynamips.dynamips_error import DynamipsError
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
|
|
||||||
DEFAULT_CHASSIS = {
|
DEFAULT_CHASSIS = {
|
||||||
"c1700": "1720",
|
"c1700": "1720",
|
||||||
|
@ -27,7 +27,7 @@ from ....schemas.iou import IOU_OBJECT_SCHEMA
|
|||||||
from ....schemas.iou import IOU_CONFIGS_SCHEMA
|
from ....schemas.iou import IOU_CONFIGS_SCHEMA
|
||||||
from ....schemas.vm import VM_LIST_IMAGES_SCHEMA
|
from ....schemas.vm import VM_LIST_IMAGES_SCHEMA
|
||||||
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
||||||
from ....modules.iou import IOU
|
from ....hypervisor.iou import IOU
|
||||||
|
|
||||||
|
|
||||||
class IOUHandler:
|
class IOUHandler:
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from ....web.route import Route
|
from ....web.route import Route
|
||||||
from ....modules.port_manager import PortManager
|
from ....hypervisor.port_manager import PortManager
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
from ....utils.interfaces import interfaces
|
from ....utils.interfaces import interfaces
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ import psutil
|
|||||||
|
|
||||||
from ....web.route import Route
|
from ....web.route import Route
|
||||||
from ....schemas.project import PROJECT_OBJECT_SCHEMA, PROJECT_CREATE_SCHEMA, PROJECT_UPDATE_SCHEMA, PROJECT_FILE_LIST_SCHEMA, PROJECT_LIST_SCHEMA
|
from ....schemas.project import PROJECT_OBJECT_SCHEMA, PROJECT_CREATE_SCHEMA, PROJECT_UPDATE_SCHEMA, PROJECT_FILE_LIST_SCHEMA, PROJECT_LIST_SCHEMA
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
from ....modules import MODULES
|
from ....hypervisor import MODULES
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
|
@ -20,7 +20,7 @@ import os.path
|
|||||||
|
|
||||||
from aiohttp.web import HTTPConflict
|
from aiohttp.web import HTTPConflict
|
||||||
from ....web.route import Route
|
from ....web.route import Route
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
from ....schemas.nio import NIO_SCHEMA
|
from ....schemas.nio import NIO_SCHEMA
|
||||||
from ....schemas.qemu import QEMU_CREATE_SCHEMA
|
from ....schemas.qemu import QEMU_CREATE_SCHEMA
|
||||||
from ....schemas.qemu import QEMU_UPDATE_SCHEMA
|
from ....schemas.qemu import QEMU_UPDATE_SCHEMA
|
||||||
@ -30,7 +30,7 @@ from ....schemas.qemu import QEMU_BINARY_LIST_SCHEMA
|
|||||||
from ....schemas.qemu import QEMU_CAPABILITY_LIST_SCHEMA
|
from ....schemas.qemu import QEMU_CAPABILITY_LIST_SCHEMA
|
||||||
from ....schemas.qemu import QEMU_IMAGE_CREATE_SCHEMA
|
from ....schemas.qemu import QEMU_IMAGE_CREATE_SCHEMA
|
||||||
from ....schemas.vm import VM_LIST_IMAGES_SCHEMA
|
from ....schemas.vm import VM_LIST_IMAGES_SCHEMA
|
||||||
from ....modules.qemu import Qemu
|
from ....hypervisor.qemu import Qemu
|
||||||
from ....config import Config
|
from ....config import Config
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ from ....schemas.virtualbox import VBOX_CREATE_SCHEMA
|
|||||||
from ....schemas.virtualbox import VBOX_UPDATE_SCHEMA
|
from ....schemas.virtualbox import VBOX_UPDATE_SCHEMA
|
||||||
from ....schemas.virtualbox import VBOX_OBJECT_SCHEMA
|
from ....schemas.virtualbox import VBOX_OBJECT_SCHEMA
|
||||||
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
||||||
from ....modules.virtualbox import VirtualBox
|
from ....hypervisor.virtualbox import VirtualBox
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
|
|
||||||
|
|
||||||
class VirtualBoxHandler:
|
class VirtualBoxHandler:
|
||||||
|
@ -24,8 +24,8 @@ from ....schemas.vmware import VMWARE_UPDATE_SCHEMA
|
|||||||
from ....schemas.vmware import VMWARE_OBJECT_SCHEMA
|
from ....schemas.vmware import VMWARE_OBJECT_SCHEMA
|
||||||
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
from ....schemas.vm import VM_CAPTURE_SCHEMA
|
||||||
from ....schemas.nio import NIO_SCHEMA
|
from ....schemas.nio import NIO_SCHEMA
|
||||||
from ....modules.vmware import VMware
|
from ....hypervisor.vmware import VMware
|
||||||
from ....modules.project_manager import ProjectManager
|
from ....hypervisor.project_manager import ProjectManager
|
||||||
|
|
||||||
|
|
||||||
class VMwareHandler:
|
class VMwareHandler:
|
||||||
|
@ -21,7 +21,7 @@ from ....schemas.nio import NIO_SCHEMA
|
|||||||
from ....schemas.vpcs import VPCS_CREATE_SCHEMA
|
from ....schemas.vpcs import VPCS_CREATE_SCHEMA
|
||||||
from ....schemas.vpcs import VPCS_UPDATE_SCHEMA
|
from ....schemas.vpcs import VPCS_UPDATE_SCHEMA
|
||||||
from ....schemas.vpcs import VPCS_OBJECT_SCHEMA
|
from ....schemas.vpcs import VPCS_OBJECT_SCHEMA
|
||||||
from ....modules.vpcs import VPCS
|
from ....hypervisor.vpcs import VPCS
|
||||||
|
|
||||||
|
|
||||||
class VPCSHandler:
|
class VPCSHandler:
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
|
|
||||||
from ..web.route import Route
|
from ..web.route import Route
|
||||||
from ..modules.port_manager import PortManager
|
from ..hypervisor.port_manager import PortManager
|
||||||
from ..modules.project_manager import ProjectManager
|
from ..hypervisor.project_manager import ProjectManager
|
||||||
from ..version import __version__
|
from ..version import __version__
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class DockerVM(BaseVM):
|
|||||||
"""
|
"""
|
||||||
binds = []
|
binds = []
|
||||||
|
|
||||||
binds.append("{}:/gns3:ro".format(get_resource("modules/docker/resources")))
|
binds.append("{}:/gns3:ro".format(get_resource("hypervisor/docker/resources")))
|
||||||
|
|
||||||
volumes = image_infos.get("ContainerConfig", {}).get("Volumes")
|
volumes = image_infos.get("ContainerConfig", {}).get("Volumes")
|
||||||
if volumes is None:
|
if volumes is None:
|
@ -152,7 +152,7 @@ class Project:
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def clean_old_path(self, old_path):
|
def clean_old_path(self, old_path):
|
||||||
"""
|
"""
|
||||||
Called after a project location change. All the modules should
|
Called after a project location change. All the hypervisor should
|
||||||
have been notified before
|
have been notified before
|
||||||
"""
|
"""
|
||||||
if self._temporary:
|
if self._temporary:
|
||||||
@ -343,10 +343,10 @@ class Project:
|
|||||||
Closes the project, but keep information on disk
|
Closes the project, but keep information on disk
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for module in self.modules():
|
for module in self.hypervisor():
|
||||||
yield from module.instance().project_closing(self)
|
yield from module.instance().project_closing(self)
|
||||||
yield from self._close_and_clean(self._temporary)
|
yield from self._close_and_clean(self._temporary)
|
||||||
for module in self.modules():
|
for module in self.hypervisor():
|
||||||
yield from module.instance().project_closed(self)
|
yield from module.instance().project_closed(self)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -400,7 +400,7 @@ class Project:
|
|||||||
vm = self._vms_to_destroy.pop()
|
vm = self._vms_to_destroy.pop()
|
||||||
yield from vm.delete()
|
yield from vm.delete()
|
||||||
self.remove_vm(vm)
|
self.remove_vm(vm)
|
||||||
for module in self.modules():
|
for module in self.hypervisor():
|
||||||
yield from module.instance().project_committed(self)
|
yield from module.instance().project_committed(self)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -409,10 +409,10 @@ class Project:
|
|||||||
Removes project from disk
|
Removes project from disk
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for module in self.modules():
|
for module in self.hypervisor():
|
||||||
yield from module.instance().project_closing(self)
|
yield from module.instance().project_closing(self)
|
||||||
yield from self._close_and_clean(True)
|
yield from self._close_and_clean(True)
|
||||||
for module in self.modules():
|
for module in self.hypervisor():
|
||||||
yield from module.instance().project_closed(self)
|
yield from module.instance().project_closed(self)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -430,13 +430,13 @@ class Project:
|
|||||||
log.warning("Purge old temporary project {}".format(project))
|
log.warning("Purge old temporary project {}".format(project))
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
|
||||||
def modules(self):
|
def hypervisor(self):
|
||||||
"""
|
"""
|
||||||
Returns all loaded VM modules.
|
Returns all loaded VM hypervisor.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# We import it at the last time to avoid circular dependencies
|
# We import it at the last time to avoid circular dependencies
|
||||||
from ..modules import MODULES
|
from ..hypervisor import MODULES
|
||||||
return MODULES
|
return MODULES
|
||||||
|
|
||||||
def emit(self, action, event):
|
def emit(self, action, event):
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user