spacemanager: adapt to new properties naming convention

        deprecated:

        DefaultAccessLatencyForSpaceReservation
        SpaceManagerReserveSpaceForNonSRMTransfers
        SpaceManagerLinkGroupAuthorizationFileName

        added:

        spacemanager.default-access-latency
        spacemanager.enable.reserve-space-for-non-srm-tranfers
        spacemanager.authz.link-group-file-name
        spacemanager.enable.spacemanager
        spacemanager.service.poolmanager
        spacemanager.service.pnfsmanager

        spacemanager.db.host=${srm.db.host}
        spacemanager.db.name=${srm.db.name}
        spacemanager.db.user=${srm.db.user}
        spacemanager.db.password=${srm.db.password}
        spacemanager.db.driver=${srm.db.driver}
        spacemanager.db.url=${srm.db.url}
        spacemanager.db.schema.auto=${srm.db.auto}

    RELEASE NOTES:
	srmspacemanager adapted to new property
	naming convention

	deprecated:

        DefaultAccessLatencyForSpaceReservation
        SpaceManagerReserveSpaceForNonSRMTransfers
        SpaceManagerLinkGroupAuthorizationFileName

        added:

        spacemanager.default-access-latency
        spacemanager.enable.reserve-space-for-non-srm-tranfers
        spacemanager.authz.link-group-file-name
        spacemanager.enable.spacemanager
        spacemanager.service.poolmanager
        spacemanager.service.pnfsmanager

        spacemanager.db.host=${srm.db.host}
        spacemanager.db.name=${srm.db.name}
        spacemanager.db.user=${srm.db.user}
        spacemanager.db.password=${srm.db.password}
        spacemanager.db.driver=${srm.db.driver}
        spacemanager.db.url=${srm.db.url}
        spacemanager.db.schema.auto=${srm.db.auto}
    BOOK:
	SrmsSpaceManager is controlled by the following
        variables:

        spacemanager.default-access-latency
        spacemanager.enable.reserve-space-for-non-srm-tranfers
        spacemanager.authz.link-group-file-name
        spacemanager.enable.spacemanager
        spacemanager.service.poolmanager
        spacemanager.service.pnfsmanager

        spacemanager.db.host=${srm.db.host}
        spacemanager.db.name=${srm.db.name}
        spacemanager.db.user=${srm.db.user}
        spacemanager.db.password=${srm.db.password}
        spacemanager.db.driver=${srm.db.driver}
        spacemanager.db.url=${srm.db.url}
        spacemanager.db.schema.auto=${srm.db.auto}

    Patch: http://rb.dcache.org/r/5791/
    Acked-by: Gerd Behrmann
    Target: trunk
    Require-book: yes
    Require-notes: yes
dir: Comply with new property policy

New properties

dir.cell.name
dir.service.pnfsmanager

Target: trunk
Require-book: yes
Require-notes: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5809/
statistics: Comply with new configuration policy

New properties

statistics.cell.name
statistics.location
httpd.statistics.location

Deprecated

statisticsLocation

Require-book: yes
Require-notes: yes
Target: trunk
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5811/
admin,ssh1: Comply with new property policy

The admin service is split into admin and ssh1, with ssh1 being the
legacy admin door, and admin only providing ssh2.

Code inspection shows that the acm cell has to be a well-known
cell and has to be called acm. This is because the cell name is
hardcoded in all cells for admin acl verification. The configurable
cell name is thus removed, and the cell is moved into dCacheDomain
and loaded implicitly through the preload functionality.

To the admin this means that any configured ssh1 admin shell passwords
and admin acl rules have to be moved to the host holding the
dCacheDomain. These are the
etc/dcache/admin/{acls,relations,meta,users} files and directories as
well as /var/lib/dcache/config/passwd.

New properties

admin.cell.name
admin.net.port
admin.authz.gid
admin.paths.history
admin.paths.authorized-keys
admin.paths.dsa-host-key.private
admin.paths.dsa-host-key.public
admin.service.gplazma
admin.service.gplazma.timeout
admin.service.gplazma.timeout.unit
admin.enable.colors
ssh1.cell.name
ssh1.net.port
ssh1.net.listen
ssh1.paths.history
ssh1.paths.known-users
ssh1.paths.server-key
ssh1.paths.host-key
ssh1.paths.user-password
ssh1.enable.colors
dcache.paths.admin

Deprecated properties

admin.ssh2AdminPort
admin.ssh2.gid
adminHistoryFile
admin.colors.enable
admin.authorizedKey2
admin.dsaHostKeyPrivate
admin.dsaHostKeyPublic
dcache.paths.ssh-keys

Obsolete properties

AccessControlCell
knownUsersFile
serverKeyFile
hostKeyFile
userPasswordFile
sshVersion

Target: trunk
Require-book: yes
Require-notes: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5806/
Remove scoped cell.name property

All services now use <service>.cell.name to identify the name
of their primary cell. This patch removes the legacy cell.name
property (marked forbidden) and updates all scripts and batch
files to use the <service>.cell.name property instead.

There is no way to still support the legacy cell.name property
without the scoping operator.

Target: trunk
Require-book: yes
Require-notes: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5812/
Add a new gPlazma account phase plugin

gPlazma2 was still missing a simple way to ban users. This patch adds a
new plugin that allows blacklisting users based on <principal
type>:<value>
pairs given in a plain text file.

Example file:

---

alias name=org.dcache.auth.LoginNamePrincipal
alias dn=org.globus.gsi.jaas.GlobusPrincipal

ban dn:/C=XY/O=org/OU=Some Where/CN=Some One
ban javax.security.auth.kerberos.KerberosPrincipal:SOMEONE@SOMEWHERE.ORG
ban name:someone
ban dn:/C=XY/O=org/OU=Some Where/CN=Some One Else
ban javax.security.auth.kerberos.KerberosPrincipal:SOMEONEELSE@SOMEWHERE.ORG
---

Acked-by: Paul
Acked-by: Gerd
Target: master
Request: 2.6
Require-book: yes
Require-notes: yes
Patch: http://rb.dcache.org/r/5777/
spacemanager: Fix property annotations

The property annotation of DefaultAccessLatencyForSpaceReservation is
missing the default value. The patch also addresses the problem that
spacemanager.default-access-latency was not defined in terms of the
property it is deprecating.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5820/
spacemanager: Add missing properties and fix system-test config

Target: trunk
Require-book: no
Require-notes: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5821/
Fix time unit related properties

Fixes a number of bugs and omissions in time unit properties.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Albert Rossi <arossi@fnal.gov>
Patch: http://rb.dcache.org/r/5765/
Removed scoped db.* properties.

Replaces all db.* properties with equivalent
<service>.db.* properties. The old db.* properties
are marked forbidden.

Scripts are updated to use the new names.

Target: trunk
Require-book: yes
Require-notes: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5822/
Remove scoped port configuration properties

Marks port forbidden.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5823/
poolmanager: Minor update to performance cost calculation

The patch modifies how the performance cost of a pool is calculated. First
of all, remember that the performance cost is nowadays only used in *read*
pool selection for wass partitions, thus read pool selection is the only
aspect that is influenced by this change.

The motivation for touching the read pool selection is the rewrite of the
HSM integration on pools. The new code pushes the lowest level queueing
into the HSM integration driver. This has several consequences: First of
all, there is no guarantee that a particular driver has a queue at all.
Second, even if a driver has a queue internally, this would be a queue
per HSM, not a shared queue like it is in the current pool.

Moreover, the current use of HSM queues in the cost calculation does not
reflect actual load. First, file flush goes through several queuing
layers, with a per storage-class queue in a flush controller, followed
by a periodic flush into a shared HSM store queue. It is only the latter
queue that is accounted for in the cost calculation - the per storage
class queue is ignored. Second, the concept of active, queued and max
for the store and fetch queues does not make sense as a base for cost
calculation: The actual load on a pool is determined by the number of
tape drives in use and thus the number of data streams. How many
callouts to the HSM script we made does not reflect how busy neither
the network nor the disks are. The point being that the current
performance cost calculation is not exactly optimal.

The current patch aims at not using the max active value of the flush and
restore queues in cost calculation. This is simply because such a value
does not exist in the rewritten HSM system. Active and queued values still
make sense as any tape operation goes through a queued and active phase,
which can easily be counted and reported to pool manager. It doesn't matter
whether the HSM integration driver actually got a queue - each request still
got these phases.

Recall that performance cost was computed as an average of a fill factor for
each queue, i.e. the average of (active + queued) / max. For the flush and
restore queues, this is changed to contribute 1.0 to the average if there
are any queued requsts (intuitive interpretation is that the queue has
reached its capacity), and 1 - 0,75^active otherwise. Ie the contribution
grows from 0 and approaches 1 as the number of active flushes/restores
grows. Thus the maximum is no longer part of the calculation (as was the
intent with this patch).

The patch changes one other aspect of the cost calculation: Previously a
queue with max being 0 did not contribute to the average at all - it was
as if the queue did not exist. Hence suspending a queue by setting the
max to zero would significantly alter the cost. It also makes cost computed
from pools that may have a non-zero queue defined incomparable to a pool
that has a limit larger than zero: In other words, the cost of eg an FTP
transfer depends on whether the max on some other queue happens to be 0
or 1, even if that other queue is otherwise empty. This patch changes the
logic such that queues with max being zero contribute with 0.0 if the queue
is empty, and 1.0 otherwise.

