|
|
|
@ -33,7 +33,7 @@ options:
|
|
|
|
|
required: true
|
|
|
|
|
state:
|
|
|
|
|
description:
|
|
|
|
|
- Whether to create (C(present)), or remove (C(absent)) a
|
|
|
|
|
- Whether to create (C(present)), or remove (C(absent)) a
|
|
|
|
|
file system, snapshot or volume. All parents/children
|
|
|
|
|
will be created/destroyed as needed to reach the desired state.
|
|
|
|
|
choices: ['present', 'absent']
|
|
|
|
@ -83,14 +83,27 @@ class Zfs(object):
|
|
|
|
|
self.name = name
|
|
|
|
|
self.properties = properties
|
|
|
|
|
self.changed = False
|
|
|
|
|
self.is_solaris = os.uname()[0] == 'SunOS'
|
|
|
|
|
self.pool = name.split('/')[0]
|
|
|
|
|
self.zfs_cmd = module.get_bin_path('zfs', True)
|
|
|
|
|
self.zpool_cmd = module.get_bin_path('zpool', True)
|
|
|
|
|
self.pool = name.split('/')[0]
|
|
|
|
|
self.is_solaris = os.uname()[0] == 'SunOS'
|
|
|
|
|
self.is_openzfs = self.check_openzfs()
|
|
|
|
|
self.enhanced_sharing = self.check_enhanced_sharing()
|
|
|
|
|
|
|
|
|
|
def check_openzfs(self):
|
|
|
|
|
cmd = [self.zpool_cmd]
|
|
|
|
|
cmd.extend(['get', 'version'])
|
|
|
|
|
cmd.append(self.pool)
|
|
|
|
|
(rc, out, err) = self.module.run_command(cmd, check_rc=True)
|
|
|
|
|
version = out.splitlines()[-1].split()[2]
|
|
|
|
|
if version == '-':
|
|
|
|
|
return True
|
|
|
|
|
if int(version) == 5000:
|
|
|
|
|
return True
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def check_enhanced_sharing(self):
|
|
|
|
|
if os.uname()[0] == 'SunOS':
|
|
|
|
|
if self.is_solaris and not self.is_openzfs:
|
|
|
|
|
cmd = [self.zpool_cmd]
|
|
|
|
|
cmd.extend(['get', 'version'])
|
|
|
|
|
cmd.append(self.pool)
|
|
|
|
|