Creates file based virtual devices for a zpool

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.create_file_vdev 7G /path/to/vdev1 [/path/to/vdev2] [...]

    .. note::

        Depending on file size, the above command may take a while to return.

def create_file_vdev(size, *vdevs):
    '''
    Creates file based virtual devices for a zpool

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.create_file_vdev 7G /path/to/vdev1 [/path/to/vdev2] [...]

    .. note::

        Depending on file size, the above command may take a while to return.

    '''
    ret = OrderedDict()
    err = OrderedDict()

    _mkfile_cmd = salt.utils.path.which('mkfile')
    for vdev in vdevs:
        if os.path.isfile(vdev):
            ret[vdev] = 'existed'
        else:
            res = __salt__['cmd.run_all'](
                '{mkfile} {size} {vdev}'.format(
                    mkfile=_mkfile_cmd,
                    size=size,
                    vdev=vdev,
                ),
                python_shell=False,
            )
            if res['retcode'] != 0:
                if 'stderr' in res and ':' in res['stderr']:
                    ret[vdev] = 'failed'
                    err[vdev] = ":".join(res['stderr'].strip().split(':')[1:])
            else:
                ret[vdev] = 'created'
    if err:
        ret['error'] = err

    return ret