CA-105903: vbd-unplug --force works regardless of surprise-remove state

This is just acknowledging the changes that were introduced in Tampa, and not a
change in behaviour since Tampa.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-107107: enable backtraces in xenopsd

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-98606: Reduce impact of duplicated base_mirror key

There's a rather fundamental race in the SMAPIv1 backends with
the storage motion code. Fortunately the race only really affects
a cosmetic issue - whether VDIs temporarily show up in the GUI
while storage motion is going on. The bug exhibits as the
VDI of the VM containing a 'base_mirror' key in the sm_config
field.

Unfortunately this problem becomes worse when a subsequent SXM
operation is attempted - at this point the operation will fail
as we try to put a new base_mirror key in, getting a Duplicate_key
error.

This changeset fixes this such that we simply overwrite the
existing key. This doesn't change the cosmetic problem that the
VDIs will be missing from the GUI, but it does mean you can now
migrate the VM again.

Additionally this changeset fixes more minor problems:

- on cancelling an SXM operation the base_mirror key was left
- the existence of more than one blob on a VM caused the migration
  to fail
- the blobs couldn't be sent anyway due to missing the content-length
  header in the HTTP PUT operation.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-92842: revert change of timeout when squeezing domains

Introduced probably accidentally in c/s c533d1ec

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-110973: Use more efficient db backup when on the pool master

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Fix bash_completion for "xe host-cpu-info".
CA-99828 Add a new bond option: lacp-fallback-ab to xcp-networkd

lacp-fallback-ab allows lacp bond to fallback to active-backup
when there is no lacp partner.

Signed-off-by: Ravi Kondamuru <Ravi.Kondamuru@citrix.com>
Acked-by: Rob Hoes <rob.hoes@citrix.com>
CA-99828 Add a new bond option: lacp-fallback-ab to xapi

lacp-fallback-ab allows lacp bond to fallback to active-backup
when there is no lacp partner.

Signed-off-by: Ravi Kondamuru <Ravi.Kondamuru@citrix.com>
Acked-by: Rob Hoes <rob.hoes@citrix.com>
CP-4056: Update where rrdd looks in sysfs for VBDs

With the move to Linux 3.x kernel the paths that were:

    /sys/device/xen-backend/vbd-xx-xxxxx/...

have now moved up one directory to

    /sys/device/vbd-xx-xxxxx/...

Imported from xcp-rrdd.git b3c9de58bea50bd0ef94bf8ca5ba39ca99211200

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Imported-by: John Else <john.else@citrix.com>
Read write-related stats from correct file

The metrics wr_reqs, wr_avg_usecs and wr_max_usecs were being read from
the rd_usecs file and not the wr_usecs file.

Imported from xcp-rrdd.git b77f3f5352a71f16a3d7cc031b41e4325e1fe302

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Imported-by: John Else <john.else@citrix.com>
CA-128803: do not take timeoffset from last boot record

This is specially for upgrades from pre-xenopsd XenServers.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
SCTX-1649: Set SO_KEEPALIVE on server sockets

This ensures that a TCP connection is cleaned up on the server, when
the connection is closed on the client without the server knowing (for
example, if a FIN packet is not sent or went missing).

This does not affect idle connections, or long-running
XenAPI calls.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Merge pull request #1698 from robhoes/lacpfb64

Add LACP fallback option
Merge pull request #1700 from johnelse/cp-4056-xs64bit

Update where rrdd looks in sysfs for VBDs
Merge pull request #1699 from robhoes/timeoffset64

CA-128803/SCTX-1664: do not take timeoffset from last boot record
Merge pull request #1701 from robhoes/keepalive64

SCTX-1649: Set SO_KEEPALIVE on server sockets
Merge pull request #1696 from johnelse/trunk-major-defect-backports-1

First wave of major defect fixes backported from trunk
CA-129089: Disable global login via slave hosts

Signed-off-by: Zheng Li <dev@zheng.li>
Merge pull request #1704 from ravippandey/sctx-1727

CA-129089: Disable global login via slave hosts
Report out-of-space, not patch-invalid

If there isn't enough space on the filesystem to upload a patch (which can take
2-3 times the size of the patch, because of multiple copies and gpg signature
checking), we should fail with an Out_of_space exception. Before, if the gpg
check failed because there wasn't enough space to write the unsigned cleartext,
we would erroneously report patch_invalid. Now we check that there is enough
free space to signature check the patch (we make a guess of 2 * size of the
patch), and catch Unix.ENOSPC exceptions and handle them accordingly.

CA-124008

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>