Rename hypervisor to compute

Fix #487
This commit is contained in:
Julien Duponchelle committed 2016-04-15 17:59:59 +02:00
1 parent 3185baff0d
commit 58d4a529d4
186 files changed
+1173 -1206

No files matched your search

+4 -4
View File
@@ -36,7 +36,7 @@ class Documentation(object):
self._directory = directory
def write(self):
self.write_documentation("hypervisor")
self.write_documentation("compute")
# Controller documentation
self.write_documentation("controller")
@@ -49,8 +49,8 @@ class Documentation(object):
for handler_name in sorted(self._documentation):
if "controller." in handler_name:
server_type = "controller"
elif "hypervisor." in handler_name:
server_type = "hypervisor"
elif "compute" in handler_name:
server_type = "compute"
else:
server_type = "root"
@@ -122,7 +122,7 @@ class Documentation(object):
f.write("\n\n.. literalinclude:: ../../../examples/{}\n\n".format(query_path))
def _file_path(self, path):
path = path.replace("hypervisor", "")
path = path.replace("compute", "")
path = path.replace("controller", "")
return re.sub("^v2", "", re.sub("[^a-z0-9]", "", path))
+4 -4
View File
@@ -25,7 +25,7 @@ import traceback
log = logging.getLogger(__name__)
from ..hypervisor.vm_error import VMError
from ..compute.vm_error import VMError
from ..controller.controller_error import ControllerError
from ..ubridge.ubridge_error import UbridgeError
from .response import Response
@@ -127,8 +127,8 @@ class Route(object):
# Add the type of server to the route
if "controller" in func.__module__:
route = "/v{version}{path}".format(path=path, version=api_version)
elif "hypervisor" in func.__module__:
route = "/v{version}/hypervisor{path}".format(path=path, version=api_version)
elif "compute" in func.__module__:
route = "/v{version}/compute{path}".format(path=path, version=api_version)
else:
route = path
@@ -243,7 +243,7 @@ class Route(object):
if vm_id is None:
vm_id = request.match_info["device_id"]
if "hypervisor" in request.path:
if "compute" in request.path:
type = "compute"
else:
type = "controller"
+2 -34
View File
@@ -32,8 +32,8 @@ import atexit
from .route import Route
from .request_handler import RequestHandler
from ..config import Config
from ..hypervisor import MODULES
from ..hypervisor.port_manager import PortManager
from ..compute import MODULES
from ..compute.port_manager import PortManager
# do not delete this import
import gns3server.handlers
@@ -124,34 +124,6 @@ class WebServer:
else:
self._loop.add_signal_handler(getattr(signal, signal_name), callback)
def _reload_hook(self):
@asyncio.coroutine
def reload():
log.info("Reloading")
yield from self.shutdown_server()
os.execv(sys.executable, [sys.executable] + sys.argv)
# code extracted from tornado
for module in sys.hypervisor.values():
# Some hypervisor play games with sys.hypervisor (e.g. email/__init__.py
# in the standard library), and occasionally this can cause strange
# failures in getattr. Just ignore anything that's not an ordinary
# module.
if not isinstance(module, types.ModuleType):
continue
path = getattr(module, "__file__", None)
if not path:
continue
if path.endswith(".pyc") or path.endswith(".pyo"):
path = path[:-1]
modified = os.stat(path).st_mtime
if modified > self._start_time:
log.debug("File {} has been modified".format(path))
asyncio.async(reload())
self._loop.call_later(1, self._reload_hook)
def _create_ssl_context(self, server_config):
import ssl
@@ -245,10 +217,6 @@ class WebServer:
self._signal_handling()
self._exit_handling()
if server_config.getboolean("live"):
log.info("Code live reload is enabled, watching for file changes")
self._loop.call_later(1, self._reload_hook)
if server_config.getboolean("shell"):
asyncio.async(self.start_shell())