CA-96886: Fix race for a PCI device by multiple starting VMs

When multiple simultaneously starting VMs try to grab the same PCI device, only one of them
may get it, and the others must fail to start. However, xapi considers a PCI device "assigned"
to a VM only when the VM has started and the device has been made available to the VM, which
is some time after xapi has asked xenopsd to start the VM and give it the PCI device. This means
that there is a window during which multiple VM may be given the same device.

This patch attempts to resolve this by temporarily reserving a PCI device for a VM in xapi, before telling xenopsd to start the VM.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-94335: Dom0 should be managed in xenopsd before the record is created.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
CP-4320: Remove host-license-add from the CLI

Signed-off-by: John Else <john.else@citrix.com>
CP-4320: Update API lifecycle for Host.license_apply

Signed-off-by: John Else <john.else@citrix.com>
CP-4320: Remove implementation of Host.license_apply

Raise MESSAGE_REMOVED instead.

Signed-off-by: John Else <john.else@citrix.com>
CA-74222 : Allow the Bond.create to carry on even if the MTU size is invalid , however log the error.

Signed-off-by: Akshay Ramani <akshay.ramani@citrix.com>
Merge pull request #994 from robhoes/ca96886

CA-96886: Fix race for a PCI device by multiple starting VMs
Make sure that stunnel listens on the right addresses

This may be "all IP addresses" or only localhost, and IPv4 or IPv6.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Merge pull request #1049 from akshayramani/CA-74222

CA-74222:All the Bond.create to carry on without failing when created with an unsupported MTU value, however log the error
Merge pull request #1039 from johnelse/cp-4102

CP-4320: Remove Host.license_apply
Simplify management interface management

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
XOP-261: Make the himn_address persistent across reboot.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
XOP-261: Restart stunnel only if conf file changed.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
Open the log file as append rather than write. This saves truncating it in the case of a localhost migrate, loosing the save half of the log.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Remove use of syslog from the C bindings, replacing them with writes to stdout and stderr. The parent of the xenguest fork is already capturing stdout and stderr from libxc, and will pass them on to syslog. This way, the syslog()'d messages will also find their way into xenguest.$DOMID.log.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Implement the save/restore framework for propagaing the Windows Generation ID.

Xenguest being linked directly agianst libxc, the changes are confined to
suitable #ifdefs to allow compilation against multiple versions of Xen.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Don't call VM.stat every time we receive a xapi event on a VM.

VM.stat is expensive as it does lots of xenstore reads - just check that
the VM exists in xenopsd's database instead.

Signed-off-by: John Else <john.else@citrix.com>
Dump xenopsd updates every time we push an update.

Signed-off-by: John Else <john.else@citrix.com>
Sort events properly.

Signed-off-by: John Else <john.else@citrix.com>
CA-87377: Snapshot updates state in inject_barrier

Xapi then receives updates including barrier information from the
updates.get API call. Xapi processes the barriers first, as these
have threads waiting on them.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>