mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-19 04:47:54 +00:00
Prevent vmname change for VirtualBox linked clone
Fix https://github.com/GNS3/gns3-gui/issues/1930
This commit is contained in:
parent
1b84874762
commit
2ddb329a90
@ -22,6 +22,7 @@ from gns3server.web.route import Route
|
|||||||
from gns3server.schemas.nio import NIO_SCHEMA
|
from gns3server.schemas.nio import NIO_SCHEMA
|
||||||
from gns3server.schemas.node import NODE_CAPTURE_SCHEMA
|
from gns3server.schemas.node import NODE_CAPTURE_SCHEMA
|
||||||
from gns3server.compute.virtualbox import VirtualBox
|
from gns3server.compute.virtualbox import VirtualBox
|
||||||
|
from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||||
from gns3server.compute.project_manager import ProjectManager
|
from gns3server.compute.project_manager import ProjectManager
|
||||||
|
|
||||||
from gns3server.schemas.virtualbox import (
|
from gns3server.schemas.virtualbox import (
|
||||||
@ -116,9 +117,15 @@ class VirtualBoxHandler:
|
|||||||
name = request.json.pop("name")
|
name = request.json.pop("name")
|
||||||
vmname = request.json.pop("vmname", None)
|
vmname = request.json.pop("vmname", None)
|
||||||
if name != vm.name:
|
if name != vm.name:
|
||||||
|
oldname = vm.name
|
||||||
vm.name = name
|
vm.name = name
|
||||||
if vm.linked_clone:
|
if vm.linked_clone:
|
||||||
yield from vm.set_vmname(vm.name)
|
try:
|
||||||
|
yield from vm.set_vmname(vm.name)
|
||||||
|
except VirtualBoxError as e: # In case of error we rollback (we can't change the name when running)
|
||||||
|
vm.name = oldname
|
||||||
|
vm.updated()
|
||||||
|
raise e
|
||||||
|
|
||||||
if "adapters" in request.json:
|
if "adapters" in request.json:
|
||||||
adapters = int(request.json.pop("adapters"))
|
adapters = int(request.json.pop("adapters"))
|
||||||
|
Loading…
Reference in New Issue
Block a user