<html><body><pre>
                      Enstore release notes, from RELEASE-2009-05-11 to ENSTORE_RPM_2_0_0_1


                      Detailed cvs commit logs


========== alarm.py ====================================================================================

Removed most (but not quite all) traces of string exceptions. 

========== manage_queue.py ====================================================================================

One more line needed the same change 

Corrected calculation of curpri. 

fixed bugs, changed test() return value 

This is a first version of modified manage_queue.py to be used with a new implementation of scaled library_manager.py. It is not backward compatible with library_manager.py 1.667 and older. 

========== find_pnfs_file.py ====================================================================================

Modifications made after bugzilla bug#544 comment #3. Only import either the file_clerk_client or info_client, but not both. 

Allow for the default of find_pnfs_file.find_pnfsid_path() to go to the file_clerk. Allow for the use_info_server flag to be set to allow the PNFS scan code to use the info_server instead. 

Updated comments after suggestions from Sasha (bugzilla 483). 

1) Handle when Linux caches mismatched information for the regular PNFS filename and the .(access)() filename. 2) Detect when a deleted file has been replaced. Raise an exception instead of returning the .(access)() filename. 

Differentiate between a file not existing at all and a file that has been replaced. 

Replace os module calls with file_utils.py calls. 

When reporting the error that a file recorded as deleted in the Enstore DB was found in pnfs, give the filename instead of the pnfsid. 

Give better error message when permissions prevent successful findinf of the file. 

========== generic_server.py ====================================================================================

Removed most (but not quite all) traces of string exceptions. 

========== checkdb.py ====================================================================================

change call to file_utils.rmdir to account for new signature (now this function is void and just throws exception if something goes wrong) 

added header 

1) added function rmdir to file_utils that effectively executes "rm -rf path" 2) modified checkdb.py so that it cleans up after itself not leaving old stuff behind. This change makes it immune to postgresql version changes 

========== info_server.py ====================================================================================

1) multi threaded info server and file server w/ thread safe DB API 2) proper handling of exceptions DB transactions in edb Bugzilla #579 http://uqbar/reviews/r/28 

remove these warnings: nfo_server.py:272: Local variable (msg) not used info_server.py:322: Local variable (msg) not used info_server.py:390: Local variable (msg) not used 

The commands --find-original, --find-the-original, --find-duplicates, --find-all-copies and --find-copies commands are now available to users through the info server. Admins can now use them using the "enstore file" or "enstore info" commands (though the "enstore file" variants points to the info server). In addition to this the enstore info --show-copies now works like it was supposed to. 

correct previous patch 

fix for: Line 371 assumes that there will only be one match possible for each location cookie, external label combination. This is not true. I offer one random example, there are many more: 

bug fix: Mike reported that enstore info --file TEST23:0000_000000000_0000600 stopped working. This patch fixes it. 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

These changes have these Enstore servers using dispatching_worker.send_reply_with_long_answer() instead of their local copy of this function. Also, the commented out duplicated code has been removed too. 

remove print 

file_clerk - minor printout change info_server, info_client: noticed that command like "enstore info --show-file CDMS115209320400002" do not work Fixed. 

========== configuration_client.py ====================================================================================

Corrected a comment. 

Added reply_serverlist(), only the monitor has used this configuration server feature and did so by using generic client. Also, added --copy to be able to specify the configuration_server's internal configdict copy level. 

These patches are related to getting the configuration server switched to using dispatching_worker's new send_reply_with_long_answer() function. Backward compatiblity with old clients and servers is still there. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

Patched get_movers2() to honor the library_manager parameter. 

Removed most (but not quite all) traces of string exceptions. 

========== inventory.py ====================================================================================

added standard header 

I renamed the new variables: rc_file3 => rc_contents_list3 n_recyclable3 => number_of_recyclable3 

Added third category of recyclable volumes. This new category is for migrated, duplicated or cloned volumes. 

========== enstore_files.py ====================================================================================

correct syntax 

forgot SeenDown file in previous committ 

address issue with "enstore inq --is-up enstore" by introducing read-write lock that allows multiple concurrent read and single write of enstore schedule file 

========== enstore_log_file_search_cgi.py ====================================================================================

correct HTML output (per incident (INC000000021389) 

========== get_total_bytes_counter.py ====================================================================================

increase timout communicating to configuration server 

correct incorrect if condition. Do float(row[0]) to avoid problem with Decimal 

do not count shelf and test libraries 

========== file_clerk.py ====================================================================================

1) multi threaded info server and file server w/ thread safe DB API 2) proper handling of exceptions DB transactions in edb Bugzilla #579 http://uqbar/reviews/r/28 

bug fix: remove line that contained undefined variable Bugzilla : #575 RB : http://uqbar/reviews/r/25 

implementation of multithreaded file and volume clerk that use psycopg2 via edb 

http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=422 take into account Mike's comments: 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

added new constant : FILE_DELETED_FLAGS list of supported delete flags check value of deleted string in file_clerk_client and file_clerk. 

converted deleted to string.lower(deleted) so not to confuse people who specify enstore file --bfid GCMS125018340400000 --deleted NO 

Added interface functions, to support migration working through file clerk: find_migration_info() set_copied() unset_copied() set_swapped() unset_swapped() set_checked() unset_checked() set_closed() unset_closed() Support functions added: time2timestamp() __find_migration_info() __migration() __set_migration() __unset_migration() 

These changes have these Enstore servers using dispatching_worker.send_reply_with_long_answer() instead of their local copy of this function. Also, the commented out duplicated code has been removed too. 

discovered that enstore info --list wrong_volume_format breaks. This commit fixes it 

followed up on our e-mail exchange this morning - added function invoke_functon that can be overriden by subclasses. Modified file_clerk accordingly 

file_clerk - minor printout change info_server, info_client: noticed that command like "enstore info --show-file CDMS115209320400002" do not work Fixed. 

file_clerk: 1) in __tape_list use connection pool 2) spawn tape_list3 in separate thread 3) add two new parameters - max number of threads and maximum number of open database connections (which is passed to edb) edb: 1) add new data member connection pool (from DBUtils) 2) add new parameter - maximum open connection allowed in the pool 

fix unbound variable 

1) fix pool instantiatin call 2) fix run_in_thread call 

call tape_list3 function in separate thread 

========== duplication_util.py ====================================================================================

1) Allow for the duplication of a duplicate. 2) Allow for make additional duplicates (i.e. _copy_2) if _copy_1 already exists). 3) Make --make-failed-copies work. 

========== enstore_system_html.py ====================================================================================

Added link to active_volumes.sh (ticket 442) 

don not count shelf and test libraries 

========== rawUDP.py ====================================================================================

Code review followup (bugzilla ticket 384) removed enable_print_queue 

Code review followup changes. (bugzilla ticket 384). 

cut/paste bug fuxed buffer -> self.buffer 

enable_reinsert -> self.enable_reinsert 

1. Added fuctions to control rawUDP 1.1. enable_raw_queue_print() - for debugging 1.2. disable_reshuffle() - when reinserting ticket into incoming queue do not change thge original place in the queue - this done for better processing of mover requests 1.3. set_keyword() - address messages in the queue by specified keyword instead of message id - this is for mover requests. Keyword: "mover" 

Modifications after code inspection. 1. Changed a raw message format. Not it is : (message, (sender_ip, sender_port)) 2. Use Types 

removed print statement 

1. Unconditionally reinsert duplicated request. 2. Better debug output files path. 

fixed bugs detected by lint 

Replace request by new request if it has the same id. The idea is: If new mesasage has the same id as the message that is already in the message queue, this means that it is a repeated message and sender expects reply to this last repeated message - not to the original one. Hence the original message has to be replaced by the repeated. In addition to this repeated message is reinserted into the list of messages closer to the beginning, allowing it to get picked up earlier. This modification proved a drastic improvement in communication between encp clients and library manager. 

better message id 

Drop messages with the same id (repeated messages). 

more code for event_relay messages 

1. Some message processing was moved out of _get_raw_message to rawUDP:put 2. Some special processing was added for mover messages: Remove old mover message from the queue if the newer arrives from the same mover. This eliminates the lagging of mover messages. 

========== put.py ====================================================================================

Updated some comments after suggestions from Sasha (bugzilla 483). 

Added support for encp_wrapper.py to also use "get" or "put". 

Same change made to get.py revision 1.138. See bugzilla 337. This is from the encp bug where encp.py would return the correct exit status, but frozen encps would always return success. 

========== volume_assert.py ====================================================================================

If an error happens for the volume, make sure to return an error. Otherwise, the rest of volume_assert assumes that no file errors (because the list of file errors is empty) means that everything was fine. (bug #529) 

Added try... excepts inside lock aquire() and release() prevent deadlocks. (bugzilla #483) 

Bring volume_assert usage into allignment encp-wrapper.py for migration. 

This patch is in response to bugzilla #392. Volume assert now has more patience when submitting requests to the LM. Also, if a request is not successfully made, handle the situation better. 

========== enstore_make_generated_page.py ====================================================================================

typo fix : Weekely -> Weekly (http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=444) 

========== enstore_display.py ====================================================================================

Patched division-by-zero traceback when get_mover_list() returns an empty list. (bug #569) 

Modified some numeric literals to be constants after reviewboard comments (see also bugzilla bug #560). 

If the main thread is hung, restart the entire process. 

Minimize sending show() queries to the inquisitor. 

Sasha reported a bug. The issue is that the state change message was not received, a transfer message was received and when entv went to update the new instantaneous rate it ws failing because the state was not ACTIVE. 

Some of the interactive features were broken with the last patch. They are working now. 

1) Catch all exceptions while a thread has acquired a lock. 2) If the display thread hangs waiting for X, which has been observed using gdb, then re-exec() the process. 3) Instead of re-exec()ing when the number of objects increases, only re-exec() if more than 50% of the total system memory is consumed by the entv process. 

Instead of using images for the active and positioning icons, draw them instead. 

========== configuration_server.py ====================================================================================

Changes made for bugzilla #367 comment #16. New function __get_config_value(). _get_domains() handles if the 'domains' section of the configuration is not a dictionary. Some comments are corrected to match the code. 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

Set default do_copies to 1. This is for copy.copy() to be used instead of a copy.deepcopy() or a direct reference to configdict. 

The previous patch introduced a bug where dump2() would still work, but dump() failed with "Message too long". 

Improved the speed of some functions by modifying how they tried to access the configdict. Added some locks for thread safety. Added support to adjust the internal copy level of the configdict on the fly using the "enstore conf --copy 0|1|2" command. 

Work done to improve the response times of lookup(), dump() and dump2(). Some caching is involved of these responses. 

For dump() and dump2() don't supply a thread name. Allow the total maximum threads per Enstore processes imposed by dispatching_worker. 

This is to hopefully address the issues in bugzilla 403. The main thing for speeding it up is that _get_system_name() caches its return value. Other thread syncronization changes have also been done, since there have been errors. 

These patches are related to getting the configuration server switched to using dispatching_worker's new send_reply_with_long_answer() function. Backward compatiblity with old clients and servers is still there. 

Use the new dispatching_worker.send_reply() function. 

========== library_manager_client.py ====================================================================================

Added reset_pending_queue_counters() method and --reset-queue-counters option to reset pending queue of data transfer requests counters: number of accepted requests resets to the number of requests in the queue, number of deleted requests resets to 0 

Fixed bug on line 473 

moverlock state added. 

========== Trace.py ====================================================================================

Log the correct threadname for servers that care. (bugzilla 595) 

Make the logname and threadname values in Trace.py threadsafe. Migration is known to have an issue, so encp_wrapper and volume_assert_wrapper also are modified. (bugzilla bug #533) 

Add support to tell trace() or message() to send the message to standard out or standard error. (bugzilla bug #546) 

Added severity as an optional argument to handle_retries(). 

The locks have been commented out. 

Added locks to prevent one thread from starting to print a message, get interupted by another thread printing a differnet message and then the rest of the first message is printed. Only one should happend at a time now. 

Code review followup changes. bigzilla reference ticket 378 

Do not truncate message in trace(), when it is sent to stdout. 

Output the time in default_log_func(). Bugzilla #374. 

Removed most (but not quite all) traces of string exceptions. 

========== volume_clerk.py ====================================================================================

pass ticket to restricted_access http://uqbar/reviews/r/36 http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=586 

it was noticed that sorting on same values could be unpredictable. Added label to the order clause to avoid that. 

proper syntax 

modify restricted_access to accept reply_address as argument 

implementation of multithreaded file and volume clerk that use psycopg2 via edb 

Moved some common for library_manager.py and volume_clerk.py constants to enstore_constants.py Moved hack() to volume_family.py and renamed it to match_volume_families() This was done as followup on library_manager.py code review for LM scalability, bugzilla ticket 435 

Replace lines using e_errors.FILE_CLERK_ERROR with e_errors.VOLUME_CLERK_ERROR. This is due to comments from Dmitry in Bugzilla #394. 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

Added interface functions, to support migration working through volume clerk: list_migrated_files() list_duplicated_files() get_migration_history() set_migration_history() set_migration_history_closed() Support functions added: _migration_history() 

These changes have these Enstore servers using dispatching_worker.send_reply_with_long_answer() instead of their local copy of this function. Also, the commented out duplicated code has been removed too. 

update modification time on volume touch 

removed stupid and misleading print from set_remaining_bytes call 

========== entv.py ====================================================================================

Sasha reported a case where a mover in error state was not being displayed correctly. Bugzilla bug #560 comment #2. 

In total_memory(), the second sysconf() call should have been to get the size of a page in memory, instead of getting the number of pages in memory. 

If the main thread is hung, restart the entire process. 

Cleanup some error messages. 

Minimize sending show() queries to the inquisitor. 

1) Catch all exceptions while a thread has acquired a lock. 2) If the display thread hangs waiting for X, which has been observed using gdb, then re-exec() the process. 3) Instead of re-exec()ing when the number of objects increases, only re-exec() if more than 50% of the total system memory is consumed by the entv process. 

Fixed the --generate-messages-file switch. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

Handle an error where the current systems 'known_config_hosts' and the target systems name for itself in its own 'known_config_hosts section are not the same. 

========== encp_wrapper.py ====================================================================================

Added support for encp_wrapper.py to also use "get" or "put". 

Added error message to catch intermitant problem of missing error message from encp. 

Access the encp error message value in a thread safe way. 

1) Accept the encp command as a list of argv values instead of as a string. Spaces in filenames caused the old implimentation to fail. 2) Set the effective UID and GID back to root after the encp. 

========== enstore_make_plot_page.py ====================================================================================

add link to mover plots 

========== udp_common.py ====================================================================================

changed one Trace call 

Added agrguments for modified en_enal call 

========== enstore_functions.py ====================================================================================

When we have an IP address, it is correct to use socket.gethostbyaddr() instead of gethostbyname[_ex](), since we have an IP address and not a hostname. This is for get_enstore_tmp_dir(). 

Modified get_enstore_tmp_dir() to compare with all the IP addresses for the node, not just the default hostname. The consequence of this was that it was trying to contact the configuration server when it should have looked at the local conf file and was causing a long delay. 

========== rawUDP_p.py ====================================================================================

Changes driven by pychecker. 

Code review followup (bugzilla ticket 384) removed enable_print_queue 

Code review followup changes. (bugzilla ticket 384). 

1. Added fuctions to control rawUDP 1.1. enable_raw_queue_print() - for debugging 1.2. disable_reshuffle() - when reinserting ticket into incoming queue do not change thge original place in the queue - this done for better processing of mover requests 1.3. set_keyword() - address messages in the queue by specified keyword instead of message id - this is for mover requests. Keyword: "mover" 

Modifications after code inspection. 1. Changed a raw message format. Not it is : (message, (sender_ip, sender_port)) 2. Use Types 

1. Unconditionally reinsert duplicated request. 2. Better debug output files path. 

debug output file path is the same as for the server 

fixed bugs detected by lint 

fixed bugs detected by lint 

Replace request by new request if it has the same id. The idea is: If new mesasage has the same id as the message that is already in the message queue, this means that it is a repeated message and sender expects reply to this last repeated message - not to the original one. Hence the original message has to be replaced by the repeated. In addition to this repeated message is reinserted into the list of messages closer to the beginning, allowing it to get picked up earlier. This modification proved a drastic improvement in communication between encp clients and library manager. 

added debug print, better message id 

use multiprocessing.Manager to create and maintain shared resources 

