Merge pull request #5238 from virtua-network/zpool_module

Zpool module
This commit is contained in:
Joseph Hall 2013-05-23 14:53:13 -07:00
commit faeecd2138

View File

@ -54,6 +54,20 @@ def status(name=''):
return ret return ret
def iostat(name=''):
'''
Display I/O statistics for the given pools
CLI Example::
salt '*' zpool.iostat
'''
zpool = _check_zpool()
res = __salt__['cmd.run']('{0} iostat -v {1}'.format(zpool, name))
ret = res.splitlines()
return ret
def zpool_list(): def zpool_list():
''' '''
Return a list of all pools in the system with health status and space usage Return a list of all pools in the system with health status and space usage
@ -103,6 +117,28 @@ def destroy(pool_name):
ret['Error'] = 'Storage pool {0} does not exist'.format(pool_name) ret['Error'] = 'Storage pool {0} does not exist'.format(pool_name)
def scrub(pool_name=None):
'''
Begin a scrub
CLI Example::
salt '*' zpool.scrub myzpool
'''
ret = {}
if not pool_name:
ret['Error'] = 'zpool name parameter is mandatory.'
return ret
if exists(pool_name):
zpool = _check_zpool()
cmd = '{0} scrub {1}'.format(zpool, pool_name)
res = __salt__['cmd.run'](cmd)
ret[pool_name] = res.splitlines()
return ret
else:
ret['Error'] = 'Storage pool {0} does not exist'.format(pool_name)
def create(pool_name, *vdevs): def create(pool_name, *vdevs):
''' '''
Create a new storage pool Create a new storage pool