1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 09:18:08 +00:00

Make sure nothing is named "compute server".

This commit is contained in:
grossmj 2018-11-27 18:14:51 +07:00
parent b4a2bc5b47
commit a17fa821bd
14 changed files with 44 additions and 44 deletions

View File

@ -22,7 +22,7 @@
* Add missing coroutine decorator Ref https://github.com/GNS3/gns3-gui/issues/2566 * Add missing coroutine decorator Ref https://github.com/GNS3/gns3-gui/issues/2566
* Refactor asyncio locking system for Python 3.7 support. Ref https://github.com/GNS3/gns3-gui/issues/2566 Ref https://github.com/GNS3/gns3-gui/issues/2568 * Refactor asyncio locking system for Python 3.7 support. Ref https://github.com/GNS3/gns3-gui/issues/2566 Ref https://github.com/GNS3/gns3-gui/issues/2568
* Use asyncio.ensure_future() instead of asyncio.async() with conservative approach to support Python < 3.4.4. Fixes https://github.com/GNS3/gns3-gui/issues/2566 * Use asyncio.ensure_future() instead of asyncio.async() with conservative approach to support Python < 3.4.4. Fixes https://github.com/GNS3/gns3-gui/issues/2566
* Forbid controller and compute servers to be different versions. Report last compute server error to clients and display in the server summary. * Forbid controller and computes to be different versions. Report last compute error to clients and display in the server summary.
* Fix exception with short names for Dynamips interfaces. Fixes #1386. * Fix exception with short names for Dynamips interfaces. Fixes #1386.
* Add missing Qemu boot priority values. Fixes https://github.com/GNS3/gns3-server/issues/1385 * Add missing Qemu boot priority values. Fixes https://github.com/GNS3/gns3-server/issues/1385
@ -553,7 +553,7 @@
* Trust user for host binding of link adress * Trust user for host binding of link adress
* Code cleanup for docker interface creation * Code cleanup for docker interface creation
* Fix a rare crash when writing a file on a remote server * Fix a rare crash when writing a file on a remote server
* Fix delete project on remote compute server * Fix delete project on remote compute
* Fix trouble with builtin devices when we free ports * Fix trouble with builtin devices when we free ports
* When a dynamips command failed display the full command to the user * When a dynamips command failed display the full command to the user
* Raise error when we can't found VboxManage at GNS3 VM startup * Raise error when we can't found VboxManage at GNS3 VM startup

View File

@ -5,11 +5,11 @@
POST /v2/computes POST /v2/computes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Register a compute server Register a compute
Response status codes Response status codes
********************** **********************
- **201**: Compute server added - **201**: Compute added
Input Input
******* *******
@ -34,7 +34,7 @@ Output
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr> <tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>capabilities</td> <td> </td> <td>object</td> <td>Get what a server support</td> </tr> <tr><td>capabilities</td> <td> </td> <td>object</td> <td>Get what a server support</td> </tr>
<tr><td>compute_id</td> <td>&#10004;</td> <td>string</td> <td>Server identifier</td> </tr> <tr><td>compute_id</td> <td>&#10004;</td> <td>string</td> <td>Server identifier</td> </tr>
<tr><td>connected</td> <td> </td> <td>boolean</td> <td>Whether the controller is connected to the compute server or not</td> </tr> <tr><td>connected</td> <td> </td> <td>boolean</td> <td>Whether the controller is connected to the compute or not</td> </tr>
<tr><td>cpu_usage_percent</td> <td> </td> <td>['number', 'null']</td> <td>CPU usage of the compute. Read only</td> </tr> <tr><td>cpu_usage_percent</td> <td> </td> <td>['number', 'null']</td> <td>CPU usage of the compute. Read only</td> </tr>
<tr><td>host</td> <td>&#10004;</td> <td>string</td> <td>Server host</td> </tr> <tr><td>host</td> <td>&#10004;</td> <td>string</td> <td>Server host</td> </tr>
<tr><td>last_error</td> <td> </td> <td>['string', 'null']</td> <td>Last error on the compute</td> </tr> <tr><td>last_error</td> <td> </td> <td>['string', 'null']</td> <td>Last error on the compute</td> </tr>
@ -48,9 +48,9 @@ Output
GET /v2/computes GET /v2/computes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List of compute servers List of computes
Response status codes Response status codes
********************** **********************
- **200**: Compute servers list returned - **200**: Compute list returned

