mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 00:08:11 +00:00
Fix issue when trying to rename a Dynamips node that is already powered on. Fixes #2824
This commit is contained in:
parent
63fb82a89d
commit
b0f74c2a5e
@ -1525,6 +1525,8 @@ class Router(BaseNode):
|
|||||||
:param new_name: new name string
|
:param new_name: new name string
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
await self._hypervisor.send('vm rename "{name}" "{new_name}"'.format(name=self._name, new_name=new_name))
|
||||||
|
|
||||||
# change the hostname in the startup-config
|
# change the hostname in the startup-config
|
||||||
if os.path.isfile(self.startup_config_path):
|
if os.path.isfile(self.startup_config_path):
|
||||||
try:
|
try:
|
||||||
@ -1547,7 +1549,6 @@ class Router(BaseNode):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise DynamipsError("Could not amend the configuration {}: {}".format(self.private_config_path, e))
|
raise DynamipsError("Could not amend the configuration {}: {}".format(self.private_config_path, e))
|
||||||
|
|
||||||
await self._hypervisor.send('vm rename "{name}" "{new_name}"'.format(name=self._name, new_name=new_name))
|
|
||||||
log.info('Router "{name}" [{id}]: renamed to "{new_name}"'.format(name=self._name, id=self._id, new_name=new_name))
|
log.info('Router "{name}" [{id}]: renamed to "{new_name}"'.format(name=self._name, id=self._id, new_name=new_name))
|
||||||
self._name = new_name
|
self._name = new_name
|
||||||
|
|
||||||
|
@ -388,7 +388,6 @@ class Node:
|
|||||||
|
|
||||||
# When updating properties used only on controller we don't need to call the compute
|
# When updating properties used only on controller we don't need to call the compute
|
||||||
update_compute = False
|
update_compute = False
|
||||||
|
|
||||||
old_json = self.__json__()
|
old_json = self.__json__()
|
||||||
|
|
||||||
compute_properties = None
|
compute_properties = None
|
||||||
@ -402,6 +401,8 @@ class Node:
|
|||||||
if prop == "properties":
|
if prop == "properties":
|
||||||
compute_properties = kwargs[prop]
|
compute_properties = kwargs[prop]
|
||||||
else:
|
else:
|
||||||
|
if prop == "name" and self.node_type == "dynamips" and self.status == "started":
|
||||||
|
raise aiohttp.web.HTTPConflict(text="Sorry, it is not possible rename of a Dynamips node that is already powered on")
|
||||||
setattr(self, prop, kwargs[prop])
|
setattr(self, prop, kwargs[prop])
|
||||||
|
|
||||||
if compute_properties and "custom_adapters" in compute_properties:
|
if compute_properties and "custom_adapters" in compute_properties:
|
||||||
|
Loading…
Reference in New Issue
Block a user