mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-13 04:48:22 +00:00
Change rename command to a name property setter for all Dynamips
devices. Adjust the tests and upload the new dynamips that supports the rename command for VMs.
This commit is contained in:
@ -163,6 +163,24 @@ class Router(object):
|
||||
|
||||
return self._name[1:-1] # remove quotes
|
||||
|
||||
@name.setter
|
||||
def name(self, new_name):
|
||||
"""
|
||||
Renames this router.
|
||||
|
||||
:param new_name: new name string
|
||||
"""
|
||||
|
||||
new_name = '"' + new_name + '"' # put the new name into quotes to protect spaces
|
||||
self._hypervisor.send("vm rename {name} {new_name}".format(name=self._name,
|
||||
new_name=new_name))
|
||||
|
||||
log.info("router {name} [id={id}]: renamed to {new_name}".format(name=self._name,
|
||||
id=self._id,
|
||||
new_name=new_name))
|
||||
|
||||
self._name = new_name
|
||||
|
||||
@property
|
||||
def platform(self):
|
||||
"""
|
||||
@ -202,23 +220,6 @@ class Router(object):
|
||||
|
||||
return self._hypervisor.send("vm list_con_ports")
|
||||
|
||||
def rename(self, new_name):
|
||||
"""
|
||||
Renames this router.
|
||||
|
||||
:param new_name: new name string
|
||||
"""
|
||||
|
||||
new_name = '"' + new_name + '"' # put the new name into quotes to protect spaces
|
||||
self._hypervisor.send("vm rename {name} {new_name}".format(name=self._name,
|
||||
new_name=new_name))
|
||||
|
||||
log.info("router {name} [id={id}]: renamed to {new_name}".format(name=self._name,
|
||||
id=self._id,
|
||||
new_name=new_name))
|
||||
|
||||
self._name = new_name
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this router.
|
||||
|
Reference in New Issue
Block a user