mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Add appliance UUID added to the node data. Fixes #1334.
This commit is contained in:
parent
a54359d243
commit
89f7169589
@ -38,13 +38,14 @@ class Node:
|
|||||||
"port_name_format", "first_port_name", "port_segment_size", "ports",
|
"port_name_format", "first_port_name", "port_segment_size", "ports",
|
||||||
"category", "console_auto_start"]
|
"category", "console_auto_start"]
|
||||||
|
|
||||||
def __init__(self, project, compute, name, node_id=None, node_type=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 server 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
|
||||||
|
:param appliance_id: Appliance ID used to create this node
|
||||||
:param kwargs: Node properties
|
:param kwargs: Node properties
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ class Node:
|
|||||||
self._command_line = None
|
self._command_line = None
|
||||||
self._node_directory = None
|
self._node_directory = None
|
||||||
self._status = "stopped"
|
self._status = "stopped"
|
||||||
|
self._appliance_id = appliance_id
|
||||||
self._x = 0
|
self._x = 0
|
||||||
self._y = 0
|
self._y = 0
|
||||||
self._z = 1 # default z value is 1
|
self._z = 1 # default z value is 1
|
||||||
@ -683,6 +685,7 @@ class Node:
|
|||||||
"compute_id": str(self._compute.id),
|
"compute_id": str(self._compute.id),
|
||||||
"node_id": self._id,
|
"node_id": self._id,
|
||||||
"node_type": self._node_type,
|
"node_type": self._node_type,
|
||||||
|
"appliance_id": self._appliance_id,
|
||||||
"name": self._name,
|
"name": self._name,
|
||||||
"console": self._console,
|
"console": self._console,
|
||||||
"console_type": self._console_type,
|
"console_type": self._console_type,
|
||||||
@ -704,6 +707,7 @@ class Node:
|
|||||||
"compute_id": str(self._compute.id),
|
"compute_id": str(self._compute.id),
|
||||||
"project_id": self._project.id,
|
"project_id": self._project.id,
|
||||||
"node_id": self._id,
|
"node_id": self._id,
|
||||||
|
"appliance_id": self._appliance_id,
|
||||||
"node_type": self._node_type,
|
"node_type": self._node_type,
|
||||||
"node_directory": self._node_directory,
|
"node_directory": self._node_directory,
|
||||||
"name": self._name,
|
"name": self._name,
|
||||||
|
@ -480,7 +480,7 @@ class Project:
|
|||||||
default_name_format = template.pop("default_name_format", "{name}-{0}")
|
default_name_format = template.pop("default_name_format", "{name}-{0}")
|
||||||
name = default_name_format.replace("{name}", name)
|
name = default_name_format.replace("{name}", name)
|
||||||
node_id = str(uuid.uuid4())
|
node_id = str(uuid.uuid4())
|
||||||
node = yield from self.add_node(compute, name, node_id, node_type=node_type, **template)
|
node = yield from self.add_node(compute, name, node_id, node_type=node_type, appliance_id=appliance_id, **template)
|
||||||
return node
|
return node
|
||||||
|
|
||||||
@open_required
|
@open_required
|
||||||
|
@ -119,6 +119,13 @@ NODE_OBJECT_SCHEMA = {
|
|||||||
"maxLength": 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}$"
|
"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}$"
|
||||||
},
|
},
|
||||||
|
"appliance_id": {
|
||||||
|
"description": "Appliance UUID from which the node has been created. Read only",
|
||||||
|
"type": ["null", "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}$"
|
||||||
|
},
|
||||||
"node_type": NODE_TYPE_SCHEMA,
|
"node_type": NODE_TYPE_SCHEMA,
|
||||||
"node_directory": {
|
"node_directory": {
|
||||||
"description": "Working directory of the node. Read only",
|
"description": "Working directory of the node. Read only",
|
||||||
|
Loading…
Reference in New Issue
Block a user