Merge remote-tracking branch 'origin/branch-181' into branch-18

* origin/branch-181:
  Explicit LD_LIBRARY_PATH for relocatability [backport]

Change-Id: Ie47a0f2f0d56bee0c371261de1d37c73c1e172d1
bp: MB-4220 Wait for all nodes on bucket deletion.

Currently bucket creation and deletion operations are asynchronous
which causes races under certain conditions. This commit makes bucket
deletion synchronous. To make bucket creation synchronous one must
wait until janitor run is completed which requires major rework of
ns_orchestrator. So now this is put off.

Change-Id: I0b4b543d7f05fd0816848195c5d945f4ec25aca5
Orig-Reviewed-on: http://review.couchbase.org/9193
Reviewed-on: http://review.couchbase.org/13271
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: Restart moxi on bucket deletion.

This is needed since moxi keeps a pool of downstream connections. Some
of these connection become invalid when bucket is deleted. Thus error
will be reported to the client in case such stale connection is reused.

Change-Id: I1a2ab07938b6ab38a4b85bf7d530572cf8eb7807
Orig-Reviewed-on: http://review.couchbase.org/9194
Reviewed-on: http://review.couchbase.org/13272
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: Removed unused module

Change-Id: I4fcd2f02badcb3c69becb1525264afe466caca59
Orig-Reviewed-on: http://review.couchbase.org/7753
Reviewed-on: http://review.couchbase.org/13273
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp:leave cluster once when we detect that we were ejected.MB-4310

Change-Id: I3cac959b3087f83227453ad6001ae5894bf9f799
Orig-Reviewed-on: http://review.couchbase.org/9887
Reviewed-on: http://review.couchbase.org/13274
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: send moxi restart call to live nodes after bucket deletion

Not all nodes

Change-Id: I4c0f69e8f17f20f21b154366740f1def0dcf627a
Orig-Reviewed-on: http://review.couchbase.org/13012
Reviewed-on: http://review.couchbase.org/13275
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: clarified return value of ns_bucket:delete_bucket/1

Change-Id: Ib537eb7362544e1dc2280740abba4955f09b6822
Orig-Reviewed-on: http://review.couchbase.org/13013
Reviewed-on: http://review.couchbase.org/13276
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: added typespec and description for ns_orchestrator:delete_bucket

Change-Id: I0a2b3d33ec8209ea793c81e832462452b57d6307
Orig-Reviewed-on: http://review.couchbase.org/13014
Reviewed-on: http://review.couchbase.org/13277
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: handle rebalance_running return from bucket deletion call

case error seen in MB-4760. But not real cause of MB-4760's problems.

Change-Id: Ic62f320eaebc303ce88cacfd1f0b64cc9b3cc051
Orig-Reviewed-on: http://review.couchbase.org/13015
Reviewed-on: http://review.couchbase.org/13278
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: return 503 when trying to create bucket during rebalance

Because it's a temporary condition thus 400 is not appropriate.

Change-Id: Ib37adee1353c4c2837a0e6dee93728c7102af9e7
Orig-Reviewed-on: http://review.couchbase.org/13016
Reviewed-on: http://review.couchbase.org/13279
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: made menelaus_rest stop using deprecated http module

As warned by compiler

Change-Id: I4590e58bed0c60848d95110913aab67d52c40947
Orig-Reviewed-on: http://review.couchbase.org/10406
Reviewed-on: http://review.couchbase.org/13280
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
bp: pass number of vbuckets to ep-engine. MB-4558

Change-Id: I36f0e955048afac56386c85fd72b41a8420b3002
Orig-Reviewed-on: http://review.couchbase.org/11803
Reviewed-on: http://review.couchbase.org/13281
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
fixed real width of io error notice

So that you can still click about and logout even if io error notice
is visible.

Previously width 100% caused invisible part of
.io-error-notice-wrapper element to overlay what was behind
it. Breaking links clicks particularly.

Change-Id: I0602930b35ed83ea16e1992d6e745a543c1e422a
Reviewed-on: http://review.couchbase.org/13282
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
bp: introduced BUG

Change-Id: Ifea9204bdbc0acfb811ba0c16ef6485c78c8736a
Orig-Reviewed-on: http://review.couchbase.org/8267
Reviewed-on: http://review.couchbase.org/13287
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
killed unused runFormDialog

Change-Id: Iffce5e02ebfbbddeb0bbec320ee4b60b08254e00
Reviewed-on: http://review.couchbase.org/13288
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
improved postWithValidationErrors error handling

Particularly first argument is now always list of text messages. And
for bucket's case that does hash with per-field errors we now have
extra argument for that. So there are no more confusion about error
formats.

Change-Id: I59a7131747ff06abd939d798daaa0a0c02f6c105
Reviewed-on: http://review.couchbase.org/13289
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
handle xhr errors from bucket deletion

So that we can report back that bucket deletion is not permitted
during rebalance.

Change-Id: Ib5114b8804c8e131526b9dc5e1e0e1e5e937e42e
Reviewed-on: http://review.couchbase.org/13290
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
fixed one bad usage of postWithValidationErrors and renamed it

So that we cannot accidently screw things up when merging stuff 1.8 ->
master.

Change-Id: I37b2c7e2a63d81e394bbfee45fde2b20ae1ef9b7
Reviewed-on: http://review.couchbase.org/13321
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] MB-4165 Better usability for mbbrowse_logs_cluster

Change-Id: I8d70badaef70587bd6ec165656afdafc04e875f1
Reviewed-on: http://review.couchbase.org/13458
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
[bp] Allow calling ?log_{info,warning,error} with only one argument.

Change-Id: I5fa7a2ec6a02c4f3dd255d24d23149868cbccb05
Reviewed-on: http://review.couchbase.org/13457
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>