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

zpool state module needs support for disk vdev #34762 #34770

Closed
wants to merge 5 commits into from
Closed

zpool state module needs support for disk vdev #34762 #34770

wants to merge 5 commits into from

Conversation

aphor
Copy link
Contributor

@aphor aphor commented Jul 19, 2016

Support zpool "disk" vdevs with explicit syntax, conforming to the same convention for specifying other vdev types.

Previous Behavior

to make a mirror vdev zpool:

mirrorpool:
  zpool.present:
    - config:
        import: false
        force: true
    - properties:
        comment: salty storage pool
    - layout:
        mirror-0:
          /dev/disk0
          /dev/disk1

to make a simple disk vpool

newpool:
  zpool.present:
    - config:
        import: false
        force: true
    - properties:
        comment: quick and dirty
    - layout: /dev/disk0

to make a striped disk zpool

newpool:
  zpool.present:
    - config:
        import: false
        force: true
    - properties:
        comment: quicker and dirtier
    - layout: /dev/disk0 /dev/disk1

New Behavior

old behavior still works

to make a simple disk vpool

newpool:
  zpool.present:
    - config:
        import: false
        force: true
    - properties:
        comment: quick and dirty
    - layout:
        disk-0:
          /dev/disk0

to make a striped disk zpool

newpool:
  zpool.present:
    - config:
        import: false
        force: true
    - properties:
        comment: quicker and dirtier
    - layout:
        disk-0:
          /dev/disk0
          /dev/disk1

Tests written?

No, but these examples are a good start!

Documentation changes?

Let's see

@sjorge
Copy link
Contributor

sjorge commented Jul 19, 2016

I'm okay in adding a disk-X to the state module.

But it should not be added to the execution module. I tried to stay as close as possible to the actually underlying cli command.

@cachedout cachedout added the Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged label Jul 19, 2016
@aphor
Copy link
Contributor Author

aphor commented Jul 20, 2016

Thoughts:
If we want to stay close to the zpool cli, we should not even care about parsing (mirror, zmirror, etc.) vdev types out of the arguments, and let the user supply a "vdev spec" as a list of strings that zpool parses, referring to zpool man page for acceptable arguments. That way we reduce the technical debt of supporting future zpool vdev syntax. If we want to provide structure for users, then our priority is trying to adapt the underlying command to the conventions your users expect from our tool.

Maybe we should do the former for the execution module and the latter for the state module? I agree it would be better if this logic did not get implemented twice; there is some duplication in the state module and execution module, which is bad on DRY principles.

@sjorge
Copy link
Contributor

sjorge commented Jul 20, 2016

The checks for vdev type in the execution module for is figuring out to see if we need to check the device is the correct type or not.

In the state module it's there to allow for few ways of formatting the layout property.

It could probably be swapped for a are.startswith('/') in the execution module. A clean up of the zpool and zfs modules to simplify some bits is near the end of my todo list. It usually involves a good day of testing for some small changes.

A unit test set is also on the todo for those, but I've no experience in writing those from scratch.

@aphor
Copy link
Contributor Author

aphor commented Jul 22, 2016

@sjorge thanks! I'll rework my changes to the state module.

@sjorge
Copy link
Contributor

sjorge commented Jul 22, 2016

Should have been covered in the same 2 PR's. Targeted for 2016.3 branch so @CacheOut or someone will probably forward merge those to develop branch soon.

@sjorge
Copy link
Contributor

sjorge commented Jul 22, 2016

Can't edit on mobile it seems, the vdev parsing is now completely gone in both the exec and state module. I did add a tiny bit of glue to allow disk-n in the state module.

@cachedout
Copy link
Contributor

@aphor We do need a rebase on this since it has merge conflicts now. Thanks!

@cachedout
Copy link
Contributor

Hi @aphor

Do you want to rebase this or open another PR? Please let me know. Thanks!

@sjorge
Copy link
Contributor

sjorge commented Aug 2, 2016

I think this got fixed in geh cleanup and refactoring of the zpool module/state.

@cachedout
Copy link
Contributor

@sjorge So should this PR be closed then?

@sjorge
Copy link
Contributor

sjorge commented Aug 2, 2016

The state currently supports disk vdevs in the traditional way or using a helper 'disk-n' type. So I think it can be closed.

@cachedout
Copy link
Contributor

Thanks, @sjorge.

@cachedout cachedout closed this Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants