CA-77236: networkd: reread inventory file before looking up anything

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
[WHITESPACE] Fix indentation of Xapi.bring_up_management_if function

This-is-only-a-whitespace-change proof:

$ git diff -w HEAD^ | wc -l
0

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CP-3477: Make xapi listen on all dom0 IP addresses

Xapi now starts listening on all IP addresses when it starts up, and
management is not disabled.

Even though xapi listens on all IP addresses, there is still an interface
appointed as _the_ management interface. Slaves in a pool use the IP address
of this interface to connect the pool master.

It is now no longer needed to rebind the management socket after IP changes.

Changing the management interface with Host.management_reconfigure now starts
the API server in case it was not running, but leaves it alone otherwise.
Besides that, it is only an update of the inventory file, plus an update of the
Host.address field.

Also remove the rewrite-management-interface script, and instead update the
MANAGEMENT_INTERFACE key in inventory file in xapi itself.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Remove unused module Xapi_network_types

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Use HTTP "host" header to decided whether to forward and API call to the master

Since xapi is now listening on all dom0 IPs, API calls coming in on
the HIMN now go through the API server as all other incoming calls.

The different between calls on the HIMN and those coming from outside
is that HIMN calls on a pool slave must be forwarded to the master, while
others do not. We use the HTTP "host" header to distinguish between these
cases.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Clean up HIMN code

Since the HIMN connections are now handled by the main api_server,
there are only two special HIMN things to do: getting an IP address on the
HIMN bridge, and starting a HIMN API server in case management is disabled.

This code has been modified and moved to Xapi_network and Xapi_mgmt_iface.
There is now no longer any need for Xapi_network_real, so remove it.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: add exception handler to get_carrier function

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Fix the build
Move xenopsd into PACKAGES.main (not PACKAGES.xcp -- this is for things which are *only* in XCP)
Implements device_id for Windows VM
CA-78066: register the PUT /services HTTP handler

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-78066: if an HTTP handler is missing, produce a nice log message rather than Not_found

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

Signed-off-by: John Else <john.else@citrix.com>
Improve comment for the "live" metadata import flag.

Signed-off-by: John Else <john.else@citrix.com>
Fix up import/export request parameters.

Signed-off-by: John Else <john.else@citrix.com>
Fix VDI import handler for dry run live migration.

In a dry run of a live migration, we don't expect the VM's VDIs to be
present; they will be mirrored from the source host during the real
migration.

Signed-off-by: John Else <john.else@citrix.com>
Don't update VM snapshot links during a dry run import.

Signed-off-by: John Else <john.else@citrix.com>
Fix VBD dry run import.

Only replace the VM reference in the VBD record after we've used the old
reference to look up the VM record from the export data.

Signed-off-by: John Else <john.else@citrix.com>
Create a dummy VDI record in the state table during a live dry run import.

The missing VDI is to be expected, however the import of the
corresponding VBD will fail if there is no VDI record in the state
table.

Signed-off-by: John Else <john.else@citrix.com>
Use exported data rather than DB to determine imported VM's power state.

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