1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

media_harmony VFS module: Add and build by default.

- Supersedes previous patch.
 - Added various fixes for fake mtime functionality.
 - Now requires lp_cache_locked_write_times patch (bug 8912).
 - Removed various xattr functions to comply with recent VFS changes.
 - Changed SMB_STRUCT_DIR to DIR and SMB_STRUCT_DIRENT to struct dirent to comply with recent VFS changes.
 - Added manpage.
 - Added sample trigger_avid_update.py script.

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Tue Aug  7 15:16:39 CEST 2012 on sn-devel-104
This commit is contained in:
Andrew Klaassen 2012-05-03 13:39:53 -04:00 committed by Bjoern Jacke
parent e7bf8e7e23
commit 9b7b736e5b
6 changed files with 2691 additions and 0 deletions

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
<refentry id="vfs_media_harmony.8">
<refmeta>
<refentrytitle>vfs_media_harmony</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class="source">Samba</refmiscinfo>
<refmiscinfo class="manual">System Administration tools</refmiscinfo>
<refmiscinfo class="version">3.6</refmiscinfo>
</refmeta>
<refnamediv>
<refname>vfs_media_harmony</refname>
<refpurpose>Allow multiple Avid clients to share a network drive.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>vfs objects = media_harmony</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
<para>This VFS module is part of the
<citerefentry><refentrytitle>samba</refentrytitle>
<manvolnum>7</manvolnum></citerefentry> suite.</para>
<para>The <command>vfs_media_harmony</command> VFS module allows
Avid editorial workstations to share a network drive. It does
this by:</para>
<orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic">
<listitem><para>Giving each client their own copy of the Avid
msmMMOB.mdb and msmFMID.pmr files and Creating directories.</para></listitem>
<listitem><para>Allowing each client to explicitly control the
write time the Avid application sees on Avid media directories.</para></listitem>
</orderedlist>
<para>This module is stackable.</para>
</refsect1>
<refsect1>
<title>CONFIGURATION</title>
<para><command>vfs_media_harmony</command> automatically redirects
requests from clients for Avid database files or an Avid Creating
directory to a client-specific version of the file. No
configuration beyond enabling the module is needed to get this
portion of its functionality working.</para>
<para>If Mac and Windows Avid clients will be accessing the same
folder, they should be given separate share definitions, with
hidden Mac files vetoed on the Windows share. See EXAMPLES.</para>
<para>To allow each client to control when the Avid application
refreshes their Avid databases, create files for each client
and each Avid media directory with the name
[avid_dir_name]_[client_ip_address]_[client_username].
To trigger Avid database refreshes, update the write time on
those files. See EXAMPLES.</para>
<para>It is also necessary for the <command>cache locked write times = no</command>
option to be set for clients to be able to control their Avid
media folder write times.</para>
</refsect1>
<refsect1>
<title>EXAMPLES</title>
<para>Enable media_harmony for Mac and Windows clients:</para>
<programlisting>
<smbconfsection name="[avid_mac]"/>
<smbconfoption name="path">/avid</smbconfoption>
<smbconfoption name="vfs objects">media_harmony</smbconfoption>
<smbconfoption name="cache locked write times">no</smbconfoption>
<smbconfsection name="[avid_win]"/>
<smbconfoption name="path">/avid</smbconfoption>
<smbconfoption name="vfs objects">media_harmony</smbconfoption>
<smbconfoption name="cache locked write times">no</smbconfoption>
<smbconfoption name="veto files">/.DS_Store/._@/.Trash@/.Spotlight@/.hidden/.hotfiles@/.vol/</smbconfoption>
<smbconfoption name="delete veto files">yes</smbconfoption>
</programlisting>
<para>Create the files that will allow users david and susan
to control their own Avid database refreshes:</para>
<programlisting>
touch '/avid/OMFI MediaFiles_192.168.1.10_david' \
'/avid/OMFI MediaFiles_192.168.1.11_susan' \
'/avid/Avid MediaFiles/MXF/1_192.168.1.10_david' \
'/avid/Avid MediaFiles/MXF/1_192.168.1.11_susan'
</programlisting>
<para>Trigger an Avid database refresh for user david:</para>
<programlisting>
touch '/avid/OMFI MediaFiles_192.168.1.10_david' \
'/avid/Avid MediaFiles/MXF/1_192.168.1.10_david'
</programlisting>
<para>If you have a large number of Avid media folders to manage,
you can give each editor a suitably modified version of
examples/scripts/vfs/media_harmony/trigger_avid_update.py to
create and update these files.</para>
</refsect1>
<refsect1>
<title>CAVEATS</title>
<para><command>vfs_media_harmony</command> is designed to work with
Avid editing applications that look in the Avid MediaFiles or
OMFI MediaFiles directories for media. It is not designed to work
as expected in all circumstances for general use. For example: It
is possible to open a client-specific file such as
msmMMOB.mdb_192.168.1.10_userx even though it doesn't show up
in a directory listing.</para>
</refsect1>
<refsect1>
<title>VERSION</title>
<para>This man page is correct for version 3.2.7 of the Samba suite.
</para>
</refsect1>
<refsect1>
<title>AUTHOR</title>
<para>The original Samba software and related utilities
were created by Andrew Tridgell. Samba is now developed
by the Samba Team as an Open Source project similar
to the way the Linux kernel is developed.</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,103 @@
#!/usr/bin/python
import os, socket, sys, stat
######################################################################
##
## trigger_avid_update.py for media_harmony VFS module.
##
## Copyright (C) Andrew Klaassen 2012.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
######################################################################
#
# Change avid_shares and ip_prefix as appropriate for your network.
#
avid_shares = (
'\\\\mediaharmony01\\project1\\',
'\\\\mediaharmony01\\project2\\',
'\\\\mediaharmony01\\project3\\',
)
ip_prefix = '192.168.1.'
if __name__ == "__main__":
my_ips = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if ip[:len(ip_prefix)] == ip_prefix]
if not my_ips:
print 'No IP address found. Aborting.'
dummy = raw_input("\nPress Enter to finish: ")
sys.exit()
my_ip = my_ips[0]
my_name = os.environ.get('USERNAME')
for avid_share in avid_shares:
media_dirs = []
omfi_dir = os.path.join(avid_share, 'OMFI MediaFiles')
if os.path.exists(omfi_dir):
media_dirs.append(omfi_dir)
mxf_root = os.path.join(avid_share, 'Avid MediaFiles', 'MXF')
if os.path.exists(mxf_root):
mxf_children = os.listdir(mxf_root)
for child in mxf_children:
fullpath = os.path.join(mxf_root, child)
if os.path.isdir(fullpath):
media_dirs.append(fullpath)
for media_dir in media_dirs:
print '\nChecking %s...' % media_dir
fakepath = '%s_%s_%s' % (media_dir, my_ip, my_name)
print '...fakepath: %s' % fakepath
db = os.path.join(media_dir, 'msmMMOB.mdb')
print '...Checking for %s' % db
if os.path.exists(db):
print '......found %s.' % db
db_mtime = os.stat(db)[stat.ST_MTIME]
newer_file = False
for child in os.listdir(media_dir):
if child == 'msmMMOB.mdb' or child == 'msmFMID.pmr':
continue
child_mtime = os.stat(os.path.join(media_dir, child))[stat.ST_MTIME]
if child_mtime > db_mtime:
print '......found newer file %s' % child
newer_file = True
break
else:
print '......no %s.' % db
newer_file = True
if newer_file:
utime = None # Sets to current time.
print '...Setting fake mtime to NOW. Will trigger re-index.'
else:
mtime = os.stat(media_dir)[stat.ST_MTIME]
utime = (mtime, mtime)
print '...Setting fake mtime to media_dir mtime. No re-index.'
if not os.path.exists(fakepath):
tmp_fakepath = '%s.tmp' % fakepath
open(tmp_fakepath, 'a').close()
os.utime(tmp_fakepath, utime)
os.rename(tmp_fakepath, fakepath)
else:
os.utime(fakepath, utime)
dummy = raw_input("\nPress Enter to finish: ")

