mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Harmonisation of slot, adapter notion
This commit is contained in:
parent
3ceb43fa62
commit
d323234520
@ -738,59 +738,59 @@ class IOUVM(BaseVM):
|
|||||||
|
|
||||||
self._slots = self._ethernet_adapters + self._serial_adapters
|
self._slots = self._ethernet_adapters + self._serial_adapters
|
||||||
|
|
||||||
def slot_add_nio_binding(self, slot_id, port_id, nio):
|
def slot_add_nio_binding(self, adapter_number, port_number, nio):
|
||||||
"""
|
"""
|
||||||
Adds a slot NIO binding.
|
Adds a slot NIO binding.
|
||||||
:param slot_id: slot ID
|
:param adapter_number: slot ID
|
||||||
:param port_id: port ID
|
:param port_number: port ID
|
||||||
:param nio: NIO instance to add to the slot/port
|
:param nio: NIO instance to add to the slot/port
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
adapter = self._slots[slot_id]
|
adapter = self._slots[adapter_number]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise IOUError("Slot {slot_id} doesn't exist on IOU {name}".format(name=self._name,
|
raise IOUError("Slot {adapter_number} doesn't exist on IOU {name}".format(name=self._name,
|
||||||
slot_id=slot_id))
|
adapter_number=adapter_number))
|
||||||
|
|
||||||
if not adapter.port_exists(port_id):
|
if not adapter.port_exists(port_number):
|
||||||
raise IOUError("Port {port_id} doesn't exist in adapter {adapter}".format(adapter=adapter,
|
raise IOUError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=adapter,
|
||||||
port_id=port_id))
|
port_number=port_number))
|
||||||
|
|
||||||
adapter.add_nio(port_id, nio)
|
adapter.add_nio(port_number, nio)
|
||||||
log.info("IOU {name} [id={id}]: {nio} added to {slot_id}/{port_id}".format(name=self._name,
|
log.info("IOU {name} [id={id}]: {nio} added to {adapter_number}/{port_number}".format(name=self._name,
|
||||||
id=self._id,
|
id=self._id,
|
||||||
nio=nio,
|
nio=nio,
|
||||||
slot_id=slot_id,
|
adapter_number=adapter_number,
|
||||||
port_id=port_id))
|
port_number=port_number))
|
||||||
if self.is_iouyap_running():
|
if self.is_iouyap_running():
|
||||||
self._update_iouyap_config()
|
self._update_iouyap_config()
|
||||||
os.kill(self._iouyap_process.pid, signal.SIGHUP)
|
os.kill(self._iouyap_process.pid, signal.SIGHUP)
|
||||||
|
|
||||||
def slot_remove_nio_binding(self, slot_id, port_id):
|
def slot_remove_nio_binding(self, adapter_number, port_number):
|
||||||
"""
|
"""
|
||||||
Removes a slot NIO binding.
|
Removes a slot NIO binding.
|
||||||
:param slot_id: slot ID
|
:param adapter_number: slot ID
|
||||||
:param port_id: port ID
|
:param port_number: port ID
|
||||||
:returns: NIO instance
|
:returns: NIO instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
adapter = self._slots[slot_id]
|
adapter = self._slots[adapter_number]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise IOUError("Slot {slot_id} doesn't exist on IOU {name}".format(name=self._name,
|
raise IOUError("Slot {adapter_number} doesn't exist on IOU {name}".format(name=self._name,
|
||||||
slot_id=slot_id))
|
adapter_number=adapter_number))
|
||||||
|
|
||||||
if not adapter.port_exists(port_id):
|
if not adapter.port_exists(port_number):
|
||||||
raise IOUError("Port {port_id} doesn't exist in adapter {adapter}".format(adapter=adapter,
|
raise IOUError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=adapter,
|
||||||
port_id=port_id))
|
port_number=port_number))
|
||||||
|
|
||||||
nio = adapter.get_nio(port_id)
|
nio = adapter.get_nio(port_number)
|
||||||
adapter.remove_nio(port_id)
|
adapter.remove_nio(port_number)
|
||||||
log.info("IOU {name} [id={id}]: {nio} removed from {slot_id}/{port_id}".format(name=self._name,
|
log.info("IOU {name} [id={id}]: {nio} removed from {adapter_number}/{port_number}".format(name=self._name,
|
||||||
id=self._id,
|
id=self._id,
|
||||||
nio=nio,
|
nio=nio,
|
||||||
slot_id=slot_id,
|
adapter_number=adapter_number,
|
||||||
port_id=port_id))
|
port_number=port_number))
|
||||||
if self.is_iouyap_running():
|
if self.is_iouyap_running():
|
||||||
self._update_iouyap_config()
|
self._update_iouyap_config()
|
||||||
os.kill(self._iouyap_process.pid, signal.SIGHUP)
|
os.kill(self._iouyap_process.pid, signal.SIGHUP)
|
||||||
|
Loading…
Reference in New Issue
Block a user