more code for event_relay messages 

bugs fixed: queue_size is now correct 

Some message processing was moved out of _get_raw_message to rawUDP.put 

========== media_changer.py ====================================================================================

Patch for bugzilla bug #541. A cleaning tape not declared to enstore failed to be mounted. This patch allows for such tapes to be mounted and dismounted using the --mount and --dismount commands. 

bugzilla 499 code review changes 

Some more code review changes 

Changes in response to code review (ticket 499) 

1. Changes to make MTX MC working at LSU 2. Replaced popen2.popen3 with enstore_functions2.shell_command() 

Add in a select() of the pipe from the rsh process in STK_MediaLoader.timed_command(). This should allow for timing out of the process if the rsh doesn't close the its side of the pipe. Previously, the process would block in read(), and if the timeout expired, the process would stay blocked if the rsh didn't close the pipe. (Bugzilla #455.) 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

Return the location information for STK robots for the --show-volume command. 

For STK media_changer in listSlots(), when converting strings to integers, only one conversion was catching TypeError and ValueError. Most were just catching TypeError. If a value error occured (when instead of the expected integer value the MC got something like "Volume VOG123 ejected" instead) the request was not getting removed from the work_query_list and eventually would result in a denial-of-service state once the queue was full of old/failed requests. 

Define --eject and --insert to be no-ops, with an error, for STK, IBM and MTX media_changers. 

========== enstore_stop.py ====================================================================================

Fixed enstore_start.this_host() to report all hostname and IP addresses for the node. The use_alias variables are no longer needed since all hostname and IP information is used every time. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

Removed most (but not quite all) traces of string exceptions. 

========== duplicate.py ====================================================================================

Switched "yes" to migrate.YES from Sasha's comments in bugzilla 418. 

Compatibility changes with migrate.py 1.202. 

The migrate.py version of is_expected_volume() now takes a db argument. Even though this version doesn't use db, the argument list was modified to remain compatible. 

1) Allow for the duplication of a duplicate. 2) Allow for make additional duplicates (i.e. _copy_2) if _copy_1 already exists). 3) Make --make-failed-copies work. 

For migration and duplication: 1) Fixed migrating deleted files. For duplication: 1) Honor --use-volume-assert for scanning. This involved reworking the code so duplicate.py used final_scan_volume() and final_scan_file() from migrate.py instead of its own (obsolete) duplicate.py versions. For Migration: 1) Prevent migrate.py --restore from working on duplicated files. 

Enable --force to work on supposidly completed destination duplicated volumes. Also, enable --scan-vol to work when the source and destination files have already been swapped. 

Fixed a bug where err_msg could be used before being set while 'swapping' metadata. 

========== info_client.py ====================================================================================

The commands --find-original, --find-the-original, --find-duplicates, --find-all-copies and --find-copies commands are now available to users through the info server. Admins can now use them using the "enstore file" or "enstore info" commands (though the "enstore file" variants points to the info server). In addition to this the enstore info --show-copies now works like it was supposed to. 

made indend 4 spaces to be consistent with the rest of the code 

fix bugzilla http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=437 print modification_time in enstore info -gvol ... in human readable format 

Fixed typos. long_answer should be long_reply. 

Use the new generic_client.send() long_reply argument for those functions that do need to obtain reponses with more information than UDP can handle. 

These changes have these Enstore servers using dispatching_worker.send_reply_with_long_answer() instead of their local copy of this function. Also, the commented out duplicated code has been removed too. 

file_clerk - minor printout change info_server, info_client: noticed that command like "enstore info --show-file CDMS115209320400002" do not work Fixed. 

========== alarm_server.py ====================================================================================

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

========== operation.py ====================================================================================

added product categorization tiers for tab flipping 

protect import remedy_interface in try : except block (http://uqbar/reviews/r/41, http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=594) 

http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=576 RB http://uqbar/reviews/r/27/ assign flip tab remedy ticket to the correct service group 

introduced interface to new remedy API. Use this interface instead of system call in operation.py and create shell wrapper around tab_flipping_nanny.py Bugzilla #567 RB: http://uqbar/reviews/r/18 

Changed tab flipping output CAP for SL8500 at GCC to 0,5,0 (was 0,1,0), as per changes discussed at 10:30 Fri Nov 6 status meeting and recorded in elog http://ccfsrv2.fnal.gov:8181/Tapes+Log/7168 . 

========== enstore_functions3.py ====================================================================================

Modifed the import of is_chimeraid() from chimera.py to not fail if chimera module can not be found. (The rest of the chimera patch is not ready for production yet). (bugzilla bug #606, review board #50) 

Chimera integration changes 

========== option.py ====================================================================================

Address printing help_strings with embedded newlines. (bugzilla bug #605, review board #48.) 

Patch to keep the code from confusing arguments and switches with the same string values (without any leading - or --). (bugzilla bug #600, review board #46) Also, add the new fs.py switches for extended attributes. (--xattr, --xattrs, --xattrrm, --xattrchmod --xattrchown) 

Added --get-bfids for encp/get for migration. 

Added reset_pending_queue_counters() method and --reset-queue-counters option to reset pending queue of data transfer requests counters: number of accepted requests resets to the number of requests in the queue, number of deleted requests resets to 0 

Added --scan as a more generic switch to replace migrate.py's --scan-volumes switch. 

Added --debug for migration. 

Get --eject and --insert working for media_changer_client. Added --ioarea and --remove for media_changer_client. 

========== net_driver.py ====================================================================================

Changed receive (select) timeout from 5 to 1 min. This should be enough to receive a block of the data from network. 

========== edb.py ====================================================================================

1) multi threaded info server and file server w/ thread safe DB API 2) proper handling of exceptions DB transactions in edb Bugzilla #579 http://uqbar/reviews/r/28 

added standard header 

implementation of multithreaded file and volume clerk that use psycopg2 via edb 

conform to code standards 

adhere to code standards 

file_clerk: 1) in __tape_list use connection pool 2) spawn tape_list3 in separate thread 3) add two new parameters - max number of threads and maximum number of open database connections (which is passed to edb) edb: 1) add new data member connection pool (from DBUtils) 2) add new parameter - maximum open connection allowed in the pool 

fix syntax 

1) fix pool instantiatin call 2) fix run_in_thread call 

call tape_list3 function in separate thread 

========== enstore_utils_cgi.py ====================================================================================

remove dependency on regex and regex_syntax 

========== atomic.py ====================================================================================

Added a flags argument to atomic.open2() to match that of the os.open() function. Modified file_utils.py, pnfs.py and enmv.py to use the new format. 

========== cleanUDP.py ====================================================================================

Removed Trace.handle_error() calls. Now that dispatching_worker and generic_client can handle long messages, these errors need to be passed up to those layers so that they can do the correct thing. 

removed debuggging print statement 

Fixed occurences of msg.errno when msg has no errno attribute. 

Removed most (but not quite all) traces of string exceptions. 

========== generic_client.py ====================================================================================

