|
|
|
@ -1084,24 +1084,24 @@ class QemuVM(BaseVM):
|
|
|
|
|
raise QemuError("Sorry, adding a link to a started Qemu VM is not supported.")
|
|
|
|
|
# FIXME: does the code below work? very undocumented feature...
|
|
|
|
|
# dynamically configure an UDP tunnel on the QEMU VM adapter
|
|
|
|
|
if nio and isinstance(nio, NIOUDP):
|
|
|
|
|
if self._legacy_networking:
|
|
|
|
|
yield from self._control_vm("host_net_remove {} gns3-{}".format(adapter_number, adapter_number))
|
|
|
|
|
yield from self._control_vm("host_net_add udp vlan={},name=gns3-{},sport={},dport={},daddr={}".format(adapter_number,
|
|
|
|
|
adapter_number,
|
|
|
|
|
nio.lport,
|
|
|
|
|
nio.rport,
|
|
|
|
|
nio.rhost))
|
|
|
|
|
else:
|
|
|
|
|
# Apparently there is a bug in Qemu...
|
|
|
|
|
# netdev_add [user|tap|socket|hubport|netmap],id=str[,prop=value][,...] -- add host network device
|
|
|
|
|
# netdev_del id -- remove host network device
|
|
|
|
|
yield from self._control_vm("netdev_del gns3-{}".format(adapter_number))
|
|
|
|
|
yield from self._control_vm("netdev_add socket,id=gns3-{},udp={}:{},localaddr={}:{}".format(adapter_number,
|
|
|
|
|
nio.rhost,
|
|
|
|
|
nio.rport,
|
|
|
|
|
self._host,
|
|
|
|
|
nio.lport))
|
|
|
|
|
# if nio and isinstance(nio, NIOUDP):
|
|
|
|
|
# if self._legacy_networking:
|
|
|
|
|
# yield from self._control_vm("host_net_remove {} gns3-{}".format(adapter_number, adapter_number))
|
|
|
|
|
# yield from self._control_vm("host_net_add udp vlan={},name=gns3-{},sport={},dport={},daddr={}".format(adapter_number,
|
|
|
|
|
# adapter_number,
|
|
|
|
|
# nio.lport,
|
|
|
|
|
# nio.rport,
|
|
|
|
|
# nio.rhost))
|
|
|
|
|
# else:
|
|
|
|
|
# # Apparently there is a bug in Qemu...
|
|
|
|
|
# # netdev_add [user|tap|socket|hubport|netmap],id=str[,prop=value][,...] -- add host network device
|
|
|
|
|
# # netdev_del id -- remove host network device
|
|
|
|
|
# yield from self._control_vm("netdev_del gns3-{}".format(adapter_number))
|
|
|
|
|
# yield from self._control_vm("netdev_add socket,id=gns3-{},udp={}:{},localaddr={}:{}".format(adapter_number,
|
|
|
|
|
# nio.rhost,
|
|
|
|
|
# nio.rport,
|
|
|
|
|
# self._host,
|
|
|
|
|
# nio.lport))
|
|
|
|
|
|
|
|
|
|
adapter.add_nio(0, nio)
|
|
|
|
|
log.info('QEMU VM "{name}" [{id}]: {nio} added to adapter {adapter_number}'.format(name=self._name,
|
|
|
|
|