feat(linstor): simplify get_controller_uri using ss command#121
feat(linstor): simplify get_controller_uri using ss command#121Wescoeur merged 2 commits into3.2.12-8.3from
get_controller_uri using ss command#121Conversation
| def _get_controller_addresses() -> List[str]: | ||
| try: | ||
| session = util.timeout_call(10, util.get_localAPI_session) | ||
| (ret, stdout, stderr) = util.doexec([ |
There was a problem hiding this comment.
You should check the return code and also that the output is indeed an IP address. It could very much be that the ss commad is missing (even if very unlikely) or that it doesn't return anything. It could also be that the output changed or many other things.
There was a problem hiding this comment.
I'm not sure it's useful to check if it's an IP address (let's say the output later shows us a hostname; we can theoretically leave it as is, all we want is a destination string). However, I'll modify the script to support IPv6 just in case...
If the program isn't there, an exception is already raised by doexec. No need to verify that.
However, you make a good point about the return check; I didn't backport that fix correctly, as I'm using a different API in my new code. :)
23ed7cf to
ed03882
Compare
9cbd470 to
81418fa
Compare
A significant improvement to avoid relying on DRBD commands or XAPI plugins. This change uses `ss` to obtain the destination IP address of the LINSTOR satellite source port. Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
ed03882 to
fd3f099
Compare
fd3f099 to
4b860b0
Compare
| # Not found, maybe we are trying to create the SR... | ||
| pass | ||
| def _get_controller_uri() -> str: | ||
| # TODO: Check that an IP address from the current pool is returned. |
There was a problem hiding this comment.
It might not be needed to check that the controller is an existing pool. It's unlikely but a future configuration could place the controller somewhere else.
There was a problem hiding this comment.
My fear is that a host might be moved to another LINSTOR pool. I think there are some situations we just don't want to happen.
A significant improvement to avoid relying on DRBD commands or XAPI plugins.
This change uses
ssto obtain the destination IP address of the LINSTOR satellite source port.