def create_zfs_pool(test_case):
 if (os.getuid() != 0):
  raise SkipTest('Functional tests must run as root.')
 pool_name = ('testpool_%s' % (uuid.uuid4(),))
 pool_path = FilePath(test_case.mktemp())
 mount_path = FilePath(test_case.mktemp())
 with pool_path.open('wb') as f:
  f.truncate(((100 * 1024) * 1024))
 test_case.addCleanup(pool_path.remove)
 try:
  run_process(['zpool', 'create', '-m', mount_path.path, pool_name, pool_path.path])
 except OSError as e:
  if (e.errno == errno.ENOENT):
   raise SkipTest('Install zpool to run these tests: http://doc-dev.clusterhq.com/using/installing/index.html#optional-zfs-backend-configuration')
  raise
 test_case.addCleanup(run_process, ['zpool', 'destroy', pool_name])
 return pool_name

def create_zfs_pool ( test_case ) : if ( os . getuid ( ) != 0 ) : raise SkipTest ( 'Functional tests must run as root.' ) pool_name = ( 'testpool_%s' % ( uuid . uuid4 ( ) , ) ) pool_path = FilePath ( test_case . mktemp ( ) ) mount_path = FilePath ( test_case . mktemp ( ) ) with pool_path . open ( 'wb' ) as f : f . truncate ( ( ( 100 * 1024 ) * 1024 ) ) test_case . addCleanup ( pool_path . remove ) try : run_process ( [ 'zpool' , 'create' , '-m' , mount_path . path , pool_name , pool_path . path ] ) except OSError as e : if ( e . errno == errno . ENOENT ) : raise SkipTest ( 'Install zpool to run these tests: http://doc-dev.clusterhq.com/using/installing/index.html#optional-zfs-backend-configuration' ) raise test_case . addCleanup ( run_process , [ 'zpool' , 'destroy' , pool_name ] ) return pool_name
create a new zfs pool .