-
Notifications
You must be signed in to change notification settings - Fork 21
Show cache devices in spa -v output #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1f6060b to
529a069
Compare
|
Hey @PaulZ-98 ! Thanks for posting a PR for this and sorry for the delayed response! It's great that this patch gets to show cache devices! My only problem with it is that the output looks a bit awkward and also you can really tell that the vdev in question is a cache device. In illumos, MDB's output did a pretty good job: I think we can do the same. Do you think this would be doable in this PR? Maybe within the BTW good job figuring out the regression testing infrastructure by yourself! :) |
d767035 to
e62d63b
Compare
|
Pushed a change with the keyword "cache" in the output (tried to match mdb). |
Codecov Report
@@ Coverage Diff @@
## master #253 +/- ##
==========================================
+ Coverage 87.37% 87.40% +0.02%
==========================================
Files 60 60
Lines 2496 2501 +5
==========================================
+ Hits 2181 2186 +5
Misses 315 315
Continue to review full report at Codecov.
|
sdb/commands/zfs/vdev.py
Outdated
| else: | ||
| yield from self.from_vdev(spa.spa_root_vdev) | ||
|
|
||
| for j in range(0, spa.spa_l2cache.sav_count): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for j in range(spa.spa_l2cache.sav_count)
- no need for
0,
sdb/commands/zfs/vdev.py
Outdated
| if vdev.vdev_isl2cache != 0: | ||
| print("".ljust(indent), "-".ljust(18), "-".ljust(7), | ||
| "-".ljust(4), "".ljust(level), "cache") | ||
| level = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be wrong but won't this print the - - - cache header line above each cache device entry?
In MDB this would be printed once:
> ::spa -v
ADDR STATE NAME
ffffff03afc1b000 ACTIVE meta-domain
ADDR STATE AUX DESCRIPTION
ffffff0385108800 HEALTHY - root
ffffff03850ba800 HEALTHY - raidz
ffffff0384fd7000 HEALTHY - /tmp/dks0
ffffff0384fee000 HEALTHY - /tmp/dks1
ffffff0385101800 HEALTHY - /tmp/dks2
- - - cache
ffffff037a48c800 HEALTHY - /dev/dsk/c2t1d0s0
ffffff03850c7800 HEALTHY - /dev/dsk/c2t2d0s0
- - - spares
ffffff038269a000 HEALTHY - /dev/dsk/c2t3d0s0
ffffff0375690000 ACTIVE rpool
ffffff037571b000 HEALTHY - root
ffffff03758c7800 HEALTHY - /dev/dsk/c2t0d0s0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dang! That's true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let me know if there was a better way to code it up. Here's the output.
sdb> spa -v
ADDR NAME
------------------------------------------------------------
0xffff88ff177f4000 tank
ADDR STATE AUX DESCRIPTION
------------------------------------------------------------
0xffff88ff1d788000 HEALTHY NONE root
0xffff88ff1d7a0000 HEALTHY NONE /root/file1
0xffff88ff1d6cc000 HEALTHY NONE /root/file4
- - - cache
0xffff88ff1d628000 HEALTHY NONE /root/file2
0xffff88ff1d3ac000 HEALTHY NONE /root/file5
sdb>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my pool "tank", /root/file4 is a log device, so I think had better add code for the log keyword preceding the vdev just like for l2arc vdev(s).
root@ub-20:~/sdb# zpool status
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
/root/file1 ONLINE 0 0 0
logs
/root/file4 ONLINE 0 0 0
cache
/root/file2 ONLINE 0 0 0
/root/file5 ONLINE 0 0 0
spares
/root/file3 AVAIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added code for log and spares.
sdb> spa -v
ADDR NAME
------------------------------------------------------------
0xffff88ff1d718000 tank
ADDR STATE AUX DESCRIPTION
------------------------------------------------------------
0xffff88ff297d0000 HEALTHY NONE root
0xffff88ff17014000 HEALTHY NONE /root/file1
- - - logs
0xffff88ff1212c000 HEALTHY NONE mirror
0xffff88ff1d570000 HEALTHY NONE /root/file4
0xffff88ff1d548000 HEALTHY NONE /root/file6
- - - cache
0xffff88ff1d550000 HEALTHY NONE /root/file2
0xffff88ff1d5d8000 HEALTHY NONE /root/file5
- - - spares
0xffff88ff297cc000 HEALTHY NONE /root/file3
sdb>
root@ub-20:~/sdb# zpool status
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
/root/file1 ONLINE 0 0 0
logs
mirror-1 ONLINE 0 0 0
/root/file4 ONLINE 0 0 0
/root/file6 ONLINE 0 0 0
cache
/root/file2 ONLINE 0 0 0
/root/file5 ONLINE 0 0 0
spares
/root/file3 AVAIL
errors: No known data errors
root@ub-20:~/sdb#
46ad091 to
8ca849d
Compare
sdimitro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay in this! @PaulZ-98 This looks ready to get in! Could you please rebase with the latest master?
Show cache devices in spa -v output
Fixes #114
Pull request checklist
Please check if your PR fulfills the following requirements:
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
spa -v does not list cache vdev
Issue Number: 114
What is the new behavior?
Does this introduce a breaking change?