This appendix describes how to use symbolic links to avoid having to modify data service code.
Occasionally an existing data service has the path names of its data files hard-wired, with no mechanism for overriding the hard-wired path names. To avoid modifying the data service's code, symbolic links sometimes can be used.
For example, suppose the data service names its data file with the hard-wired path name /etc/mydatafile. You can change that path from a file to a symbolic link whose value points at a file in one of the logical host's file systems. For example, you can make it be a symbolic link to /hahost1/A1/myservicename/mydatafile.
There is a potential problem with this use of symbolic links. That is, sometimes the data service, or one of its administrative procedures, modifies the data file name as well as its contents. For example, suppose that the data service performs an update by first creating a new temporary file, /etc/mydatafile.new. Then it renames the temporary file to have the real file name by using the rename(2) system call (or the mv(1) program):
rename("/etc/mydatafile.new", "/etc/mydatafile"); |
By going through the sequence of creating the temporary file, and then renaming it to the real file, the data service is attempting to ensure that its data file contents are always well-formed.
Unfortunately, the rename(2) action destroys the symbolic link. The name /etc/mydatafile is now a regular file, and is in the same file system as the /etc directory, not in the logical host's dual-ported file system. Because the /etc file system is private to each host, the data is not available after a takeover or switchover.
The underlying problem in this situation is that the existing data service is not aware of the symbolic link and was not written with symbolic links considered. To use symbolic links to redirect data access into the logical host's file systems, the data service implementation must behave in a way that does not obliterate the symbolic links. So, symbolic links are not a cure-all for the problem of placing data on the logical host's file systems.