CA-146595: Improve parsing of VM platform flags

We need to be able to use 0 and 1 in (at least) the case of the acpi key.
Before this patch, using 0 and 1 would have both been converted to true when
passed to Xenopsd and therefore wrong arguments could be passed to Qemu when
trying to disable this feature.

This patch makes the 'bool' function a little more lenient on its input rather
than using OCaml's stock bool_of_string. It also introduces a warning message
if the value has been specified incorrectly.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #1947 from simonjbeaumont/ca-146595

CA-146595: Improve parsing of VM platform flags
CA-146736: Fix event registration after pool_migrate_complete

After running pool_migrate_complete, make sure the xapi events thread
re-registers so as to watch events for the newly-arrived VM.

Signed-off-by: John Else <john.else@citrix.com>
Merge pull request #1953 from johnelse/ca-146736

CA-146736: Fix event registration after pool_migrate_complete
Location of sparse_dd has changed

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Merge pull request #1958 from jonludlam/sparse_dd_location

Location of sparse_dd has changed
CA-147161: Discard messages after logging to remote host

Make rsyslog discard messages after they have been logged locally and
sent to a remote host to prevent the default rules from picking them up.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
CA-146698: xe vm-retrieve-wlb-recommendations does not print WLB ZeroScoreReason

xe vm-retrieve-wlb-recommendations vm=VMNAME output does not contains ZeroScoreReason field

```
Host(Uuid)                                    : Stars, RecID, ZeroScoreReason
dt57(12f83bfe-7024-4491-8217-98b20afa8433): WLB 4.2414529914529915 472
dt63(c6453ae0-5802-4fee-a75d-b047ebab2c73): WLB 0 471
```

The excepted output result is:

```
Host(Uuid)                                    : Stars, RecID, ZeroScoreReason
dt57(12f83bfe-7024-4491-8217-98b20afa8433): WLB 4.2414529914529915 472 None
dt63(c6453ae0-5802-4fee-a75d-b047ebab2c73): WLB 0 471 Cpu
```

Signed-off-by: Phus Lu <phus.lu@citrix.com>
Merge pull request #1961 from phusl/master-CA-146698

CA-146698: xe vm-retrieve-wlb-recommendations does not print WLB ZeroScoreReason
CA-145689: Adding a message for license server obsolete

Signed-off-by: philippe gabriel <philippe.gabriel@citrix.com>
xe host-apply-edition: avoid race in error reporting

When host.apply_edition raises a license_checkout_error exception, we look at
the recent alerts (messages) to find out the reason for the failure. We seem to
currently miss such an alert every now and then, possibly due to rounding
errors in the used timestamp.  Make this less likely by subtracting a second.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
xe host-apply-edition: cleanup alert after processing

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-145689: xe host-apply-edition: take into account new v6_license_server_version_obsolete alert

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

CA-145689 licensing updates
Revert "CA-146698: xe vm-retrieve-wlb-recommendations does not print WLB ZeroScoreReason"

This reverts commit c755704904bef791baa621b9c5bfb0f77312a76b.
CA-147800: VMStart/TC8561: Guest did not start/resume where expected.
CA-146698(https://github.com/xapi-project/xen-api/pull/1961) is not a
complete fix, xapi_vm_helpers.ml#695 pattern matching also should be
changed. Some XenRT case was broken, so revert its code changes.

Signed-off-by: Phus Lu <phus.lu@citrix.com>
Merge pull request #1974 from phusl/CA-147800-master

Revert "CA-146698: xe vm-retrieve-wlb-recommendations does not print WLB ZeroScoreReason"
CA-139501 VM hard_shutdown & hard_reboot must wait for nothing else.

We were already allowing hard_reboot concurrent with a clean_reboot
already in progress, and the same for hard/clean shutdown, but
clean_(shutdown|reboot) would block hard_(reboot|shutdown).

Now the is_allowed_concurrently function allows hard_shutdown
concurrent with anything except itself, and allows hard_reboot
concurrent with anything but itself or hard_shutdown.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
(cherry picked from commit a9816b9b549fad1e8e4169c69bbad5e9f2f3ab8e)
Whitespace: fix horrible spaces-then-tab-then-spaces indentation.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
(cherry picked from commit 62393a77fa00cdc1bc798c9bc57fe73fa6413647)
Merge pull request #1959 from rosslagerwall/rsyslog-fix

CA-147161: Discard messages after logging to remote host
CA-148772: support consoles served over Unix domain sockets

Xenopsd with libxl + upstream qemu prefers to bind consoles to
named sockets like

  /var/run/non-persistent/xenospd/consoles/VM/<uuid>

rather than anonymous localhost port numbers. Naming consoles is
a good idea because it prevents accidentally connecting to the
wrong port number.

This patch allows Xapi to connect to these Unix domain socket
consoles. Note there is still a lingering problem with upstream
qemu and XenCenter's built-in RFB client which causes the
keyboard not to work.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>