mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch '2.2' into import-export-refactoring
This commit is contained in:
commit
b0df7ecabf
14 files changed
+69
-13
No files matched your search
@@ -37,7 +37,7 @@ class Drawing:
|
||||
text, images, rectangle... They are pure SVG elements.
|
||||
"""
|
||||
|
||||
def __init__(self, project, drawing_id=None, svg="<svg></svg>", x=0, y=0, z=2, rotation=0):
|
||||
def __init__(self, project, drawing_id=None, svg="<svg></svg>", x=0, y=0, z=2, locked=False, rotation=0):
|
||||
self._project = project
|
||||
if drawing_id is None:
|
||||
self._id = str(uuid.uuid4())
|
||||
@@ -49,6 +49,7 @@ class Drawing:
|
||||
self._y = y
|
||||
self._z = z
|
||||
self._rotation = rotation
|
||||
self._locked = locked
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
@@ -157,6 +158,14 @@ class Drawing:
|
||||
def z(self, val):
|
||||
self._z = val
|
||||
|
||||
@property
|
||||
def locked(self):
|
||||
return self._locked
|
||||
|
||||
@locked.setter
|
||||
def locked(self, val):
|
||||
self._locked = val
|
||||
|
||||
@property
|
||||
def rotation(self):
|
||||
return self._rotation
|
||||
@@ -198,6 +207,7 @@ class Drawing:
|
||||
"x": self._x,
|
||||
"y": self._y,
|
||||
"z": self._z,
|
||||
"locked": self._locked,
|
||||
"rotation": self._rotation,
|
||||
"svg": self._svg
|
||||
}
|
||||
@@ -207,6 +217,7 @@ class Drawing:
|
||||
"x": self._x,
|
||||
"y": self._y,
|
||||
"z": self._z,
|
||||
"locked": self._locked,
|
||||
"rotation": self._rotation,
|
||||
"svg": self.svg
|
||||
}
|
||||
|
||||
@@ -73,11 +73,12 @@ class VMwareGNS3VM(BaseGNS3VM):
|
||||
if vcpus > available_vcpus:
|
||||
raise GNS3VMError("You have allocated too many vCPUs for the GNS3 VM! (max available is {} vCPUs)".format(available_vcpus))
|
||||
|
||||
cores_per_sockets = int(available_vcpus / psutil.cpu_count(logical=False))
|
||||
try:
|
||||
pairs = VMware.parse_vmware_file(self._vmx_path)
|
||||
pairs["numvcpus"] = str(vcpus)
|
||||
pairs["cpuid.coresPerSocket"] = str(cores_per_sockets)
|
||||
cores_per_sockets = int(available_vcpus / psutil.cpu_count(logical=False))
|
||||
if cores_per_sockets >= 1:
|
||||
pairs["cpuid.corespersocket"] = str(cores_per_sockets)
|
||||
pairs["memsize"] = str(ram)
|
||||
VMware.write_vmx_file(self._vmx_path, pairs)
|
||||
log.info("GNS3 VM vCPU count set to {} and RAM amount set to {}".format(vcpus, ram))
|
||||
|
||||
@@ -34,7 +34,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
class Node:
|
||||
# This properties are used only on controller and are not forwarded to the compute
|
||||
CONTROLLER_ONLY_PROPERTIES = ["x", "y", "z", "width", "height", "symbol", "label", "console_host",
|
||||
CONTROLLER_ONLY_PROPERTIES = ["x", "y", "z", "locked", "width", "height", "symbol", "label", "console_host",
|
||||
"port_name_format", "first_port_name", "port_segment_size", "ports",
|
||||
"category", "console_auto_start"]
|
||||
|
||||
@@ -74,6 +74,7 @@ class Node:
|
||||
self._x = 0
|
||||
self._y = 0
|
||||
self._z = 1 # default z value is 1
|
||||
self._locked = False
|
||||
self._ports = None
|
||||
self._symbol = None
|
||||
self._custom_adapters = []
|
||||
@@ -236,6 +237,14 @@ class Node:
|
||||
def z(self, val):
|
||||
self._z = val
|
||||
|
||||
@property
|
||||
def locked(self):
|
||||
return self._locked
|
||||
|
||||
@locked.setter
|
||||
def locked(self, val):
|
||||
self._locked = val
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
return self._width
|
||||
@@ -681,6 +690,7 @@ class Node:
|
||||
"x": self._x,
|
||||
"y": self._y,
|
||||
"z": self._z,
|
||||
"locked": self._locked,
|
||||
"width": self._width,
|
||||
"height": self._height,
|
||||
"symbol": self._symbol,
|
||||
@@ -708,6 +718,7 @@ class Node:
|
||||
"x": self._x,
|
||||
"y": self._y,
|
||||
"z": self._z,
|
||||
"locked": self._locked,
|
||||
"width": self._width,
|
||||
"height": self._height,
|
||||
"symbol": self._symbol,
|
||||
|
||||
@@ -1075,6 +1075,7 @@ class Project:
|
||||
data['x'] = x
|
||||
data['y'] = y
|
||||
data['z'] = z
|
||||
data['locked'] = False # duplicated node must not be locked
|
||||
new_node_uuid = str(uuid.uuid4())
|
||||
new_node = await self.add_node(
|
||||
node.compute,
|
||||
|
||||
@@ -160,7 +160,7 @@ def load_topology(path):
|
||||
topo = _convert_2_1_0(topo, path)
|
||||
|
||||
# Version GNS3 2.2 dev (for project created with 2.2dev).
|
||||
# Appliance ID has been repleace by Template ID
|
||||
# Appliance ID has been replaced by Template ID
|
||||
if topo["revision"] == 9:
|
||||
for node in topo.get("topology", {}).get("nodes", []):
|
||||
if "appliance_id" in node:
|
||||
@@ -177,7 +177,7 @@ def load_topology(path):
|
||||
try:
|
||||
with open(path, "w+", encoding="utf-8") as f:
|
||||
json.dump(topo, f, indent=4, sort_keys=True)
|
||||
except (OSError) as e:
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPConflict(text="Can't write the topology {}: {}".format(path, str(e)))
|
||||
return topo
|
||||
|
||||
|
||||
Reference in new issue
Block a user