Patched defect where the short answer in send() receives an error. It used to try the long answer, if allowed; now it skips the long answer on these errors. (bugzilla bug #598, review board #44) 

Removed unused import time 

When testing enstore_start.py it was noticed that in case of alive timeout the return value was always returnig "configuration_server". This fix will return a real offender name. 

Added to optional argument long_reply to send(). If None, then the default behavior of looking at the short reply to determine if a long answer needs to be obtained. Zero, for never getting the long answer . One, for always getting the long answer. 

In send(), don't use e_errors.ERROR for the unknown errors, use e_errors.UNKOWN instead. e_errors.ERROR is the log severity and not an error. 

This change is in response to Sasha's review comments in preperation for releasing encp v3_9. The send() function creates a connect_socket, but one error case referenced control_socket instead. 

Patched generic_client and dispatching_worker to extend the client/server protocol to handle messages that are too long for UDP. The send() function in generic_client.py was modified and so was dispatching_worker.send_reply(). The function callback.connect_to_callback() handles most of the connection issues to establish the socket connection. This is for the opposite side of the already existing callback.get_callback() function. The connect_to_callback() function is used by generic_client.send(). In dispatching_worker.py, send_reply() may call the new function send_reply_with_long_answer() if reply_to_caller() fails becuase the reply message is too long. 

Fixed occurences of msg.errno when msg has no errno attribute. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

========== en_eval.py ====================================================================================

Changes after code review 1. Modified function patterm 2. Use Types 3. A bit more optimal code 

1. Additional arguments in en_eval check=True -- check for the presense of the function in expression. when rawUDP is used there is no reason to check incomong message 2 times: int rawUDP.put and udp_server.get_message compile=False use complier to check for the presense of the function in expression. Using compiler is very time consuming operation and anyways it is deprecated. If set to False (default) - use re.search for a function pattern this is about 20 times faster comparing to compiler 

Do not reraise NameError exception. Just return the value and let others to take care of this. This is related to event_relay messaging that has it own message format. 

========== migrate.py ====================================================================================

Modified after suggestions from bugzilla bug #528 comment #6. It uses one continue statement instead of two. 

While scanning a destination volume: 1) Handle an error getting the src file information. (bugzilla #528) 2) As a bonus, remove an uncessesary volume information query for every file on the destination volume. Also, handle volume_assert errors better. (bugzilla #529) 

Use the new Trace.handle_error() severity argument to send the exception in pnfs_find() to the debug log file instead of the log file 

Address deleted files that have been replaced with another file. (bug #497) 

1) Added --get-bfids for encp/get for migration. 2) Added support for encp_wrapper.py to also use "get" or "put". 3) Bring volume_assert usage into allignment encp-wrapper.py for migration. 4) Stop setting replaced deleted files as active. 5) Give a hint when the Linux kernel has mismatched information cached for the regular pathname and the .(access)() pathname. (Bugzilla #483) 

Include recomendations from review of bugzilla #418. Expanded comments in show_status() and better error message in restore() for an impossible situation that should never occur. 

In get_file_info() and get_volume_info() set the status field when accessing the DB directly. See bugzilla #427. 

1) Added a seperate deleted queue to seperate active from deleted files. These two types of tapes go to different tapes, so we don't want one type waiting on the mount/dismount of the other. 2) Moving toward using the clerks or using the DB directly. The USE_CLERKS constant near the beginning of the file controls which to use. Currently it is set to false. 3) Inside pnfs_find() added __find_pnfsid_path(). PNFS will from time to time report ENOENT for files that really do exist. The loops a few times to see if the answer changes. (bugzilla #390) 4) When migrating a backup file of the Migration PNFS database, don't fail the migration because the basename contains "Migration". (bugzilla #410) 

Patch for bugzilla #370. In pnfs_find() there was one spot where the lock was not being released before the exception was raised. 

Moved a Trace.handle_error() call in pnfs_find(). Both the source and destination (if copied already) get checked, the error logging was happening after only the first was checked. When reading/scanning if an error occurs a check was added to see if the tape is NOACCESS or NOTALLOWED. If so, reading of additional files is stopped. Files already read to disk should be allowed to be written to tape. 

Added get_file_info() and get_volume_info(). They aren't used anywhere (yet), but they should prove to be useful in the future. 

1) Detect and fix files marked as deleted in the Enstore DB that exist in PNFS. 2) Replaced --scan-volumes with --scan. Now a destination BFID can be give instead of just destination volumes. 3) Fixed the scanning of a multiple copy file to scan the multiple copy instead of the original copy. 

1) Corrected an ordering issue with --status and multiple copies. 2) The proceed_number value is honored again. 3) Checks if the deletion lists are not empty after an encp returns. Reports an error if they are not empty and clears them before continuing. 

Added a return when writing to tape that indicates the write attempt failed due to a non-retriable error. Also, moved the return on one of the returns in the same function, write_file(), to the right one column where it belongs. 

If migrating a delete file where the original directory no longer existed; an error was occuring. The exeception was IOError; while only OSError was being caught. Added IOError to that except list in use_libraries() to fix it. 

Added code to detect when the migration path points to a ghost file on a re-run of the migration. 

When removing the output file before retrying the encp write, if the error remove() returns is ENOENT treat it as a success. 

Hopefully this patch will address bug #310. This issue is with makedirs() failing in PNFS, because it is succeeding to make a directory. 

Removed debugging output. 

Removed some debugging output. 

1) Handle migrating a file to multiple tapes using encp's multiple copy functionality. 2) Handle migrating a tape filled with multiple copy files. 3) Fixed a condition where the file was written to the new tape, but not swapped. A re-run of the migration of that file continued to fail because the temporary file in /pnfs/fs/usr/Migration had been deleted. 4) Updated the --status output to include 'O' and 'M' for original and multiple copy, respectively, in the S column. 

Fixed a bug were the migration ignores extra libraries passed on the command line using --libraries. 

Use some code from scanfiles.py to better handle joining threads. 

Coordinate errors from encp to migration better. If encp returns an exit status of 2 the migration should not retry the encp. (This does the same thing that get and sdsscp did for the SDSS migration.) 

Patch the case were a deleted file is migrated to multiple copies. The issue was in the use of pnfs library information found in the tags versus the use of library information obtained from the user using --library. 

Some multiple copy files/tapes had migrations attempted before the check to prevent it from happening was added. This patch fixes --restore to be able to unmigrated a multiple copy file that had such a migration attempt made on it. At some point the code may be modified to support the migration of multiple copy files, but for now it is not allowed. 

1) Allow for the duplication of a duplicate. 2) Allow for make additional duplicates (i.e. _copy_2) if _copy_1 already exists). 3) Make --make-failed-copies work. 

When writing, set the delayed dismount to 2 minutes for each multiple copy to be written. This is to avoid unecessary bouncing of tapes in and out of drives. 

Handle the rare situation where a deleted file now shares the same as as a directory. The remove() fails, but since the file type is wrong, we can conclude that it should not fail the scan. 

Accidentally left using volume assert on as the default. Now off by default. 

1) Moved set euid/egid functionality to file_utils.py. 2) Fixed a bug that would cause a thread to exit early, but not be joined or report any errors. Any future unexpected errors like this will now be logged too. 3) Fixed a queueing bug that was the root cause of #2. This should solve the infamous "hanging" problem. 4) Fixed being able to Ctrl-C a migration process. 

Resolved a number of deadlocks. 

Patch to fix --scan-vol after the last patch. 

Modified to be able to keep multiple encp requests going at once to keep the LM queue full. 

Fixes a number of issues with respect to multi-threaded/multi-process migration. (There still is a deadlock situation, so this is currently disabled.) Patch to read files with a space in their pathname. 

========== enstore_start.py ====================================================================================

When we have an IP address, it is correct to use socket.gethostbyaddr() instead of gethostbyname[_ex](), since we have an IP address and not a hostname. 

Fixed enstore_start.this_host() to report all hostname and IP addresses for the node. The use_alias variables are no longer needed since all hostname and IP information is used every time. 

fixed syntax error on line 411 

Post code review changes (bugzilla ticket 388). modified command on line 411 

Post code review changes (bugzilla ticket 388). 1. Changed output: "Will execute:", cmd_list 2. Modified commands to exclude "enstore start", "enstore stop", "enstore restart" 

For multi-homed Enstore nodes, all IP addresses need to be checked, not just the default IP address. 

Removed some debug outputs. Removed some commented lines. 

1. Better expression for checking if the componets to be started is not already running 

on start: if there is no response to alive, check with EPS before starting 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

Replaced popen2.Popen3 with subprocess.Popen and pipeoblect.communicate and fixed bugs. 

import subrocess 

import subrocess 

popen2 is deprecated in last python releases. Replaced with subprocess 

Removed most (but not quite all) traces of string exceptions. 

========== aci.py ====================================================================================

Get eject() and insert() working. The AML/2 is going away soon, but at least the media_changer_client.py has been tested. 

========== e_errors.py ====================================================================================

Instead of having the python version exactly match (2, 6) it must be greater than or equal to (2, 6). Also, fixed the EnstoreErrors string representation to be EnstoreError instead of EncpError. 

========== enstore.py ====================================================================================

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

Removed most (but not quite all) traces of string exceptions. 

========== volume_assert_wrapper.py ====================================================================================

Bring volume_assert usage into allignment encp-wrapper.py for migration. 

========== enmv.py ====================================================================================

Added a flags argument to atomic.open2() to match that of the os.open() function. Modified file_utils.py, pnfs.py and enmv.py to use the new format. 

========== ejournal.py ====================================================================================

1) fix "Id" keyword (it was mistyped as "I") 2) remove duplicated code as per RB : http://uqbar/reviews/r/38/ 

added Id keyword per code review discussion RB : http://uqbar/reviews/r/38/ Bugzilla: http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=587 

implementation of multithreaded file and volume clerk that use psycopg2 via edb 

========== aml2.py ====================================================================================

Get eject() and insert() working. The AML/2 is going away soon, but at least the media_changer_client.py has been tested. 

========== accounting.py ====================================================================================

added standard header 

take into account Mike's commens in bugzilla ticket 479 

fix issue with IndexError reported by Mike 

========== dispatching_worker.py ====================================================================================

pass ticket to restricted_access http://uqbar/reviews/r/36 http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=586 

modify restricted_access to accept reply_address as argument 

revert recent changes 

Replaced python 2.6 specific threading.current_thread() with python 2.4 compatible threading.currentThread(). 

udp_server.py: 1) Eliminated self.reply_address, self.current_id and self.client_number since they are not thread safe. 2) Added reply_to_caller2(). Differs from reply_to_caller() by taking two arguments, the first is the object to send, the second is a dictionary with the 'r_a' element. 3) Added a self.tsd (Thread Safe Data) member variable. Created the init_thread_specific_data() function to handle the initializing of the thread specific data. dispatching_worker.py: 1) Eliminated use of self.reply_address and other self.xxx member varialbles, since they are not threadsafe. 2) Updated invoke_function() to handle starting a function in another thread/process if the function name is in the self.run_in_parallel list. The default is to run it in the main thread. 3) Extend self.tsd.is_child to include spawned threads. 4) Added __getattr__() and __setattr__() to handle looking at self.xxx or self.tsd.xxx. 5) Removed dispatching_worker.run_in_thread(). dispatching_worker.DispatchingWorker.run_in_thread should be used instead. 

Moved the function processing logging/tracing time code to __invoke_function(). This will allow it to be accurate for all functions run in parallel, instead of reporting the time to create a new thread/process. Since the code is in test mode, the ability to run a function in thread or process has been added. At this time only the configuration server optionally uses this new feature. 

Limit the number of threads for the Enstore processes, when thread_name is None. If thread_name is given, then allow only one thread. 

revert back from Trace.log to Trace.trace in process_request 

replaced Trace.trace(5,...) with Trace.log(e_errors.INFO) 

Modified send_reply_with_long_answer_part1() to resend the udp reply every 5 seconds while waiting for the client to connect over UDP. 

make sure argument is tuple 

bug fix, use apply(function,args) 

use thread_wrapper for function invocation (needed to call after function) 

followed up on our e-mail exchange this morning - added function invoke_functon that can be overriden by subclasses. Modified file_clerk accordingly 

Patched generic_client and dispatching_worker to extend the client/server protocol to handle messages that are too long for UDP. The send() function in generic_client.py was modified and so was dispatching_worker.send_reply(). The function callback.connect_to_callback() handles most of the connection issues to establish the socket connection. This is for the opposite side of the already existing callback.get_callback() function. The connect_to_callback() function is used by generic_client.send(). In dispatching_worker.py, send_reply() may call the new function send_reply_with_long_answer() if reply_to_caller() fails becuase the reply message is too long. 

log error if thread fails to start 

code review changes 

removed confusing log lessage 

put get_fd_message into try --- except wrapper 

renamed run_in_thread to _run_in_thread to hide it from subclasses 

If dispatching worker is configured to use raw input it can run callback messages processing in a separate thread (event relay messages). It is enabled in raw mode. If there are multiple instances of we need only one callback messages processing thread. To disable spawnig this thread use disable_callback This use 

If using rwaUDP rawUDP.receiver starts in serve_forever method. This is done to provide spawning receiver thread (process) in a thread. Before it was done when UDPServer onbject was created (in main thread) 

define request in do_one_request 

more code for event_relay messages 

========== encp_user2.py ====================================================================================

Major bug 147 addressed. encp.py revision 1.889 introduced a defect that only effected encp when encp_admin.py, encp_user.py or encp_user2.py were used to make a frozen version. The problem was that encp would always return 0, even for failures. 

========== volume_family.py ====================================================================================

Added a comment per code review for ticket 435 

Moved hack() to volume_family.py and renamed it to match_volume_families() This was done as followup on library_manager.py code review for LM scalability, bugzilla ticket 435 

========== encp.py ====================================================================================

bumping version to v3_9c because of encpCut 

Only output messages using Trace.py once. Also, send errors to standard error instead of standard out. 

bumping version to v3_9b because of encpCut 

The --skip-deleted-files switch only works in conjunction with --volume. The --volume switch is an admin switch, but --skip-deleted-files was a user switch. Now both are admin switches. 

bumping version to v3_9a because of encpCut 

Added catch-all excepts in prepare_read_from_hsm() and prepare_write_to_hsm() of create_read_requests() and create_write_requests() exceptions respectively. (bugzilla #483) 

Fix bug from bugzilla #508. encp could become confused after some errors and neither error out nor succeed. If $FAIL_1ST_DATA_SOCKET_LATER is set to python true, encp will similate the original error that put encp into the bad state. 

This is just a note that v3_9 was built against 1.972 and not 1.975. 

bumping version to v3_9 because of encpCut 

Some files were failing with "No such database" while migrating deleted files. This patch avoids the pnfs lookup in encp.verify_file_size() for deleted files. 

1) Added --get-bfids for encp/get for migration. 2) Added support for encp_wrapper.py to also use "get" or "put". 3) Handle tracebacks in constructors from "Too many open files". (Bugzilla 483) 

Comment added in response to bugzilla #476 comment #5. This describes that USE_NEW_EVENT_LOOP, USE_LMC_CACHE, et. al. are not modified by the code, but are intended to be used by a developer/tester to intentionally "break" encp for a particular test. 

Modifications from Sasha's suggestions in Comment #8 of bugzilla #465. 

Additional patch for bugzilla #465 issue two. The original patch (1.965) worked for non-mulitple copy writes, but multiple copy writes need these extra changes. 

1) If the library manager does not reply within 15 minutes of the initial message being sent; consider it a timeout error, reset the global __lmc variable and retry. 2) If handle_retries() gets an incomplete request ticket, see #1 for an example, assign the blame to the first non-completed request in the request list. Otherwise, the retry count updates are lost and encp may end up spinning endlessly without a chance of succeeding or giving an error. These are for bugzilla #476. 

Additional edge case to previous commit. If we had less then 30 seconds left before the 15 minute timeout expires while opening the control socket when a fake mover connection from the security scans connects; the loop would exit as if it had a successful connection and not an error. Now it raises a ETIMEDOUT error for this situation. 

Reduce the timeout period waiting for the control socket ticket to 30 seconds from the default 15 minutes. It was observed that security scans were connecting to encp and the bogus connections were preventing the movers from contacting encp. 

Removed some debuging output added to investigate bugzilla #465. 

Use the new pnfs_agent_client timeout specification. Previously, all timeouts were assumed to be "never." (bugzilla 465) Added an inner loop to write_to_hsm(). This change is to prevent double write re-submissions to the library manager. (bugilla 465) 

Handle errors from the LM better when writing multiple copies. This is for bugzilla #448. 

Patched encp to write any multiple copies if the original had a retry. Previously, if the original had a retry, then the internal accounting that the original had succeeded was lost when it came time to write the multiple copy. See bug #369. 

This patch is in response to bugzilla #365. It was possible for encp to use the wrong volume_clerk if the requested file was located on a tape in one Enstore system, but another Enstore system had a different tape with the same external label. This had been observed with NULL tapes, like NUL027 existing in GCCen and CDFen. 

Correct the bug report 361. For writes, some errors where being reported incorrectly. The known case was for writes where the tape mount took longer than the 15 minutes encp was waiting. The incorrect error was: ('TOO MANY RETRIES', ('NET_ERROR', 'Bad file descriptor')) It is now: ('TOO MANY RETIRES', ('UNKNOWN', "No data written to mover.") Reads did not have this problem. 

Modification to have encp return the correct error exit status (1 vs. 2) when used for migration. 

Fixed --max-resubmits and --resubmit-timeout. 

Modifications from suggestions from Sasha. Some exception raises in start() were replaced with "return 1". Calls to os.seteuid() and os.setegid() were wrapped with try/except. The list of handled exceptions from create_zero_length_pnfs_files() now has IOError and EncpError appened to it. When running the regression tests using pnfs_agent, a permission error was occuring; now the offending function, file_utils.chown(), is executed only if the real uid/gid is 0 (root). 

Major bug 147 addressed. encp.py revision 1.889 introduced a defect that only effected encp when encp_admin.py, encp_user.py or encp_user2.py were used to make a frozen version. The problem was that encp would always return 0, even for failures. 

This commit is just to reflect that v3_8 was actually made with encp.py 1.922 and not 1.955. v3_8 was made with code tagged bakken_tag_1_6_2009. 

bumping version to v3_8 because of encpCut 

Address bug #313. There were two spots in the code where the variable err_msg was being set to a string. It should have been setting one element in the err_msg dictionary to that string. 

Coordinate errors from encp to migration better. If encp returns an exit status of 2 the migration should not retry the encp. (This does the same thing that get and sdsscp did for the SDSS migration.) 

If necessary extract the starting copy number from the _copy_# file family passed in using --file-family. (This should only be used for duplcation.) 

Modified do_layers_exists() to work with pnfs or pnfs_agent. 

Instead of having the python version exactly match (2, 6) it must be greater than or equal to (2, 6). 

Replace calls to readlayer() with stat() calls. All that is needed is to know if there is anything in the layers and not the actual contents. Hopefully by avoiding reading in the entire layer, the performance will improve when there is heavy load. 

Added additional "Time to" messages for some checking steps inside handle_retries(). Also, added EnstoreError to the list of possible Exceptions caught from read_tcp_obj(). 

Call file_utils.py functions for hidding the modification of the euid/egid. 

Use the new file_utils.py chown(), chmod(), utime(), open() and remove() functions. 

1) Handle EINTR if raised from select() in open_data_socket(). 2) Added some logging in stall_read_transfer() and stall_write_transfer(). 

Correct the usage of the file_utils.py seteuid locking functionality. 

Send to the debug log, information about the transaction id(s) we are waiting for. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

Fixed a bug to get --override-deleted working again. This was likely introduced in revision 1.916. 

Fixed the previous commit to work on writes too. 

1) Patch to put the non-migration path in the wrapper on the tape when writing for migration. 2) Set non-root uid/gid in the Enstore DB for migration. 3) Patches for reading deleted files with --override-deleted. 

Modifed encp to include the library information for encp_error and encp_xfer. 

Patch submit_one_request() to return the correct number of elements on error. 

Modifed the wait_for_message() event loop to use the udp_client repeat_deferred() and drop_deferred() functions. A geometric backoff of resending outstanding requests has also been implimented, similar to the one in UDPClient.send(). 

Added some diagnostics when becomming a different user after the file is transfered, but before the final stages are completed. 

Split up the last access and modification time updates into two functions. They can fail do to permissions when the euid does not match that of the file. 

For reads with --skip-pnfs, pass the pnfs_name0 value to appease NullMovers. 

Added --skip-pnfs as a hidden option. This only can take effect when --get-bfid is also used. 

When reading, if a directory in the target path does not exist, catch the OSError that verify_read_request_consistancy() raises. (The error is raised trying to determine if there is sufficent space on the filesystem for the file in question.) 

Modified the --copy switch help string have "(0 = primary)" instead of "(0 = original)". 

========== ratekeeper.py ====================================================================================

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

========== pnfs_agent.py ====================================================================================

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

use run_in_thread from dispatching_worker 

removed confusing log lessage 

========== enstore_functions2.py ====================================================================================

Moved shell_command to misc. section 

Modified shell_cmd to return stdout and stderr 

Added shell_command which internally calls subropess. 

Use socket.getfqdn() instead of socket.gethostbyname() in fullpath() and fullpath2(). 

Added is_migration_file_family(), is_duplication_file_family() and is_migration_related_file_family() functions. 

========== scanfiles.py ====================================================================================

Divide up the scanning of a volume across multiple threads. (Bug #572) 

Allow for the default of find_pnfs_file.find_pnfsid_path() to go to the file_clerk. Allow for the use_info_server flag to be set to allow the PNFS scan code to use the info_server instead. 

Fix the issue with not handling deleted and migrated files correctly that have been replaced by another file. (bugzilla #539) 

Catch exception to avoid deadlock. The exception itself is not understood, since root should never fail to set an effective ID; thus more error reporting is also added. 

Patched such that Ctrl-C works again. Also, moved file system related calls to use file_utils.py. 

Avoid tracebacks for partially written layer 4 information. Also, handle the situation for mulitple copy files that have attempted to be migrated. 

1) Added code to give more accurate errors and warnings for files in the middle states of being migrated/duplicated. 2) Added the ability to make additional duplicates. This would involve making a _copy_2 file if the _copy_1 duplicate already exists. 3) Patched get_pnfsid() to use file_utils.open(). 

Deal with some reporting issues regarding migration/duplication files. 

Correctly identify situations were the duplicated files primary/copy status is out-of-sync between layer 4 and the active_files_copy table. Also, correctly identify where migration files are out-of-sync between layer 4 and the migration table. 

========== mover.py ====================================================================================

Code review for bz 552 changes. 

use sysconf to get total RAM size 

fixed formula for MAX_BUFFER it must be: MAX_BUFFER = long(mem_total)*KB - GB, because mem_total is in KB 

fixed typo 

fixed typo 

Per bugzilla 552 code review changes. 

run set_max_buffer() in a proper place 

fixed set_max_buffer() 

1. Set MAX_BUFFER depending on the python binary type: 32, or 64 bit. 2. Use enatore_funstions2.shell_command 

Introduced configuration key "expected_time_factor". Default value 50 Multiply expected time by this factor when determinig whether to interrupt read request or not. 

changed expected transfer time factor from 10 to 20 

1. Additional condition for termination of read request: In tape_thread: if time in ACTIVE state is > 10*(expected transfer time) - try to terminate transfer. 2. Restart only once. (Mover was trying to restart in IDLE while dismounting tape). 

1. Removed line 1852: self.too_long_in_state_sent = 0 # set this to avoid sending a false alarm If this is set and there are 2 threads running: "net_thread" and "tape_thread" no alarm was generated, In case when the transfer was stuck on the client side. It also was preventing tape_thread from attempt to terminate transfer when reading tape. 2. Added separate diagnostic message for a case when read timed out. 3. Modified transfer_failed to close net_driver only if it was called fron net_thread. Closing net_driver when net_thread is active makes net_thread to hang. Results: 1. For tape write requests net_thread detects problem with network and closes connection. Mover does not get restarted. Before it was restarting with " Net thread is running in the state XXXX.Will restart the mover...." 2. For tape read requests there is no good way of connection termination for the current protocol. So the mover will restart as before. 

Added library_list and current_priority to library manager ticket in disk mover 

Return correct errors when assert fails.(bugzilla ticket 460) Also changed some trace lavels. 

Removed locally defined CRC_ERROR and replaced it with e_errors.CRC_ERROR Code review followup for ticket 463 

Mover incorrectly alarmed CRC error when encp interrupts transfer (ticket 463) 

In assert mode mover was failing when encp was gone because self.header_labels was not defined (bugzilla #430) 

For cern wrapper mover was incorrectly treating interrupted writes (ENCP_GONE). This was causing a tape to get set to NOACCESS. (bugzilla #430). This pacth fixes this problem. Additional changes: changed trace levels for often repeated output to deeper levels. 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

Changes in responce to code review comments: 1. Added comments to log_processes 2. Changed the order of set_system_readonly and Trace.alarm in some places. 

1. Change error logging to alarming for cases when tape is set to readonly due to write error. 2. Set tape to NOACCESS when it is set to readonly. This change may be reverted later. 3. log all running processes when write error occurs. Add log_processes method These modifications address problem tickets: 349, 350, 352 

Replaced string exceptions with exception class. Python does not support string exceptions beginning with version 2.6 

1. Chaged controll socket connect timeout from 15 to 5 and the number of retries from 4 to 3 This should be more than enough. ENCP should already wait for connection. 2. Changed data socket connection to from 60s to 20s. This also should be enough. 

added current_time to lm ticket 

fixed crc check drivestat log message 

new drivestat log message format 

========== plotter_main.py ====================================================================================

implemented plots requested in : http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=439 

========== callback.py ====================================================================================

Added function get_unacked_packet_count(). This function returns the number of un-ACKed packets on the sender side. 

Patched generic_client and dispatching_worker to extend the client/server protocol to handle messages that are too long for UDP. The send() function in generic_client.py was modified and so was dispatching_worker.send_reply(). The function callback.connect_to_callback() handles most of the connection issues to establish the socket connection. This is for the opposite side of the already existing callback.get_callback() function. The connect_to_callback() function is used by generic_client.send(). In dispatching_worker.py, send_reply() may call the new function send_reply_with_long_answer() if reply_to_caller() fails becuase the reply message is too long. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

========== discipline.py ====================================================================================

Changes driven by pychecker. 

Codew review recommended changes (bugzilla ticket 388) 1. self.dict -> self.discipline_dict 2. in match_found added commenst describing default return values 3. replaced string.atoi(..) with int(...) 4. More readable ticket in unit test 

Discipline, modified for better library manager performance. This discipline requires a new format in configuration, it is not backward compatible with old discipline. 

corrected configuration example 

========== udp_client.py ====================================================================================

chnged trace 

Be more verbose in the unit_test output. Include the current thread name, and callback address in that output. 

Moved the thread_specific_data to a member of UDPClient() class instead of being a global. 

Removed use of the local Container() class to hold thread specific data and replaced it with the threading.local() class. Also, modified the unit test to instantiate the UDPclient() class in one thread, but run the send/receive test in another. This is in response to bug #367. 

Catch a key error trying to delete a sometimes non-existent ID from a list of transaction IDs. 

Added parameter exponential_to to send() by default exponential_to is set to False if set to True in indefinite retry mode the timeout will grow exponentially Otherwise in indefinite retry mode the timeout will be constant 

Handle the situation where a message, using repeat_deferred(), is going to be sent, but it has already been accepted by another thread and no longer in the sent-but-not-received queue. 

Added recv_deferred2(). This returns a tuple of the message and the transaction ID instead of just the message like recv_deferred() returns. 

Use expnential reply timeout only if initial timeout is set to 0. Which means: try forever. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

1. Use same timestamp for all messages for the same UDPClient object as was set originally 2. Do not include txn_counter into message id. These changes are done to identify "retried" messages in rawUDP 

create a new time stamp for each message. Before it was creted once, when UDPClient object was created 

Make message identifier unique for multithreded processes. 

Added functions repeat_deferred() and drop_deferred(). They are used when the caller schedules its own resending timeout schedule. 

Grow receive respose timeout by 2^n, where n - number of retries. The growth stops when n==MAX_EXPONENT MAX_EXPONENT=6 

Raise UDPError instead of errno.errorcode[errno.ETIMEDOUT]. This is to avoid raising string exceptions that python 2.6 no longer supports. 

========== enstore_alarm_search_cgi.py ====================================================================================

correct HTML output (per incident (INC000000021389) 

========== ftt_driver.py ====================================================================================

Replaced string exceptions with exception class. Python does not support string exceptions beginning with version 2.6 

========== media_changer_client.py ====================================================================================

Return the location information for STK robots for the --show-volume command. 

Get --eject and --insert working for media_changer_client. Added --ioarea and --remove for media_changer_client. 

Converted udp_client.UDPError and callback.TCPError to be replaced by e_errors.EnstoreError. 

========== migration_summary_plotter_module.py ====================================================================================

Added a comment explaining why some min() functions were changed to max() functions. It explains that for migrated, recycled and migrated (again) tapes XXOO00 contains the combined volume history for XXOO00 and XXOO00.deleted and that max() is needed to correctly reported their dates of migration. 

1) Corrected the started and migrated totals reported. 9940 tapes migrated and recycled back to 9940 tapes were resulting in an under-reported values. 2) The closed total was over-reporting the numbers. As long as one destination tape was scanned and recorded in the migration_history table the source tape was reported as scanned. Now it checks that at least one destination tape was scanned and closed AND that no source-to-destination pairs are left unclosed for the source tapes. 

========== delete_at_exit.py ====================================================================================

Removed the now unused Container class. 

Replaced the local Container() class for providing thread specific data with the threading.local() class. 

Modified the detection of stale information in the thread_specific_data object. Added an explicit test in get_deletion_lists() if the obtained container object's thread ID does not match the current thread's ID. 

Don't depend on SIGRTMIN to be defined, but use it if available. 

Linux uses some signals not included in signal.h (and not included in the python signal module either) that are used to syncronize information between threads (like updating the uid & gid). We shouldn't install our own signal handlers for these signals. 

========== enstore_constants.py ====================================================================================

improvements to : http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=439 Remembered that Mike had setup useful infrastructure of directories for generated html files. 

Added a comment per code review for ticket 435 

Moved some common for library_manager.py and volume_clerk.py constants to enstore_constants.py This was done as followup on library_manager.py code review for LM scalability, bugzilla ticket 435 

added new constant : FILE_DELETED_FLAGS list of supported delete flags check value of deleted string in file_clerk_client and file_clerk. 

Fixed the rate constants for LTO3 and LTO4 drives. The new values match those in the configuration. 

========== cern_wrapper.py ====================================================================================

replaced string exceptions 

========== pnfs.py ====================================================================================

Make the "enstore pnfs --id" enabled for the dCache version of the enstore command. The regression tests use it for the dCache tests. 

Removed debugging Trace.logs() and corrected temproary to be temporary in a comment. All of this was in set_file_size(). 

Suggestions from bugzilla 482. Avoid creating paths twice in get_path, though it is at the expense of creating paths that we might not need. 

Treat zero length files correctly in the consistancy check. Also, allow for files with long filenames to be able to set their file size. 

Restrict a user from setting a file_family tag to end in -MIGRATION or _copy_# as these are mangled migration/duplication file_family patterns. This is for bugzilla #143. 

Added a flags argument to atomic.open2() to match that of the os.open() function. Modified file_utils.py, pnfs.py and enmv.py to use the new format. 

Handle the empty string passed as a pathname to is_pnfs_path(). 

Use file_utils.py functions open(), chown(), chmod(), utime() and remove() instead of the python provided versions. 

========== volume_clerk_client.py ====================================================================================

Provided a mechanism for talking to the file_clerk or volume_clerk instead of the info_server. The default remains the info_server for commands that don't modify anything, but allowing a means for the clerks to be used in testing is useful. The trigger is --force on the command line; --force will not be listed by --help. 

Added these functions to support migration working through the volume clerk: list_migrated_files() list_duplicated_files() set_migration_history() set_migration_history_closed() 

These changes have these Enstore servers using dispatching_worker.send_reply_with_long_answer() instead of their local copy of this function. Also, the commented out duplicated code has been removed too. 

========== get.py ====================================================================================

Updated some comments and error messages after suggestions from Sasha. (bugzilla 483) 

Added support for encp_wrapper.py to also use "get" or "put". 

Major bug 147 addressed. encp.py revision 1.889 introduced a defect that only effected encp when encp_admin.py, encp_user.py or encp_user2.py were used to make a frozen version. The problem was that encp would always return 0, even for failures. 

Removed most (but not quite all) traces of string exceptions. 

========== ftt.py ====================================================================================

beginning with swig 1.3.21 the list is returned instead of tuple this workaround fixes the incompatibility issue 

========== plotter.py ====================================================================================

correct typo 

improvements to : http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=439 Remembered that Mike had setup useful infrastructure of directories for generated html files. 

added directory with mover plots : http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=439 

========== log_server.py ====================================================================================

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

========== accounting_server.py ====================================================================================

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

========== encp_admin.py ====================================================================================

Major bug 147 addressed. encp.py revision 1.889 introduced a defect that only effected encp when encp_admin.py, encp_user.py or encp_user2.py were used to make a frozen version. The problem was that encp would always return 0, even for failures. 

========== inquisitor.py ====================================================================================

take into account review suggestions 

address issue with "enstore inq --is-up enstore" by introducing read-write lock that allows multiple concurrent read and single write of enstore schedule file 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

revert back from combining two exceptions into tuple. Sasha explained that this might have unpredictable behaviour when we switch to python 2.6.2 

BUG FIX: Fixed uninitialized variable use. Name threads as "class_name.method_name" 

remove confusing log message 

========== file_clerk_client.py ====================================================================================

The commands --find-original, --find-the-original, --find-duplicates, --find-all-copies and --find-copies commands are now available to users through the info server. Admins can now use them using the "enstore file" or "enstore info" commands (though the "enstore file" variants points to the info server). In addition to this the enstore info --show-copies now works like it was supposed to. 

http://www-ccf.fnal.gov/Bugzilla/show_bug.cgi?id=422 take into account Mike's comments: 

Provided a mechanism for talking to the file_clerk or volume_clerk instead of the info_server. The default remains the info_server for commands that don't modify anything, but allowing a means for the clerks to be used in testing is useful. The trigger is --force on the command line; --force will not be listed by --help. 

added new constant : FILE_DELETED_FLAGS list of supported delete flags check value of deleted string in file_clerk_client and file_clerk. 

Added these functions to support migration working through the file clerk: find_migration_info() set_copied() unset_copied() set_swapped() unset_swapped() set_checked() unset_checked() set_closed() unset_closed() 

These changes have these Enstore servers using dispatching_worker.send_reply_with_long_answer() instead of their local copy of this function. Also, the commented out duplicated code has been removed too. 

Corrected the --mark-bad and --unmark-bad help strings to be more useful. Specifically in the area of when the optional [bfid] parameter should/needs to be included. 

Handle records with empty paths and pnfsid to avoid tracebacks. 

Some seteuid() patches to make --restore work in more situations. 

========== library_manager.py ====================================================================================

trace added 

allow_hipri was returning rq as None in case when a previous non hipri request was READ. It was not expected by the calling method. Now allow_hipri never return None as rq. 

For mover_idle and mover_bound_volume requests set mover state to SETUP when sending work to mover. 

Changes per Dmitry's comments for bugzilla 513 

In case of duplicate mover_idle or mover_bound_volume requests send a blank reply to avoid possible mover hangs du to the lost library manager reply to the previous mover request. 

Moved verify_data_transfer_request() in write_to_hsm() to correct place 

replaced ALARM with INFO severety level (bugzilla 512) 

Improved processing of write requests. If there are active volumes for a given file family and their number exceeds file family width try to write to all of them to fill unfilled volumes and avoid excessive mounts/dismounts (bugzilla tickets: 513,514,515) 

Improved scalability. Individual ports for movers, encp clients, and other clients. Each port is served by separate thread. 

On line 3120 Trace.alarm was replaced with Trace.log (ticket # 454) 

Corrected a bug found during code review of bugzilla ticket 431. 

More changes to make Admin (HIPRI) requests to correctly override regular priority requests. 

Fixed bug in mover_error "IDLE" instead of IDLE 

Fixed bug in get_host_name_from_ticket 

created a method get_host_name_from_ticket to replace multiple occurences of the same code, recommended by Michael. 

1. Backed off to rev. 1.658 2. If there are idle movers then do not attempt to preempt a volume, for which last work had regular pririty, by Admin Priority request. This dimishes the number of mounts/dismounts and improves the overall rates. 

In restric_host_access try to get hostname from callback address, this is important for multihomed hosts. 

Changed list to look in for busy movers in restrict_host_access. (bugzilla # 431) 

Do not make preemptive tape dismount if admin priority request is for would get rejected by discipline for idle mover. (bugzilla # 431) 

revert recent changes 

Various patches to bring the servers into alignment with dispatching_worker.py 1.189 and upd_server.py 1.56. 

When mover is removed from at_movers list do not send alarm, just log the error 

in check send alarm only once 

comments corrected 

Library manager may not be able to respond to a mover on time which results in the mover retry message. The mover requests may also be kept in the udp buffer before getting processed by the library manager. Both cases result in sending a work to the mover and then removing work from the active list as a result of the second idle request to avoid this problem compare the time of the mover request submission with the time when the work for the same mover became active. This code requires a new key in the mover ticket 

send alarm for a given transfer only once 

Do not remove work from active list, only send an alarm. Removing from active list causes tape mounts while they are still in use in another drive. 

========== udp_server.py ====================================================================================

revert recent changes 

Removed some debugging output. 

udp_server.py: 1) Eliminated self.reply_address, self.current_id and self.client_number since they are not thread safe. 2) Added reply_to_caller2(). Differs from reply_to_caller() by taking two arguments, the first is the object to send, the second is a dictionary with the 'r_a' element. 3) Added a self.tsd (Thread Safe Data) member variable. Created the init_thread_specific_data() function to handle the initializing of the thread specific data. dispatching_worker.py: 1) Eliminated use of self.reply_address and other self.xxx member varialbles, since they are not threadsafe. 2) Updated invoke_function() to handle starting a function in another thread/process if the function name is in the self.run_in_parallel list. The default is to run it in the main thread. 3) Extend self.tsd.is_child to include spawned threads. 4) Added __getattr__() and __setattr__() to handle looking at self.xxx or self.tsd.xxx. 5) Removed dispatching_worker.run_in_thread(). dispatching_worker.DispatchingWorker.run_in_thread should be used instead. 

code review followup (bugzilla ticket 284) 1. Removed enable_raw_queue_print 2. Added comments for disable_reshuffling 3. in send_with_list do not send a reply if deepcopy failed 

1. Added fuctions to control rawUDP 1.1. enable_raw_queue_print() - for debugging 1.2. disable_reshuffle() - when reinserting ticket into incoming queue do not change thge original place in the queue - this done for better processing of mover requests 1.3. set_keyword() - address messages in the queue by specified keyword instead of message id - this is for mover requests. Keyword: "mover" 2. in reply_with list() wrap list_copy = copy.deepcopy(list) into try...except see comments in reply_with list() for details. 

socket.sendto() silently truncates long UDP messages in python 2.4. In 2.6 an exception is raised. This patch catches long messages before they are truncated and raises the exception. 

Removed Trace.handle_error() calls. Now that dispatching_worker and generic_client can handle long messages, these errors need to be passed up to those layers so that they can do the correct thing. 

Modifications after code inspection. 1. Changed a raw message format. Not it is : (message, (sender_ip, sender_port)) 2. Use Types 

If using rwaUDP rawUDP.receiver starts in serve_forever method. This is done to provide spawning receiver thread (process) in a thread. Before it was done when UDPServer onbject was created (in main thread) 

added monitor 

Do not check message if used with rawUDP, because it is already checked in rawUDP 

changed trace statement 

process NameError and ValueError that could be risen by r_eval for envent_relay messages 

Turned on selection of rawUDP or rawUDP_p depending on python version 

Some message processing was moved out of _get_raw_message to rawUDP:put 

========== pnfs_agent_client.py ====================================================================================

Added some ifs to detect errors in some functions that were missing them. Added some Trace.log() calls to get_stat and get_pnfsstat() to furthur understand a reported traceback. Both changes are related to bugzilla #469. 

Use the default timeout and retry values while waiting for responses from the pnfs_agent. 

========== encp_user.py ====================================================================================

Major bug 147 addressed. encp.py revision 1.889 introduced a defect that only effected encp when encp_admin.py, encp_user.py or encp_user2.py were used to make a frozen version. The problem was that encp would always return 0, even for failures. 

========== file_utils.py ====================================================================================

Fixed wrapper() to return the return value from the executed function. (bugzilla bug #599, review board #45) 

intriduce euid/geuid protected wrapper to call os module functions should replace many functions in this module. 

Make set_euid_egid reset the euid back to root if the egid needs to be changed, otherwise we don't have the permissions to change the egid. 

1) added function rmdir to file_utils that effectively executes "rm -rf path" 2) modified checkdb.py so that it cleans up after itself not leaving old stuff behind. This change makes it immune to postgresql version changes 

These changes are in response to Sasha's review comments in preperation for releasing encp v3_9. Any exceptions from os.seteuid() and os.setegid() are now caught, the lock released and then the exception is re-raised. Also, the descriptive comment for the listdir() function was corrected. 

Added a wrapper for os.listdir(). Also, added an option to get_stat() to be able to use os.stat() by default or os.lstat() if need be. 

Added a flags argument to atomic.open2() to match that of the os.open() function. Modified file_utils.py, pnfs.py and enmv.py to use the new format. 

Added functions: open(), chmod(), chown(), utime() and remove() to handle locking the use of os.seteuid() around file operations. 

If the new euid and egid already are correct, skip setting it again. 

Refine the seteuid locking code. 

</pre></body></html>
