Skip to content

run_cvd: Improve tap device validation error messages#2601

Open
bridadan wants to merge 1 commit into
google:mainfrom
bridadan:tap_message_improvement
Open

run_cvd: Improve tap device validation error messages#2601
bridadan wants to merge 1 commit into
google:mainfrom
bridadan:tap_message_improvement

Conversation

@bridadan
Copy link
Copy Markdown
Collaborator

Refactor ValidateTapInterfaceUnused to check if the interface exists first, avoiding misleading "Operation not permitted" errors when the device simply does not exist.

Update ValidateTapDevices to remove the assumption that another device is running, while keeping the actionable suggestions (cvd reset, pkill).

Also remove redundant "Device in use" messages in TestTapDevices to keep logs terse.

Bug: 512536991
Test: Built it with a intentionally incorrect interface name, ensured
output stated interface did not exist instead of a misleading error

@bridadan bridadan requested a review from ser-io May 22, 2026 19:20
@bridadan bridadan force-pushed the tap_message_improvement branch from 04dd053 to 01cdfbb Compare May 22, 2026 19:20
Copy link
Copy Markdown
Member

@ser-io ser-io left a comment

Choose a reason for hiding this comment

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

Thanks for updating this!

Comment thread base/cvd/allocd/alloc_utils.cpp Outdated
#ifdef __linux__
Result<void> ValidateTapInterfaceIsUsable(const std::string& interface_name) {
CF_EXPECTF(NetworkInterfaceExists(interface_name),
"Tap interface {} does not exist", interface_name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: wondering whether we should reference "cuttlefish-host-resources.service" in this error message for a more actionable message.

For example: "Tap interface {} does not exist. Cuttlefish tap devices should have been created when running cuttlefish-host-resources.service"

I'll leave it up to you for the final message.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah agreed! I updated the message, let me know what you think

Refactor ValidateTapInterfaceUnused to check if the interface exists
first, avoiding misleading "Operation not permitted" errors when the
device simply does not exist.

Update ValidateTapDevices to remove the assumption that another device
is running, while keeping the actionable suggestions (cvd reset, pkill).

Also remove redundant "Device in use" messages in TestTapDevices to
keep logs terse.

Bug: 512536991
Test: Built it with a intentionally incorrect interface name, ensured
      output stated interface did not exist instead of a misleading error
Flag: EXEMPT BUGFIX
@bridadan bridadan force-pushed the tap_message_improvement branch from 01cdfbb to aad626e Compare May 22, 2026 19:57
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.

2 participants