Note that this patch does alter the value of the computed performance cost.
Since this value is used as a trigger for pool to pool replication on
load, and also as a fallback trigger for selecting other pool manager
links, this patch may mean that cost-cuts in pool manager will have to
be adjusted. This is however a perfect time for such a change, as dCache
2.7 forces a migration to WASS anyway and tuning parameters will have to
be revisited anyway. I also doubt that many sites have the cost-cuts
so finely tuned, that this patch makes much of a difference.

Target: trunk
Require-book: yes
Require-notes: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Karsten Schwank <karsten.schwank@desy.de>
Patch: http://rb.dcache.org/r/5790/
Remove remaining scoped properties.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5824/
Remove support for scoped properties

This patch removes all support for scoped properties.

Target: trunk
Require-book: yes
Require-notes: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5825/
skel: fix regression in billing properties affecting dcache database commands

The elimination of scoping and db.* properties did not take into account the ability to run the billing cell without a database.  The properties before this change relied on setting db.name and db.schema.changeset conditionally, based on the value of billing.enable.db, so that the dcache database commands would work correctly.

Specifically, when billing db is disabled, dcache database ls should not report the presence of the billing database, and more importantly, dcache database update should not attempt to run the liquibase changesets (since there may be no billing database present at all).

This patch restores the correct behavior.

Testing done:

Before the patch, with billing.enable.db=false,

dcache database ls was still reporting the presence of the database
dcache database update would fail if there is no billing database in the postgres installation (which is quite possible).

After the patch, correct behavior is observed for these commands.

Target: master
Require-notes: yes
Require-book: no
Acked-by: Paul

RELEASE NOTES:

If overriding the database name for billing, be aware that billing.enable.db will not affect the dcache database commands; in particular, update will still attempt to run liquibase.
Thus any non-default setting for this property will require the actual presence of a database by that name.
skel: fix regression in alarms properties affecting dcache database commands

The elimination of scoping and db.* properties did not take into account the ability to run turn the alarm service off or to use xml.

Specifically, when alarms.db.type is not 'rdbms' dcache database ls should not report the presence of the alarm database, and more importantly, dcache database update should not attempt to run the liquibase changesets (since there may be no rdbms alarm database present at all).

This patch restores the correct behavior.

Testing done:

checked the database commands for correct behavior with alarms.db.type set to off, xml and rdbms.

Target: master
Require-notes: yes
Require-book: no
Acked-by: Paul

RELEASE NOTES:

If overriding the database name for alarms, be aware that alarms.db.type will not affect the dcache database commands; in particular, update will still attempt to run liquibase.  Thus any non-default setting for this property will require the actual presence of a database by that name.  Renaming is only relevant in the 'rdbms' case.
skel: add back datanucleus enhancer plugin dependency

Current master build breaks because plugin tries to add in 3.2.6 core for DataNucleus.

This is a known issue with the DataNucleus maven setup.

See http://stackoverflow.com/questions/877949/conflicting-versions-of-datanucleus-enhancer-in-a-maven-google-app-engine-project

Several different solutions are proposed there.

We may need to revisit this issue eventually.

Testing done:

After patch, build works.

Target: master
Require-notes: no
Require-book: no
Acked-by: Paul
Optimize configuration parser and shell oracle

The patch optimizes the representation of property annotations
by avoiding to parse the annotation several times. Instead the
AnnotatedKey instance is stored.

A further optimization is to store annotated keys in a
separate map, thus reducing the size of the hash table containing
the properties themselves, and also avoiding the need to filter
property keys. It also avoid the additional string concatenation
and hash computation to produce a special key for annotated keys.

Yet another optimization is to let getAnnotatedKey return null if
no annotation is found. The creation of an "empty" AnnotatedKey
is expensive as the regular expressions are still applied in the
constructor.

Finally, the shell oracle printer is updated to no longer output
deprecated properties. Such properties should not be reference
by any of our shell scripts. Not output deprecated properties both
speed up the printer itself, but more importantly it speeds up
calls to the getProperty shell function (because it is smaller).

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5829/
Optimize placeholder parsing and replacement

The patch applies several optimizations to the Formats#replaceKeywords
algorithm:

- Copy input to char[] to avoid repeated range checks in String#charAt

- Use ArrayDeque rather than synchronized Stack

- Write to existing StringBuilder rather than returning String, thus
  avoiding unnecessary copying of the output

- Only read the input once - the old algorithm used several passes
  to process nested placeholders

- Don't use an explicit state machine - use Java's control flow
  statements instead

- Specify a length when creating StringBuilders - for the common case
  of placeholder less values, this avoid resizing StringBuilders

- Reduce use of StringBuilder#append(char) and instead append a
  range of the input array. This reduces the number of capacity checks
  the StringBuilder has to do.

I had to adjust several unit tests. To me those tests looked like
encoding perculiarities of the old parser rather than intended behaviour.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5833/
Optimize quote functions in ShellOracleLayoutPrinter

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/5834/