Skip to content
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

Update zpools plugin to work on Linux/BSD #1001

Merged
merged 5 commits into from
Jun 1, 2017
Merged

Update zpools plugin to work on Linux/BSD #1001

merged 5 commits into from
Jun 1, 2017

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented May 15, 2017

This plugin works on Linux/BSD for the most part. Let's do the extra work to get there.

Caveats:

The regex is still less than ideal here. Since zpool status for a zpool lists the zlevel and the volume itself along with the drives it's a bit tricky to extract just the drive information. We're relying on the starting characters to identify drives. So we're saying a line that starts with C is a drive on solaris, SD on Linux, and DA/AD on BSD. What happens if my volume is called "crap"? Well that would show up as a drive. That bug has always existed and this doesn't change that. We can use -P on Linux to get the full path which fixes this for Linux, but that doesn't exist on Solaris/BSD (of course).

tas50 added 2 commits May 15, 2017 14:08
Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Tim Smith <tsmith@chef.io>
tas50 added 2 commits May 15, 2017 14:52
We need Linux specs still

Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50 tas50 changed the title WIP: Update zpools plugin to work on Linux Update zpools plugin to work on Linux May 15, 2017
@tas50 tas50 added the Type: Enhancement Adds new functionality. label May 15, 2017
@tas50
Copy link
Contributor Author

tas50 commented May 15, 2017

{
  "storage": {
    "pool_size": "7.25T",
    "pool_allocated": "1.20M",
    "pool_free": "7.25T",
    "capacity_used": "0%",
    "dedup_factor": "1.00x",
    "health": "ONLINE",
    "zpool_version": null,
    "devices": {
      "sda": {
        "state": "ONLINE",
        "errors": {
          "read": "0",
          "write": "0",
          "checksum": "0"
        }
      },
      "sdb": {
        "state": "ONLINE",
        "errors": {
          "read": "0",
          "write": "0",
          "checksum": "0"
        }
      },
      "sde": {
        "state": "ONLINE",
        "errors": {
          "read": "0",
          "write": "0",
          "checksum": "0"
        }
      },
      "sdf": {
        "state": "ONLINE",
        "errors": {
          "read": "0",
          "write": "0",
          "checksum": "0"
        }
      }
    }
  }
}

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50 tas50 changed the title Update zpools plugin to work on Linux Update zpools plugin to work on Linux/BSD May 16, 2017
Copy link
Contributor

@coderanger coderanger left a comment

Choose a reason for hiding this comment

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

Seem correct from my limited knowledge.

@tas50 tas50 merged commit 484d8b5 into master Jun 1, 2017
@tas50
Copy link
Contributor Author

tas50 commented Jun 1, 2017

I'm merging this and I'm going to continue to gather zpool status example outputs to see if we can just rely on the spacing. If so we can eliminate the longstanding bugs and some of the awfulness of this regex.

@tas50 tas50 deleted the zpool branch June 1, 2017 20:59
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants