1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Option to use the default IOU RAM & NVRAM values.

This commit is contained in:
grossmj 2014-05-07 15:54:52 -06:00
parent 34ad75860d
commit 44bcc94e3e
2 changed files with 30 additions and 3 deletions

View File

@ -265,7 +265,7 @@ class IModule(multiprocessing.Process):
log.error("uncaught exception {type}".format(type=type(e)), exc_info=1) log.error("uncaught exception {type}".format(type=type(e)), exc_info=1)
exc_type, exc_value, exc_tb = sys.exc_info() exc_type, exc_value, exc_tb = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_tb) lines = traceback.format_exception(exc_type, exc_value, exc_tb)
tb = "\n" . join(lines) tb = "".join(lines)
self.send_custom_error("uncaught exception {type}: {string}\n{tb}".format(type=type(e), self.send_custom_error("uncaught exception {type}: {string}\n{tb}".format(type=type(e),
string=str(e), string=str(e),
tb=tb)) tb=tb))

View File

@ -98,6 +98,7 @@ class IOUDevice(object):
self._ethernet_adapters = [EthernetAdapter(), EthernetAdapter()] # one adapter = 4 interfaces self._ethernet_adapters = [EthernetAdapter(), EthernetAdapter()] # one adapter = 4 interfaces
self._serial_adapters = [SerialAdapter(), SerialAdapter()] # one adapter = 4 interfaces self._serial_adapters = [SerialAdapter(), SerialAdapter()] # one adapter = 4 interfaces
self._slots = self._ethernet_adapters + self._serial_adapters self._slots = self._ethernet_adapters + self._serial_adapters
self._use_default_iou_values = True # for RAM & NVRAM values
self._nvram = 128 # Kilobytes self._nvram = 128 # Kilobytes
self._startup_config = "" self._startup_config = ""
self._ram = 256 # Megabytes self._ram = 256 # Megabytes
@ -128,6 +129,7 @@ class IOUDevice(object):
iou_defaults = {"name": self._name, iou_defaults = {"name": self._name,
"path": self._path, "path": self._path,
"startup_config": self._startup_config, "startup_config": self._startup_config,
"use_default_iou_values": self._use_default_iou_values,
"ram": self._ram, "ram": self._ram,
"nvram": self._nvram, "nvram": self._nvram,
"ethernet_adapters": len(self._ethernet_adapters), "ethernet_adapters": len(self._ethernet_adapters),
@ -705,6 +707,7 @@ class IOUDevice(object):
command.extend(["-e", str(len(self._ethernet_adapters))]) command.extend(["-e", str(len(self._ethernet_adapters))])
if len(self._serial_adapters) != 2: if len(self._serial_adapters) != 2:
command.extend(["-s", str(len(self._serial_adapters))]) command.extend(["-s", str(len(self._serial_adapters))])
if not self.use_default_iou_values:
command.extend(["-n", str(self._nvram)]) command.extend(["-n", str(self._nvram)])
command.extend(["-m", str(self._ram)]) command.extend(["-m", str(self._ram)])
command.extend(["-L"]) # disable local console, use remote console command.extend(["-L"]) # disable local console, use remote console
@ -713,6 +716,30 @@ class IOUDevice(object):
command.extend([str(self._id)]) command.extend([str(self._id)])
return command return command
@property
def use_default_iou_values(self):
"""
Returns if this device uses the default IOU image values.
:returns: boolean
"""
return self._use_default_iou_values
@use_default_iou_values.setter
def use_default_iou_values(self, state):
"""
Sets if this device uses the default IOU image values.
:param state: boolean
"""
self._use_default_iou_values = state
if state:
log.info("IOU {name} [id={id}]: uses the default IOU image values".format(name=self._name, id=self._id))
else:
log.info("IOU {name} [id={id}]: does not use the default IOU image values".format(name=self._name, id=self._id))
@property @property
def ram(self): def ram(self):
""" """