Skip to content

Implement discovery loop in python#1069

Merged
igaw merged 3 commits intolinux-nvme:masterfrom
hreinecke:py-discover-loop
Sep 9, 2025
Merged

Implement discovery loop in python#1069
igaw merged 3 commits intolinux-nvme:masterfrom
hreinecke:py-discover-loop

Conversation

@hreinecke
Copy link
Copy Markdown
Collaborator

Now that we have fixed up the python bindings we can implement the command 'discovery-all' in python, serving as an example how 'connect-all' can be implemented.

The python 'with' statement allows for correct resource tracking,
where the allocated resource will be freed at the end of the statement.
This is helpful for 'host', 'subsystem', and 'controller' objects
which we might want to clean up (and clear out the internal tree).
The nice thing here is that we can do an automatic controller
disconnect, and don't have to worry about leaving stale connections
or objects around.

Signed-off-by: Hannes Reinecke <[email protected]>
Now that we have resource tracking we can use the 'with' statement
for discovery and clean up connections and discovery controllers
on exit.

Signed-off-by: Hannes Reinecke <[email protected]>
As we now have resource tracking we can implement a discovery loop
in python without leaving stale controllers around.

Signed-off-by: Hannes Reinecke <[email protected]>
@igaw igaw merged commit b325953 into linux-nvme:master Sep 9, 2025
12 checks passed
@igaw
Copy link
Copy Markdown
Collaborator

igaw commented Sep 9, 2025

Nice! Thanks!

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.

2 participants