Skip to content

feat(linstor): simplify get_controller_uri using ss command#121

Merged
Wescoeur merged 2 commits into3.2.12-8.3from
ran-simplify-get-controller
Feb 3, 2026
Merged

feat(linstor): simplify get_controller_uri using ss command#121
Wescoeur merged 2 commits into3.2.12-8.3from
ran-simplify-get-controller

Conversation

@Wescoeur
Copy link
Member

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.

def _get_controller_addresses() -> List[str]:
try:
session = util.timeout_call(10, util.get_localAPI_session)
(ret, stdout, stderr) = util.doexec([
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. :)

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>
@Wescoeur Wescoeur force-pushed the ran-simplify-get-controller branch from ed03882 to fd3f099 Compare February 3, 2026 09:46
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
@Wescoeur Wescoeur force-pushed the ran-simplify-get-controller branch from fd3f099 to 4b860b0 Compare February 3, 2026 10:00
# 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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Wescoeur Wescoeur merged commit c86171c into 3.2.12-8.3 Feb 3, 2026
5 checks passed
@Wescoeur Wescoeur deleted the ran-simplify-get-controller branch February 3, 2026 13:20
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

Successfully merging this pull request may close these issues.

4 participants

Comments