master: Remove syslog messages about trivial label changes

This commit modifies the master server not to print information like
this:

  chunkserver (ip: 192.168.88.39, port 9422) changed its label from '_' to '_'

in syslog. The message will only be printed if the label has really
changed.

Change-Id: I38c759fcf5bfb29804a76e28feb49a0509ac9494
master: Modify chunks' replication algorithm to respect labels

This commit modifies the chunk loop in the master server to properly
handle labels when replicating missing copies and removing superfluous
copies. This enables almost a full support for custom goals in master
server - it will maintain the requested number of copies and will
properly handle changes in goal definitions or changes in files' goals.
The only thing that still might not work as expected is rebalancing of
chunks from servers with high disk usage to servers with low disk usage.

Change-Id: I1443f861358818e17beeb90fa4ea367ad57e5430
tests: Add test of migrating between labels

This commit adds a test which checks if moving chunks between chunkservers with
different labels works correctly.

Change-Id: I5278dee95b6e55d6fe0d9dcc7c3a191449052ee0
tests: Add tests of chunk replication with custom goals

This commit adds tests which verify if missing chunks are properly
replicated and migrated between chunkservers when using custom goals.

This commit also renames other tests of custom goals make make their
names similar to new tests added by this commit.

Change-Id: Ic0b4c6b6bc64c8befa874c273fc310a3071f1bab
mount: Fix handling I/O limiting errors

This commit adds a missing message in oplog when I/O limiting error
occurs and fixes the error code returned by read/write calls (status
wasn't properly translated into an error number).

Change-Id: I2681acff8496c1c26b7e41a8b77476ea46d5b12e
master: Fix handling CLTOMA_CSSERV_REMOVESERV packets

Due to a bug in the master server's code removing servers from the list
in the CGI interface didn't work (and could even result in segmenattion
fault). This commit fixes the issue and also fixes descriptions of
CLTOMA_CSSERV_REMOVESERV and MATOCL_CSSERV_REMOVESERV network messages
in the MFSCommunication.h file.

Change-Id: I6cd8bddf7a2b091797437d77ccf601940ddea2d6
chunkserver: Fix error handling when refreshing disk usage

This commit fixes a bug which causes chunkservers to report random
numbers as disk size and disk usage to the master server when statvfs()
call fails.

Change-Id: Ieec04364026bd893a5982fbd5f8526874c91f435
probe: Fix handling disconnected chunkservers

This commit fixes two commands: list-chunkservers and list-disks. If
a chunkserver disconnects, it is still present in the master server's
database. Such a server is reported in MATOCL_CSERV_LIST as a server
with a version equal to 256.0.0, with 0 chunks, 0 space, 0 errors, etc.
This commit fixes:
* the list-disks tool not to try to connect with disconnected servers to
  get a list of disks from them;
* the list-chunkservers command not to print this magic version string
  ("-" is printed instead) or zeros in other columns in the
  human-readable mode ("-" is printed instead)

This breaks a bit the compatibility of the --porcelain format, but
hopefully it's not too late to do this.

Change-Id: I315d0b0a77a04c23f396eedcff1591237c7248ff
master: Implement rebalancing of chunks which respects labels

This commit implements a new algorithm of chunk rebalancing which works
fine when custom goals are used. The new semantics of the
ACCEPTABLE_DIFFERENCE entry in the master server's configuration file is
as follows: we allow moving chunks between chunkservers to make chunk
distribution more even only if the source server has disk usage greater
then the destination server at least by ACCEPTABLE_DIFFERENCE (and, of
course, restrictions set by the goal are still met).

A new configuration option is introduced: if
CHUNKS_REBALANCING_BETWEEN_LABELS is set to 0 (which is the default), no
chunks will be moved between servers with different labels.

Change-Id: I8288b48294ad15c7c51aaae296a2e34aa865b192
master: Fix bugs in handling chunk overgoal

First bug: we removed copies from chunkservers with not biggest
usage if deletion limit was exceeded on chunkserver with biggest usage.

Second bug: we removed too many copies for label if we had overgoal
on given label and even greater wildcard overgoal.

Change-Id: I267801dacee378b0cc82ac5503bee5fb619f2b6f
tests: Add tests for chunk rebalancing which use custom goals

This commit adds some test which verify if chunk rebalancing works
properly on installation which use custom goals and labels for
chunkservers.

Change-Id: I4f303721cd4f1cc4fe89fff128d1e8a4a9d3379a
tests: Add a test of chunk rebalancing which uses custom goals

This commit adds one more test of chunk rebalancing. It tests a scenario
with two different custom goals which force uneven distribution of
chunks between servers with different labels.

Change-Id: I2cca4d17ff246ed841395241ff6fa0bf9fea9d7c
master: Refactor code choosing servers for new chunks

This commit extracts an algorithm which is responsible for choosing
servers for new chunks to a separate class to make it testable by unit
tests. It also adds some simple tests of this class. This refactoring
will be needed when implementing an algorithm which tries to maintain
servers balanced.

Change-Id: I86a526059409c34a8907e0177517d79e1b19983f
master: Reimplement algorithm choosing servers for new chunks

Unlike the old algorithm, the new one distributes chunks among servers
proportionally to their total size for all types of goals.

Change-Id: I121a581b6cddcb1f9233fe781c81202315455c49
master: Implement a fair chunk creation algorithm

This commit modifies chunk creation algorithm to choose servers for new
chunks as fair as possible (i.e. to maintain number of newly created
chunks very close to the server's weight, understood as the server's
capacity divided by capacity of all the servers).

Change-Id: I61533fbb4cd63460b406fd05b7dd91f5b0953da0
tests: Add test_custom_goals_generate_no_accidental_rebalancing

This commit adds a test which verifies if the is no chunk rebalancing if
we create a lot of files and don't add of remove any servers.

Change-Id: I980ec57a3376a3d9a229e1360d400a756aa6552b
tests: Add unit tests which verify distribution of new chunks

This commit adds a unit test which verifies if new chunks are placed on
servers with respect to their weights.

Change-Id: I0886b1410e0aa474c04add6dc24a79de85ef68a8