canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.76k stars 642 forks source link

Multipass does not recognize Hyper-V instances as bridged #3489

Closed ricab closed 3 months ago

ricab commented 5 months ago

Describe the bug The Multipass daemon keeps thinking that bridged instances aren't bridged, when the bridged-network is set to an non-bridge interface, in Hyper-V. If asked to set bridge=true again, it will then duplicate the bridged interface.

The problem is that the bridge is not associated with the interface here. This appears to be a forgotten placeholder and shouldn't be hard to fix.

VirtualBox doesn't have a dedicated implementation, but I think we don't need bridges there and just pass the end interface, so this shouldn't apply there.

To Reproduce

C:\> multipass get local.bridged-network
Ethernet Instance 0
C:\> multipass get local.glad-menhaden.bridged
false
C:\> multipass set local.glad-menhaden.bridged=true
C:\> multipass get local.glad-menhaden.bridged
false
C:\> multipass set -vvvv local.glad-menhaden.bridged=true
C:\> multipass set -vvvv local.glad-menhaden.bridged=true

The instance now has 3 new bridged networks.

Expected behavior The bridge would be recognized and a second attempt to make the setting true would be a no op.

Additional info

ricab commented 5 months ago

This will be an issue for QEMU too once networking is implemented on Linux. On macOS we don't need bridges, so we don't see it there today.

I believe the generic fix would be to call find_bridge_with which implements exactly this.