Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get local.<instance>.bridged command #3357

Merged
merged 8 commits into from
Jan 18, 2024
Merged

Conversation

luis4a0
Copy link
Contributor

@luis4a0 luis4a0 commented Jan 5, 2024

This PR fixes issue 3 of this review.

@luis4a0 luis4a0 changed the base branch from main to add-network-bridges January 5, 2024 17:00
Base automatically changed from add-network-bridges to main January 5, 2024 17:25
@luis4a0 luis4a0 marked this pull request as ready for review January 5, 2024 17:28
Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (01db61f) 84.05% compared to head (04ae2b9) 84.04%.
Report is 6 commits behind head on main.

Files Patch % Lines
src/daemon/daemon.cpp 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3357      +/-   ##
==========================================
- Coverage   84.05%   84.04%   -0.02%     
==========================================
  Files         251      251              
  Lines       13798    13812      +14     
==========================================
+ Hits        11598    11608      +10     
- Misses       2200     2204       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@luis4a0 luis4a0 force-pushed the add-network-bridges-issue3 branch 2 times, most recently from fe8ef6f to 90572c6 Compare January 10, 2024 15:03
@luis4a0 luis4a0 force-pushed the add-network-bridges-issue3 branch from 90572c6 to 7f10f71 Compare January 12, 2024 17:37
@townsend2010
Copy link
Contributor

Hi @luis4a0 or @ricab,

Could one of you please give me the instructions on how to create the bridge in issue #1? Sure I can look it up, but if you have the instructions handy, it would be greatly appreciated. Thanks!

@ricab
Copy link
Collaborator

ricab commented Jan 12, 2024

Hey @townsend2010, maybe I misunderstand what you're asking, but the steps to reproduce the issue should create the bridge automatically. The problem was that they did so without first asking the user.

@townsend2010
Copy link
Contributor

Hey @ricab, ah, I think I misread the steps. enx806d973d58c7 is an Ethernet device, right? I read that as a bridge at first. 😅

@ricab
Copy link
Collaborator

ricab commented Jan 12, 2024

That's right Chris, an ethernet device is needed to reproduce that. It may be possible to setup a dummy ethernet...

@townsend2010 townsend2010 self-requested a review January 12, 2024 18:57
Copy link
Contributor

@townsend2010 townsend2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @luis4a0!

I'm afraid this isn't working for me. I followed the steps for issue #1 and then issued the command in issue #3 and I still get false.

It's entirely possible I've done something wrong, but I am running this version of the snap:

$ multipass version
multipass   1.14.0-dev.1222.pr3357+g1797cd09
multipassd  1.14.0-dev.1222.pr3357+g1797cd09
$ multipass list
Name                    State             IPv4             Image
test2                   Running           10.230.244.14    Ubuntu 22.04 LTS
                                          192.168.8.179
$ multipass get local.test2.bridged
false

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 12, 2024

Hey @townsend2010! Thanks for taking the time to review.

In order to be sure it's failing, please clarify if, after creating the bridge, you changed the value of local.bridged-network. I am asking because it will check only if the current bridged network is bridged.

Thanks!

@townsend2010
Copy link
Contributor

Hey @luis4a0, no I did not change the value of local.bridged-network.

$ ip -br l
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
virbr0           DOWN           52:54:00:fe:25:6f <NO-CARRIER,BROADCAST,MULTICAST,UP> 
wlp1s0           UP             04:7b:cb:2e:a9:00 <BROADCAST,MULTICAST,UP,LOWER_UP> 
lxdbr0           UP             00:16:3e:33:42:16 <BROADCAST,MULTICAST,UP,LOWER_UP> 
mpbr0            UP             00:16:3e:d2:1d:b2 <BROADCAST,MULTICAST,UP,LOWER_UP> 
vethf8ded2b2@if6 UP             ce:4c:33:d2:f7:3c <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth54b84b12@if8 UP             7e:b7:c8:92:76:b4 <BROADCAST,MULTICAST,UP,LOWER_UP> 
tap-f694c9a4889  DOWN           b2:ff:dc:d4:e9:36 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
enx586d8fd35b6c  UP             58:6d:8f:d3:5b:6c <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-enx586d8fd35  UP             6a:46:3c:b6:33:b2 <BROADCAST,MULTICAST,UP,LOWER_UP> 
tap48441e4e      UP             b2:41:7e:33:b3:72 <BROADCAST,MULTICAST,UP,LOWER_UP> 
tap9ded9087      UP             5e:c7:96:f5:7d:21 <BROADCAST,MULTICAST,UP,LOWER_UP>
$ multipass get local.bridged-network
enx586d8fd35b6c

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 12, 2024

Ok, thanks for confirming! I'll see what's happening.

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 12, 2024

Well @townsend2010, this is working for me. Absolutely strange. Before investigating the version of the snap you're running, and keep trying to reproduce, can you please share the contents of /var/snap/multipass/common/data/multipassd/lxd/multipassd-vm-instances.json. We'd just need the data for the test2 instance; in particular, the extra_interfaces field.

@townsend2010
Copy link
Contributor

Hey @luis4a0! Sure:

{
    "test2": {
        "deleted": false,
        "disk_space": "10737418240",
        "extra_interfaces": [
            {
                "auto_mode": true,
                "id": "br-enx586d8fd35",
                "mac_address": "52:54:00:5e:f8:7b"
            }
        ],
        "mac_addr": "52:54:00:44:29:b8",
        "mem_size": "1073741824",
        "metadata": {
        },
        "mounts": [
        ],
        "num_cores": 1,
        "run_at_boot": [
        ],
        "ssh_username": "ubuntu",
        "state": 4
    }
}

@townsend2010
Copy link
Contributor

Is it perhaps because the br- name is truncated at the end wrt to the bridged network name?

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 12, 2024

Yes, you're absolutely right! So there should be a maximum length of the bridge names. The code checks for br- in front of the interface name. Since I tested with a short name, enp4s0, I didn't hit that issue. I´ll fix this. Thanks Chris!

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 12, 2024

Indeed, we need to truncate thr names at 15 characters: see this answer in SO.

@luis4a0 luis4a0 force-pushed the add-network-bridges-issue3 branch from 4bcce89 to 04ae2b9 Compare January 15, 2024 17:51
Copy link
Contributor

@townsend2010 townsend2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @luis4a0!

This works as expected now and the code LGTM. 👍

@townsend2010 townsend2010 added this pull request to the merge queue Jan 18, 2024
@townsend2010 townsend2010 removed this pull request from the merge queue due to a manual request Jan 18, 2024
@townsend2010
Copy link
Contributor

Ah, right, there is a private side, will merge manually.

@townsend2010 townsend2010 merged commit 445ae7c into main Jan 18, 2024
13 of 14 checks passed
@townsend2010 townsend2010 deleted the add-network-bridges-issue3 branch January 18, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants