CA-99728: Spelling errors.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@citrix.com>
CA-98936: Stop xapi from creating files in /tmp every time it gets an update from xenopsd

Signed-off-by: John Else <john.else@citrix.com>
CA-96893: Remove metadata from xenopsd after a suspend.

Previously metadata was only removed after a shutdown.

Signed-off-by: John Else <john.else@citrix.com>
CA-96893: VM.remove now also removes the VmExtra persistent data.

Signed-off-by: John Else <john.else@citrix.com>
CA-98535: Fix VDI.create

The other_config, shareable, tags and xenstore_data fields are now set
to their correct values when creating a VDI.

Signed-off-by: John Else <john.else@citrix.com>
CA-92553: Thoroughly clear PCI attachments for stopped VMs

This should not be necessary if many-to-many relations in the DB
work properly. People have reported issues that may indicate that this is
not the case, but we have not yet found the root cause. Therefore, this
code is added "just to be sure".

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-96950: Fix HIMN bridge name if needed

Previously, the bridge name used for the Host Internal Management Network
(HIMN) was usually xapi0, i.e. a normal name in the xapi* range. Now, the HIMN
has a special bridge name ("xenapi").

This commit ensures that the new name is used on existing HIMNs.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-96541/SCTX-1188: Fix race condition when creating metrics for VLAN PIFs

This fixes a race condition between the thread that copies bonds and VLANs from
the master when a new slave joins the pool, and the thread that creates/updates
the PIF_metrics (the "monitor thread"). Or in fact a race between anything that
creates a bond and very soon after that a VLAN on top of it.

Since XCP1.6/XS6.1, VLANs no longer have their own PIF_metrics. Rather, they point
to the PIF_metrics of the underlying PIF, which can be either a physical PIF
(e.g. for eth0), or a bond PIF. Therefore, the carrier of a VLAN PIF is the same
as the carrier of the underlying PIF.

When a physical PIF or bond PIF is created, it does not immediately have
PIF_metrics (PIF.metrics = "OpaqueRef:NULL"). The PIF_metrics object is created
and assigned to the PIF by the monitor thread a short while after that. If you
create a VLAN before the PIF_metrics have been created, the PIF.metrics field from
the underlying PIF will still be copied, which is "OpaqueRef:NULL". This will never
get updated, because the monitor thread ignores VLANs.

The fix is simply to immediately create an (empty) metrics object when creating a
bond.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
xenopsd: Support driver domains for PV guests

The case of HVM guests with emulated QEMU networks devices is not yet
handled.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Allow setting the VIF backend for a network

If, on a network, other_config:backend_vm is set to the UUID of a VM, this VM is
used for the VIF backends (netback) of any VIFs on the network.

This is useful for internal networks (only), since the key is set on a network
rather than on a PIF.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Merge pull request #1057 from johnelse/ca-98936-clearwater

CLEARWATER: CA-98936: Stop xapi from creating files in /tmp every time it gets an update from xenopsd
Merge pull request #1058 from johnelse/ca-96893-clearwater

CLEARWATER: CA-96893: Remove xenopsd VmExtra metadata from filesystem after suspend and migrate.
Merge pull request #1059 from johnelse/ca-98535-clearwater

CLEARWATER: CA-98535: Fix VDI.create
Merge pull request #1046 from konstantinchr/CA-99728-clearwater

CA-99728: CLEARWATER: Spelling errors.
Merge pull request #1082 from robhoes/ca96950-cw

CLEARWATER: CA-96950: Fix HIMN bridge name if needed
Merge pull request #1084 from robhoes/ca96541-cw

CLEARWATER: CA-96541/SCTX-1188: Fix race condition when creating metrics for VLAN PI...
Merge pull request #1110 from robhoes/p2p-cw

CLEARWATER: Allow setting the VIF backend for a network
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>
Merge pull request #1075 from robhoes/ca96886-cw

CLEARWATER: CA-96886: Fix race for a PCI device by multiple starting VMs
XOP-261: Reinstate the server on 127.0.0.1 when no management
interface is defined

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>