Add support for managing OpenZFS pools (#2642)

pull/18777/head
Adam Števko 8 years ago committed by Matt Clay
parent 2bfbfbb3ff
commit 081e6ec032

@ -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)

Loading…
Cancel
Save