CA-80758: On SR.destroy, destroy PBD and VDI records before destroying the SR record.

Otherwise the SR.destroy task will be racing with the GC, which may
sneak in and destroy the PBDs and VDIs itself.

Signed-off-by: John Else <john.else@citrix.com>
CA-79538: Disallow setting number of VCPUs to zero

* Rename the Maximum_vcpus exception to Invalid_vcpus to better reflect meaning

* Extend the fail_max_vcpus_task unit test to fail_invalid_vcpus_task
  NOTE: The test was failing before this change and is still failing
CA-81375: xe-edit-bootloader uses kpartx

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-79059: Allow SR.destroy if all VDIs left in an SR are unmanaged.

Signed-off-by: John Else <john.else@citrix.com>
CA-81599: Add tsc_mode to the list of allowed platform flags.

Signed-off-by: John Else <john.else@citrix.com>
CA-81599: Filter out invalid TSC modes from platform dictionary.

Signed-off-by: John Else <john.else@citrix.com>
CA-81599: Set tsc_mode before creating domain.

Signed-off-by: John Else <john.else@citrix.com>
CA-80421: when adding an item to a queue, don't forget to signal

This could cause a temporary glitch where a thread blocked in pop()
wouldn't wake up as early as it should.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-80421: serialise calls to Redirector.pop

The pop function:
1. removes an item from the default queue
2. inserts an 'override' queue to prevent other worker threads
   pop'ing items behind the one we just got, which would lead
   to parallel actions on the same VM

We must prevent two threads from executing (1) before either of
them executes (2)

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-78639:  Refresh all physical PIFs when xapi starts

This ensures in particular that all ovs bridges have their
external-ids updated after a pool join. This used to be done by
the openvswitch-cfg-update plugin by an "interface-reconfigure
rewrite" call.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Update Host.name_label if it is localhost.localdomain

The Host.name_label field is set to be the hostname when xapi
first starts and the Host record is created. If the hostname has
not yet been set at that point, for example due to a slow DHCP
response, you may end up with a "localhost.localdomain" name_label.
This became more likely since the init script of the network daemon
no longer waits for the DHCP reply.

This patch changes the Host.name_label of a host when the hostname
changes, and the name_label currently is "localhost.localdomain".

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
scripts: use DEVPATH in block-frontend

Newer kernels don't set PHYSDEVPATH for add/remove device uevents.
Note that this requires a kernel with CONFIG_SYSFS_DEPRECATED disabled
or DEVPATH won't contain the type and ID in the path.

Signed-off-by: Simon Rowe <simon.rowe@eu.citrix.com>
scripts: disable blkback shutdown handshaking

The blkback driver in 3.x kernels does not support shutdown
handshaking.  It's not needed (tapdisk does the right think anyway) so
disable it.

Signed-off-by: Simon Rowe <simon.rowe@eu.citrix.com>
Simplify filter function.

Signed-off-by: John Else <john.else@citrix.com>
Merge commit '61d5c2317d4a051c3430cb3217025270215b787d'
Merge commit '659ed37279bd558be7106e49d5cb14a4868268e8'
Merge commit 'c13b4a5cceb0b4d4ff8fe0c0de72c4fe5bec0aa3'
Merge commit '5318a3eef39c39e39a31132cfa61488cc26842e6'
Merge commit '3b7577b438310bf75c5e620e68a1dc76e533fa5e'
Merge commit 'a8bd0f84284c31bddca8d4b554ccd4a4072d624f'