Skip to content

Get pool data however the state (resp. status) #55

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samy-mahmoudi
Copy link

@samy-mahmoudi samy-mahmoudi commented Jan 16, 2023

This commit substitutes 'zpool iostat' for 'zpool status' to fix improper parsing due to the variety of states and statuses.

@samy-mahmoudi samy-mahmoudi requested a review from a team as a code owner January 16, 2023 03:13
@CLAassistant
Copy link

CLAassistant commented Jan 16, 2023

CLA assistant check
All committers have signed the CLA.

@samy-mahmoudi samy-mahmoudi force-pushed the fix-provider-zpool-according-to-the-variety-of-states-and-statuses branch 4 times, most recently from 983c294 to 7621c23 Compare January 16, 2023 03:38
zpool_data = out.lines.select { |line| line.index("\t") == 0 }.map { |l| l.strip.split("\s")[0] }
zpool_data.shift
out = execute("zpool iostat -v #{zpool_opts} #{@resource[:pool]}", failonfail: false, combine: false)
zpool_data = out.lines[3..-2].map { |line| line.strip.split("\s")[0] }
Copy link

Choose a reason for hiding this comment

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

This fails on Solaris 11 since the last separator is included because of an empty line at the end of the command.

This commits substitutes 'zpool iostat' for 'zpool status' to
fix improper parsing due to the variety of states and statuses.
@samy-mahmoudi samy-mahmoudi force-pushed the fix-provider-zpool-according-to-the-variety-of-states-and-statuses branch from 7621c23 to c070269 Compare January 20, 2023 01:00
@samy-mahmoudi samy-mahmoudi requested a review from johro81 January 25, 2023 20:03
Copy link

@johro81 johro81 left a comment

Choose a reason for hiding this comment

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

I can confirm that these changes work for my case with Solaris 11.

Update: does not work if zpool is missing:

# zpool iostat -d test
cannot open 'test': no such pool

this leads to undefined method `map' for nil:NilClass

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.

3 participants