test/tree.py
raw| 1 | #!/usr/bin/python3 |
| 2 | ''' |
| 3 | SPDX-License-Identifier: LGPL-3.1-or-later |
| 4 | |
| 5 | This file is part of libnvme. |
| 6 | Copyright (c) 2021 SUSE Software Solutions AG |
| 7 | |
| 8 | Authors: Hannes Reinecke <[email protected]> |
| 9 | |
| 10 | Scans the NVMe subsystem and prints out all found hosts, |
| 11 | subsystems, and controllers |
| 12 | ''' |
| 13 | |
| 14 | import libnvme |
| 15 | |
| 16 | r = libnvme.nvme_root() |
| 17 | for h in r.hosts(): |
| 18 | print (h) |
| 19 | for s in h.subsystems(): |
| 20 | print (s) |
| 21 | for c in s.controllers(): |
| 22 | print (c) |
| 23 |