mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-19 04:47:54 +00:00
Port name format for 2.0
Ref #667, https://github.com/GNS3/gns3-gui/issues/1400
This commit is contained in:
parent
e40569a46f
commit
0573c3f7d5
@ -114,6 +114,9 @@ class QemuVM(BaseNode):
|
||||
self._acpi_shutdown = False
|
||||
self._cpu_throttling = 0 # means no CPU throttling
|
||||
self._process_priority = "low"
|
||||
self._first_port_name = ""
|
||||
self._port_segment_size = 0
|
||||
self._port_name_format = "Ethernet{0}"
|
||||
|
||||
self.mac_address = "" # this will generate a MAC address
|
||||
self.adapters = 1 # creates 1 adapter by default
|
||||
@ -753,6 +756,30 @@ class QemuVM(BaseNode):
|
||||
kernel_command_line=kernel_command_line))
|
||||
self._kernel_command_line = kernel_command_line
|
||||
|
||||
@property
|
||||
def port_name_format(self):
|
||||
return self._port_name_format
|
||||
|
||||
@port_name_format.setter
|
||||
def port_name_format(self, val):
|
||||
self._port_name_format = val
|
||||
|
||||
@property
|
||||
def port_segment_size(self):
|
||||
return self._port_segment_size
|
||||
|
||||
@port_segment_size.setter
|
||||
def port_segment_size(self, val):
|
||||
self._port_segment_size = val
|
||||
|
||||
@property
|
||||
def first_port_name(self):
|
||||
return self._first_port_name
|
||||
|
||||
@first_port_name.setter
|
||||
def first_port_name(self, val):
|
||||
self._first_port_name = val
|
||||
|
||||
@asyncio.coroutine
|
||||
def _set_process_priority(self):
|
||||
"""
|
||||
|
@ -71,6 +71,9 @@ class VirtualBoxVM(BaseNode):
|
||||
self._use_any_adapter = False
|
||||
self._ram = 0
|
||||
self._adapter_type = "Intel PRO/1000 MT Desktop (82540EM)"
|
||||
self._port_name_format = "Ethernet{0}"
|
||||
self._port_segment_size = 0
|
||||
self._first_port_name = None
|
||||
|
||||
def __json__(self):
|
||||
|
||||
@ -87,7 +90,10 @@ class VirtualBoxVM(BaseNode):
|
||||
"ram": self.ram,
|
||||
"status": self.status,
|
||||
"use_any_adapter": self.use_any_adapter,
|
||||
"linked_clone": self._linked_clone}
|
||||
"linked_clone": self._linked_clone,
|
||||
"port_name_format": self._port_name_format,
|
||||
"port_segment_size": self._port_segment_size,
|
||||
"first_port_name": self._first_port_name}
|
||||
if self._linked_clone:
|
||||
json["node_directory"] = self.working_dir
|
||||
else:
|
||||
@ -678,6 +684,30 @@ class VirtualBoxVM(BaseNode):
|
||||
id=self.id,
|
||||
adapter_type=adapter_type))
|
||||
|
||||
@property
|
||||
def port_name_format(self):
|
||||
return self._port_name_format
|
||||
|
||||
@port_name_format.setter
|
||||
def port_name_format(self, val):
|
||||
self._port_name_format = val
|
||||
|
||||
@property
|
||||
def port_segment_size(self):
|
||||
return self._port_segment_size
|
||||
|
||||
@port_segment_size.setter
|
||||
def port_segment_size(self, val):
|
||||
self._port_segment_size = val
|
||||
|
||||
@property
|
||||
def first_port_name(self):
|
||||
return self._first_port_name
|
||||
|
||||
@first_port_name.setter
|
||||
def first_port_name(self, val):
|
||||
self._first_port_name = val
|
||||
|
||||
@asyncio.coroutine
|
||||
def _get_vm_info(self):
|
||||
"""
|
||||
|
@ -70,6 +70,9 @@ class VMwareVM(BaseNode):
|
||||
self._ethernet_adapters = {}
|
||||
self._adapter_type = "e1000"
|
||||
self._use_any_adapter = False
|
||||
self._port_name_format = "Ethernet{0}"
|
||||
self._port_segment_size = 0
|
||||
self._first_port_name = None
|
||||
|
||||
if not os.path.exists(vmx_path):
|
||||
raise VMwareError('VMware VM "{name}" [{id}]: could not find VMX file "{vmx_path}"'.format(name=name, id=node_id, vmx_path=vmx_path))
|
||||
@ -89,7 +92,10 @@ class VMwareVM(BaseNode):
|
||||
"use_any_adapter": self.use_any_adapter,
|
||||
"status": self.status,
|
||||
"node_directory": self.working_dir,
|
||||
"linked_clone": self._linked_clone}
|
||||
"linked_clone": self._linked_clone,
|
||||
"port_name_format": self._port_name_format,
|
||||
"port_segment_size": self._port_segment_size,
|
||||
"first_port_name": self._first_port_name}
|
||||
return json
|
||||
|
||||
@property
|
||||
@ -732,6 +738,30 @@ class VMwareVM(BaseNode):
|
||||
log.info("VMware VM '{name}' [{id}] is not allowed to use any adapter".format(name=self.name, id=self.id))
|
||||
self._use_any_adapter = use_any_adapter
|
||||
|
||||
@property
|
||||
def port_name_format(self):
|
||||
return self._port_name_format
|
||||
|
||||
@port_name_format.setter
|
||||
def port_name_format(self, val):
|
||||
self._port_name_format = val
|
||||
|
||||
@property
|
||||
def port_segment_size(self):
|
||||
return self._port_segment_size
|
||||
|
||||
@port_segment_size.setter
|
||||
def port_segment_size(self, val):
|
||||
self._port_segment_size = val
|
||||
|
||||
@property
|
||||
def first_port_name(self):
|
||||
return self._first_port_name
|
||||
|
||||
@first_port_name.setter
|
||||
def first_port_name(self, val):
|
||||
self._first_port_name = val
|
||||
|
||||
@asyncio.coroutine
|
||||
def adapter_add_nio_binding(self, adapter_number, nio):
|
||||
"""
|
||||
|
@ -73,8 +73,9 @@ class Controller:
|
||||
user=server_config.get("user", ""),
|
||||
password=server_config.get("password", ""),
|
||||
force=True)
|
||||
yield from self.gns3vm.auto_start_vm()
|
||||
yield from self.load_projects()
|
||||
yield from self.gns3vm.auto_start_vm()
|
||||
yield from self._project_auto_open()
|
||||
|
||||
@asyncio.coroutine
|
||||
def stop(self):
|
||||
@ -345,6 +346,15 @@ class Controller:
|
||||
yield from project.open()
|
||||
return project
|
||||
|
||||
@asyncio.coroutine
|
||||
def _project_auto_open(self):
|
||||
"""
|
||||
Auto open the project with auto open enable
|
||||
"""
|
||||
for project in self._projects.values():
|
||||
if project.auto_open:
|
||||
yield from project.open()
|
||||
|
||||
def get_free_project_name(self, base_name):
|
||||
"""
|
||||
Generate a free project name base on the base name
|
||||
|
@ -200,6 +200,19 @@ QEMU_CREATE_SCHEMA = {
|
||||
"description": "Additional QEMU options",
|
||||
"type": ["string", "null"],
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": ["string", "null"],
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["name"],
|
||||
@ -377,6 +390,19 @@ QEMU_UPDATE_SCHEMA = {
|
||||
"description": "Additional QEMU options",
|
||||
"type": ["string", "null"],
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": ["string", "null"],
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
}
|
||||
@ -569,6 +595,19 @@ QEMU_OBJECT_SCHEMA = {
|
||||
"command_line": {
|
||||
"description": "Last command line used by GNS3 to start QEMU",
|
||||
"type": "string"
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": "string",
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
@ -612,7 +651,10 @@ QEMU_OBJECT_SCHEMA = {
|
||||
"options",
|
||||
"node_directory",
|
||||
"command_line",
|
||||
"status"]
|
||||
"status",
|
||||
"port_name_format",
|
||||
"first_port_name",
|
||||
"port_segment_size"]
|
||||
}
|
||||
|
||||
QEMU_BINARY_FILTER_SCHEMA = {
|
||||
|
@ -84,6 +84,19 @@ VBOX_CREATE_SCHEMA = {
|
||||
"description": "ACPI shutdown",
|
||||
"type": "boolean"
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["name", "vmname", "linked_clone"],
|
||||
@ -169,6 +182,19 @@ VBOX_OBJECT_SCHEMA = {
|
||||
"linked_clone": {
|
||||
"description": "Whether the VM is a linked clone or not",
|
||||
"type": "boolean"
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
|
@ -75,6 +75,19 @@ VMWARE_CREATE_SCHEMA = {
|
||||
"description": "Allow GNS3 to use any VMware adapter",
|
||||
"type": "boolean",
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["name", "vmx_path", "linked_clone"],
|
||||
@ -154,6 +167,19 @@ VMWARE_OBJECT_SCHEMA = {
|
||||
"linked_clone": {
|
||||
"description": "Whether the VM is a linked clone or not",
|
||||
"type": "boolean"
|
||||
},
|
||||
"port_name_format": {
|
||||
"description": "Formating for port name {0} will be replace by port number",
|
||||
"type": "string"
|
||||
},
|
||||
"port_segment_size": {
|
||||
"description": "Size of the port segment",
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"first_port_name": {
|
||||
"description": "Name of the first port",
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": False
|
||||
|
Loading…
Reference in New Issue
Block a user