cloud-init team mailing list archive
Mailing list archive
Ephemeral Network APIs
i'm writing this so long as it's fresh to my memory, as we discussed it
on Friday evening in IRC … despite the subject, I think it should be
persisted somewhere ;)
I've been working on "porting" coudinit/net to freebsd:
so my problem is with class EphemeralIPv4Network
"""Context manager which sets up temporary static network configuration.
No operations are performed if the provided interface is already
If unconnected, bring up the interface with valid ip, prefix and
If router is provided setup a default route for that interface. Upon
context exit, clean up the interface leaving no configuration behind.
Let me emphasize, "No operations are performed if the provided
interface is already connected."
However, this is currently not done, or at least not directly:
"""Perform ephemeral network setup if interface is not
it's only that somewhere in _bringup_device()'s exception path, that
"nothing" is done.
Given this convoluted code, it's perhaps no wonder that
EphemeralIPv4Network is currently suffering from this bug:
I think from an API point of view, it's important that "No operation is
performed". Especially since this class implements __enter__() and
__exit__() — and is used by six different sources in this exact
Scott brought up the issue of performance, of wasted cycles thru
repeated checking if the link is_up(). But i'm convinced that the
benefit from a consistent API is far greater than a few wasted calls
that are probably easily cached by a modern Kernel.
- EphemeralIPv4Network is currently not implemented to its own spec
- EphemeralIPv4Network has basic functionality bugs
Fixing these issues would make porting cloudinit.net to non-linux
platforms easier as well.
: see https://docs.python.org/3/reference/compound_stmts.html#with
: you could say it's not idempotent, but i would claim it's not