View File

@ -902,6 +902,7 @@ VFS_SCANNEDONLY_OBJ = modules/vfs_scannedonly.o
VFS_CROSSRENAME_OBJ = modules/vfs_crossrename.o
VFS_LINUX_XFS_SGID_OBJ = modules/vfs_linux_xfs_sgid.o
VFS_TIME_AUDIT_OBJ = modules/vfs_time_audit.o
VFS_MEDIA_HARMONY_OBJ = modules/vfs_media_harmony.o
PAM_ERRORS_OBJ = ../libcli/auth/pam_errors.o
PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o $(PAM_ERRORS_OBJ)
@ -2957,6 +2958,10 @@ bin/time_audit.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_TIME_AUDIT_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_TIME_AUDIT_OBJ)
bin/media_harmony.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_MEDIA_HARMONY_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_MEDIA_HARMONY_OBJ)
#########################################################
## IdMap NSS plugins

View File

@ -466,6 +466,7 @@ default_shared_modules="$default_shared_modules vfs_scannedonly"
default_shared_modules="$default_shared_modules vfs_crossrename"
default_shared_modules="$default_shared_modules vfs_linux_xfs_sgid"
default_shared_modules="$default_shared_modules vfs_time_audit"
default_shared_modules="$default_shared_modules vfs_media_harmony"
default_shared_modules="$default_shared_modules idmap_autorid"
default_shared_modules="$default_shared_modules idmap_tdb2"
default_shared_modules="$default_shared_modules idmap_rid"
@ -6575,6 +6576,7 @@ SMB_MODULE(vfs_scannedonly, \$(VFS_SCANNEDONLY_OBJ), "bin/scannedonly.$SHLIBEXT"
SMB_MODULE(vfs_crossrename, \$(VFS_CROSSRENAME_OBJ), "bin/crossrename.$SHLIBEXT", VFS)
SMB_MODULE(vfs_linux_xfs_sgid, \$(VFS_LINUX_XFS_SGID_OBJ), "bin/linux_xfs_sgid.$SHLIBEXT", VFS)
SMB_MODULE(vfs_time_audit, \$(VFS_TIME_AUDIT_OBJ), "bin/time_audit.$SHLIBEXT", VFS)
SMB_MODULE(vfs_media_harmony, \$(VFS_MEDIA_HARMONY_OBJ), "bin/media_harmony.$SHLIBEXT", VFS)
SMB_SUBSYSTEM(VFS,smbd/vfs.o)

File diff suppressed because it is too large Load Diff

View File

@ -1458,6 +1458,7 @@ main() {
auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
vfs_media_harmony
vfs_crossrename vfs_linux_xfs_sgid
vfs_time_audit idmap_autorid idmap_tdb2
idmap_rid idmap_hash''')