backends: LXD: don't hardcode eth0#178
Conversation
cc8bf9d to
a94bca2
Compare
With the ubuntu-22.04 image, the network interface seems to be named "enp5s0" instead of "eth0". To be compatible with both old and new releases, consider any non-loopback interface viable for retrieving an IP address.
a94bca2 to
513f682
Compare
bboozzoo
left a comment
There was a problem hiding this comment.
LGTM. I have the exact same change in my branch.
|
ping @ZeyadYasser, please have a look |
ZeyadYasser
left a comment
There was a problem hiding this comment.
Thank you for fixing this, would it be a good idea to add a check that the server is reachable by the host through this IP address (using an icmp ping or something similar) before selecting it to avoid a case where there are multiple addresses but one of them is not accessible by the host.
CC: @bboozzoo
|
Unless the configuration adds another interface explicitly, the container will have |
I'm assuming here that if multiple non- Spread didn't have the restriction of "only a single non- If there are multiple interfaces where only some of them are suitable for Spread to connect via SSH, we probably need additional configuration anyway (and that is probably outside of the scope of this PR). |
spread/lxd.go
Outdated
| for intf, network := range sjson.State.Network { | ||
| if intf == "lo" { |
There was a problem hiding this comment.
Could you change these variable names to match the corresponding chunk in #185?
niemeyer
left a comment
There was a problem hiding this comment.
Thanks for the PR. There's indeed a question about multiple interfaces, but this looks like at least a good start and solves the common case. Let's see how far we get with it alone.
With the ubuntu-22.04 image, the network interface seems to be sometimes named "enp5s0" instead of "eth0". To be compatible with both old and new releases, consider any non-loopback interface viable for retrieving an IP address.