oxidecomputer / oxidecomputer/netadm-sys

create_link_id() could be more descriptive when link already exists

Open
#8 0 comments 1 reaction 1 assignee View on GitHub

@rcgoodfellow is already working on this.

Since Sep 2, 2022.

enhancement
Dominant language
Rust
Stars
7
Forks
4
PR merge metrics
No merged PRs in 30d

Description

@leftwo reported seeing the following failure when trying to create a guest instance with Omicron:

"error_message_external":"Internal Server Error","error_message_internal":"Error managing instances: Instance error: Failure interacting with the OPTE ioctl(2) interface: netadm failed dlmgmtd: link id creation failed: 17","response_code":"500"

The Failure interacting with the OPTE ioctl(2) interface: part of the message comes from sled-agent, which presents this message anytime a call to opte_ioctl::OpteHdl fails. However, technically, this failure is on the userspace side, before calling the OPTE ioctl. Specifically the failure happens when requesting a new link ID from dlmgmtd.

        let linkid = link::create_link_id(
            name,
            libnet::LinkClass::Xde,
            libnet::LinkFlags::Active,
        )?;

The link id creation failed: 17 comes from this library, and it indicates the call to create the new link id failed with EEXIST (errno = 17).

    if response.linkid == 0 || response.err != 0 {
        return Err(Error::Dlmgmtd(format!(
            "link id creation failed: {}",
            response.err
        )));
    }

We could improve this specific error message by matching against response.err. If it's equal to EEXIST, we could return a libnet::Error::AlreadyExists(String) to make it more obvious to those of us (like me) who fail to memorize errno.h.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.