salt.states.zpool

Management zpool

maintainer:Jorge Schrauwen <sjorge@blackdot.be>
maturity:new
depends:zpool
platform:smartos, illumos, solaris, freebsd, linux

2016.3.0 新版功能.

oldpool:
  zpool.absent:
    - export: true

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

警告

The layout will never be updated, it will only be used at time of creation. It's a whole lot of work to figure out if a devices needs to be detached, removed, ... this is best done by the sysadmin on a case per case basis.

Filesystem properties are also not updated, this should be managed by the zfs state module.

salt.states.zpool.absent(name, export=False, force=False)

ensure storage pool is absent on the system

name : string
name of storage pool
export : boolean
export instread of destroy the zpool if present
force : boolean
force destroy or export
salt.states.zpool.present(name, properties=None, filesystem_properties=None, layout=None, config=None)

ensure storage pool is present on the system

name : string
name of storage pool
properties : dict
optional set of properties to set for the storage pool
filesystem_properties : dict
optional set of filesystem properties to set for the storage pool (creation only)
layout: dict
disk layout to use if the pool does not exist (creation only)
config : dict
fine grain control over this state

注解

The following configuration properties can be toggled in the config parameter.
  • import (true) - try to import the pool before creating it if absent
  • import_dirs (None) - specify additional locations to scan for devices on import
  • device_dir (None, SunOS=/dev/rdsk) - specify device directory to use if not absolute path
  • force (false) - try to force the import or creation

注解

Because ID's inside the layout dict must be unique they need to have a suffix.

mirror-0:
  /tmp/vdisk3
  /tmp/vdisk2
mirror-1:
  /tmp/vdisk0
  /tmp/vdisk1

The above yaml will always result in the following zpool create:

zpool create mypool mirror /tmp/vdisk3 /tmp/vdisk2 mirror /tmp/vdisk0 /tmp/vdisk1

警告

Pay attention to the order of your dict!

mirror-0:
  /tmp/vdisk0
  /tmp/vdisk1
/tmp/vdisk2:

The above will result in the following zpool create:

zpool create mypool mirror /tmp/vdisk0 /tmp/vdisk1 /tmp/vdisk2

Creating a 3-way mirror! Why you probably expect it to be mirror root vdev with 2 devices + a root vdev of 1 device!