CA-106080: DB upgrade rules update license_params.sku_type

The previous upgrade rules for the DB only modified license_params.edition
(advanced,enterprise,platinum -> per-socket, enterprise-xd -> xendesktop). We
also need to modify sku_type, because v6d will return current_edition =
previous sku_type on the case of an expired license. This is an edge case for
when a license expires just prior to a host upgrade, with no valid licenses on
the license server after upgrade.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-106080: Guard List.assoc "sku_type" license_params with mem_assoc

From code review on pull request #1226: since sku_type is a key that's returned
from v6d, and not present natively in xapi, we need to test that sku_type is
present before calling assoc on license_params.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-107400: Make deletion of VmExtra in xenops VM.remove best-effort

Signed-off-by: John Else <john.else@citrix.com>
CA-105002: Robustify against domains that are unkillable

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-105003: Handle exceptions in get_shadow_allocation.

This fails when the VM has no VCPUs, which has been observed in
the wild. Also contains a workaround for CA-104562 by preventing
bizarrely large values being set.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Merge pull request #1225 from mcclurmc/ca106080-upgrade-enterprise-xd

CLEARWATER CA-106080: DB upgrade rules update license_params.sku_type
Merge pull request #1264 from mcclurmc/ca105002-clearwater-minion

CA-105002: Robustify against domains that are unkillable
Merge pull request #1265 from mcclurmc/minion-ca-105003

CA-105003: Handle exceptions in get_shadow_allocation.
Merge pull request #1259 from johnelse/ca-107400-clearwater

CLEARWATER: CA-107400: Make deletion of VmExtra in xenops VM.remove best-effort
Clean up the snapshot VDI if SXM fails

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Merge pull request #1267 from mcclurmc/minion-ca-87689

Clean up the snapshot VDI if SXM fails
CP-4148:Change the default behaviour for emulated monitor to "null"

Signed-off-by: Akshay Ramani <akshay.ramani@citrix.com>
Merge pull request #1269 from johnelse/cp-4148-clearwater

CP-4148:Change the default behaviour for emulated monitor to "null"
CA-106868: Datasource-list latency units are microseconds, not milliseconds
Signed-off-by: Akshay Ramani <akshay.ramani@citrix.com>
Merge pull request #1271 from akshayramani/CA-106868-cw

CLEARWATER: CA-106868: Datasource-list latency units are microseconds, not milliseco...
[WHITESPACE] Periodic scheduler loop

$ git diff -w 3ddb861e63d4ffaa9ac0818f11fb027e3204208c^..3ddb861e63d4ffaa9ac0818f11fb027e3204208c
CA-107115: Xapi_period_scheduler: fall back to Thread.delay if Delay.wait fails

This ensures that the periodic scheduler does not spin and fill up the logs when
Delay.wait fails for some reason. A reason for failing is due to xapi hitting its
limit of open file descriptors.

If Delay.wait fails, we fall back to Thread.delay, which is less likely to fail.
If even this fails, we break out of the scheduler loop, logging an alarming error
message.

The difference between Delay.wait and Thread.delay is that Delay.wait can be
interrupted by a signal, and Thread.delay cannot. Such a signal is used when adding
a new item to the scheduler queue that expires before the current one.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-107700 - Default to turning USB emulation on in xenopsd

xapi already defaults to turning this on, but during rolling-pool
upgrade the platform data gets passed directly from the sending to the
receiving xenopsd without xapi adding its usual defaults.

Therefore xenopsd also needs to default to turning this on, to match
previous releases.

Signed-off-by: John Else <john.else@citrix.com>
Merge pull request #1273 from robhoes/ca107115-cw

CLEARWATER: CA-107115: Xapi_period_scheduler: fall back to Thread.delay if Delay.wait fails
Merge pull request #1276 from johnelse/ca-107700-clearwater

CLEARWATER: CA-107700 - Default to turning USB emulation on in xenopsd