Skip to content

create_link_id() could be more descriptive when link already exists #8

@rzezeski

Description

@rzezeski

@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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions