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

Undocumented <admin-interface> handling of name and hwaddr interface is confusing #33

Open
ydirson opened this issue Jan 13, 2023 · 0 comments

Comments

@ydirson
Copy link
Contributor

ydirson commented Jan 13, 2023

parseInterface() code is as follows:

        if_name = getStrAttribute(node, ['name'])
        if if_name and if_name in nethw:
            if_hwaddr = nethw[if_name].hwaddr
        else:
            if_hwaddr = getStrAttribute(node, ['hwaddr'])
            if if_hwaddr:
                matching_list = filter(lambda x: x.hwaddr == if_hwaddr.lower(), nethw.values())
                if len(matching_list) == 1:
                    if_name = matching_list[0].name
        if not if_name and not if_hwaddr:
             raise AnswerfileException("<admin-interface> tag must have one of 'name' or 'hwaddr'")

It is allowed to specify both name and hwaddr, in which case

  • if name points to an existing interface, hwaddr is ignored
  • if not, name is ignored

If any or both are specified, but do not match the hardware, the message says they are missing.

We should likely ensure exactly one is given, and issue more specific error messages.

ydirson added a commit to xcp-ng/host-installer that referenced this issue Jan 13, 2023
ydirson added a commit to xcp-ng/host-installer that referenced this issue Jan 16, 2023
ydirson added a commit to xcp-ng/host-installer that referenced this issue Jan 16, 2023
ydirson added a commit to xcp-ng/host-installer that referenced this issue Jan 17, 2023
ydirson added a commit to xcp-ng/host-installer that referenced this issue Jan 23, 2023
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

No branches or pull requests

1 participant