View File

@ -5,11 +5,11 @@
PUT /v2/computes/**{compute_id}** PUT /v2/computes/**{compute_id}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update a compute server Update a compute
Response status codes Response status codes
********************** **********************
- **200**: Compute server updated - **200**: Compute
- **400**: Invalid request - **400**: Invalid request
- **404**: Instance doesn't exist - **404**: Instance doesn't exist
@ -36,7 +36,7 @@ Output
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr> <tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>capabilities</td> <td> </td> <td>object</td> <td>Get what a server support</td> </tr> <tr><td>capabilities</td> <td> </td> <td>object</td> <td>Get what a server support</td> </tr>
<tr><td>compute_id</td> <td>&#10004;</td> <td>string</td> <td>Server identifier</td> </tr> <tr><td>compute_id</td> <td>&#10004;</td> <td>string</td> <td>Server identifier</td> </tr>
<tr><td>connected</td> <td> </td> <td>boolean</td> <td>Whether the controller is connected to the compute server or not</td> </tr> <tr><td>connected</td> <td> </td> <td>boolean</td> <td>Whether the controller is connected to the compute or not</td> </tr>
<tr><td>cpu_usage_percent</td> <td> </td> <td>['number', 'null']</td> <td>CPU usage of the compute. Read only</td> </tr> <tr><td>cpu_usage_percent</td> <td> </td> <td>['number', 'null']</td> <td>CPU usage of the compute. Read only</td> </tr>
<tr><td>host</td> <td>&#10004;</td> <td>string</td> <td>Server host</td> </tr> <tr><td>host</td> <td>&#10004;</td> <td>string</td> <td>Server host</td> </tr>
<tr><td>last_error</td> <td> </td> <td>['string', 'null']</td> <td>Last error on the compute</td> </tr> <tr><td>last_error</td> <td> </td> <td>['string', 'null']</td> <td>Last error on the compute</td> </tr>
@ -50,11 +50,11 @@ Output
GET /v2/computes/**{compute_id}** GET /v2/computes/**{compute_id}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get a compute server information Get a compute information
Response status codes Response status codes
********************** **********************
- **200**: Compute server information returned - **200**: Compute information returned
Output Output
******* *******
@ -64,7 +64,7 @@ Output
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr> <tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>capabilities</td> <td> </td> <td>object</td> <td>Get what a server support</td> </tr> <tr><td>capabilities</td> <td> </td> <td>object</td> <td>Get what a server support</td> </tr>
<tr><td>compute_id</td> <td>&#10004;</td> <td>string</td> <td>Server identifier</td> </tr> <tr><td>compute_id</td> <td>&#10004;</td> <td>string</td> <td>Server identifier</td> </tr>
<tr><td>connected</td> <td> </td> <td>boolean</td> <td>Whether the controller is connected to the compute server or not</td> </tr> <tr><td>connected</td> <td> </td> <td>boolean</td> <td>Whether the controller is connected to the compute or not</td> </tr>
<tr><td>cpu_usage_percent</td> <td> </td> <td>['number', 'null']</td> <td>CPU usage of the compute. Read only</td> </tr> <tr><td>cpu_usage_percent</td> <td> </td> <td>['number', 'null']</td> <td>CPU usage of the compute. Read only</td> </tr>
<tr><td>host</td> <td>&#10004;</td> <td>string</td> <td>Server host</td> </tr> <tr><td>host</td> <td>&#10004;</td> <td>string</td> <td>Server host</td> </tr>
<tr><td>last_error</td> <td> </td> <td>['string', 'null']</td> <td>Last error on the compute</td> </tr> <tr><td>last_error</td> <td> </td> <td>['string', 'null']</td> <td>Last error on the compute</td> </tr>

View File

@ -28,7 +28,7 @@ Check the server version with a simple curl command:
List computes List computes
############## ##############
List all the compute servers: List all the computes:
.. code-block:: shell-session .. code-block:: shell-session
@ -45,7 +45,7 @@ List all the compute servers:
} }
] ]
There is only one compute server where nodes can be run in this example. There is only one compute where nodes can be run in this example.
This compute as a special id: local, this is the local server which is embedded in the GNS3 controller. This compute as a special id: local, this is the local server which is embedded in the GNS3 controller.
Create a project Create a project

View File

@ -11,7 +11,7 @@ Controller endpoints
The controller manages everything, it is the central decision point The controller manages everything, it is the central decision point
and has a complete view of your network topologies, what nodes run on and has a complete view of your network topologies, what nodes run on
which compute server, the links between them etc. which compute, the links between them etc.
This is the high level API which can be used by users to manually control This is the high level API which can be used by users to manually control
the GNS3 backend. The controller will call the compute endpoints when needed. the GNS3 backend. The controller will call the compute endpoints when needed.

View File

@ -154,7 +154,7 @@
] ]
}, },
"connected": { "connected": {
"description": "Whether the controller is connected to the compute server or not", "description": "Whether the controller is connected to the compute or not",
"type": "boolean" "type": "boolean"
}, },
"cpu_usage_percent": { "cpu_usage_percent": {

View File

@ -23,7 +23,7 @@ from ..notification_queue import NotificationQueue
class NotificationManager: class NotificationManager:
""" """
Manage the notification queue where the controller Manage the notification queue where the controller
will connect to get notifications from compute servers will connect to get notifications from computes
""" """
def __init__(self): def __init__(self):

View File

@ -46,7 +46,7 @@ log = logging.getLogger(__name__)
class Controller: class Controller:
""" """
The controller is responsible to manage one or more compute servers. The controller is responsible to manage one or more computes.
""" """
def __init__(self): def __init__(self):
@ -542,9 +542,9 @@ class Controller:
async def add_compute(self, compute_id=None, name=None, force=False, connect=True, **kwargs): async def add_compute(self, compute_id=None, name=None, force=False, connect=True, **kwargs):
""" """
Add a server to the dictionary of compute servers controlled by this controller Add a server to the dictionary of computes controlled by this controller
:param compute_id: Compute server identifier :param compute_id: Compute identifier
:param name: Compute name :param name: Compute name
:param force: True skip security check :param force: True skip security check
:param connect: True connect to the compute immediately :param connect: True connect to the compute immediately
@ -604,7 +604,7 @@ class Controller:
""" """
Delete a compute node. Project using this compute will be close Delete a compute node. Project using this compute will be close
:param compute_id: Compute server identifier :param compute_id: Compute identifier
""" """
try: try:
@ -628,14 +628,14 @@ class Controller:
@property @property
def computes(self): def computes(self):
""" """
:returns: The dictionary of compute server managed by this controller :returns: The dictionary of computes managed by this controller
""" """
return self._computes return self._computes
def get_compute(self, compute_id): def get_compute(self, compute_id):
""" """
Returns a compute server or raise a 404 error. Returns a compute or raise a 404 error.
""" """
try: try:

View File

@ -410,9 +410,9 @@ class Compute:
msg = "GNS3 version {} is not the same as the GNS3 VM version {}. Please upgrade the GNS3 VM.".format(__version__, msg = "GNS3 version {} is not the same as the GNS3 VM version {}. Please upgrade the GNS3 VM.".format(__version__,
response.json["version"]) response.json["version"])
else: else:
msg = "GNS3 controller version {} is not the same as compute server {} version {}".format(__version__, msg = "GNS3 controller version {} is not the same as compute {} version {}".format(__version__,
self._name, self._name,
response.json["version"]) response.json["version"])
if __version_info__[3] == 0: if __version_info__[3] == 0:
# Stable release # Stable release
log.error(msg) log.error(msg)

View File

@ -95,7 +95,7 @@ async def export_project(project, temporary_dir, include_images=False, keep_comp
try: try:
data = await response.content.read(1024) data = await response.content.read(1024)
except asyncio.TimeoutError: except asyncio.TimeoutError:
raise aiohttp.web.HTTPRequestTimeout(text="Timeout when downloading file '{}' from remote compute server {}:{}".format(compute_file["path"], compute.host, compute.port)) raise aiohttp.web.HTTPRequestTimeout(text="Timeout when downloading file '{}' from remote compute {}:{}".format(compute_file["path"], compute.host, compute.port))
if not data: if not data:
break break
f.write(data) f.write(data)
@ -256,7 +256,7 @@ async def _export_remote_images(project, compute_id, image_type, image, project_
Export specific image from remote compute. Export specific image from remote compute.
""" """
log.info("Downloading image '{}' from compute server '{}'".format(image, compute_id)) log.info("Downloading image '{}' from compute '{}'".format(image, compute_id))
try: try:
compute = [compute for compute in project.computes if compute.id == compute_id][0] compute = [compute for compute in project.computes if compute.id == compute_id][0]
@ -274,7 +274,7 @@ async def _export_remote_images(project, compute_id, image_type, image, project_
try: try:
data = await response.content.read(1024) data = await response.content.read(1024)
except asyncio.TimeoutError: except asyncio.TimeoutError:
raise aiohttp.web.HTTPRequestTimeout(text="Timeout when downloading image '{}' from remote compute server {}:{}".format(image, compute.host, compute.port)) raise aiohttp.web.HTTPRequestTimeout(text="Timeout when downloading image '{}' from remote compute {}:{}".format(image, compute.host, compute.port))
if not data: if not data:
break break
f.write(data) f.write(data)

View File

@ -41,7 +41,7 @@ class Node:
def __init__(self, project, compute, name, node_id=None, node_type=None, appliance_id=None, **kwargs): def __init__(self, project, compute, name, node_id=None, node_type=None, appliance_id=None, **kwargs):
""" """
:param project: Project of the node :param project: Project of the node
:param compute: Compute server where the server will run :param compute: Compute where the server will run
:param name: Node name :param name: Node name
:param node_id: UUID of the node (integer) :param node_id: UUID of the node (integer)
:param node_type: Type of emulator :param node_type: Type of emulator
@ -345,7 +345,7 @@ class Node:
async def create(self): async def create(self):
""" """
Create the node on the compute server Create the node on the compute
""" """
data = self._node_data() data = self._node_data()
data["node_id"] = self._id data["node_id"] = self._id
@ -372,7 +372,7 @@ class Node:
async def update(self, **kwargs): async def update(self, **kwargs):
""" """
Update the node on the compute server Update the node on the compute
:param kwargs: Node properties :param kwargs: Node properties
""" """

View File

@ -31,13 +31,13 @@ log = logging.getLogger(__name__)
class ComputeHandler: class ComputeHandler:
"""API entry points for compute server management.""" """API entry points for compute management."""
@Route.post( @Route.post(
r"/computes", r"/computes",
description="Register a compute server", description="Register a compute",
status_codes={ status_codes={
201: "Compute server added" 201: "Compute added"
}, },
input=COMPUTE_CREATE_SCHEMA, input=COMPUTE_CREATE_SCHEMA,
output=COMPUTE_OBJECT_SCHEMA) output=COMPUTE_OBJECT_SCHEMA)
@ -49,9 +49,9 @@ class ComputeHandler:
@Route.get( @Route.get(
r"/computes", r"/computes",
description="List of compute servers", description="List of computes",
status_codes={ status_codes={
200: "Compute servers list returned" 200: "Computes list returned"
}) })
def list(request, response): def list(request, response):
@ -60,9 +60,9 @@ class ComputeHandler:
@Route.put( @Route.put(
r"/computes/{compute_id}", r"/computes/{compute_id}",
description="Update a compute server", description="Update a compute",
status_codes={ status_codes={
200: "Compute server updated", 200: "Compute updated",
400: "Invalid request", 400: "Invalid request",
404: "Instance doesn't exist" 404: "Instance doesn't exist"
}, },
@ -175,9 +175,9 @@ class ComputeHandler:
@Route.get( @Route.get(
r"/computes/{compute_id}", r"/computes/{compute_id}",
description="Get a compute server information", description="Get a compute information",
status_codes={ status_codes={
200: "Compute server information returned" 200: "Compute information returned"
}, },
output=COMPUTE_OBJECT_SCHEMA) output=COMPUTE_OBJECT_SCHEMA)
def get(request, response): def get(request, response):

View File

@ -43,7 +43,7 @@ class IndexHandler:
@Route.get( @Route.get(
r"/compute", r"/compute",
description="Resources used by the GNS3 compute servers" description="Resources used by the GNS3 computes"
) )
def compute(request, response): def compute(request, response):
response.template("compute.html", response.template("compute.html",

View File

@ -89,7 +89,7 @@ COMPUTE_OBJECT_SCHEMA = {
"type": ["string", "null"] "type": ["string", "null"]
}, },
"connected": { "connected": {
"description": "Whether the controller is connected to the compute server or not", "description": "Whether the controller is connected to the compute or not",
"type": "boolean" "type": "boolean"
}, },
"cpu_usage_percent": { "cpu_usage_percent": {