CA-76927: make the timeout of networkd's init script longer than that of dhclient

This ensures that the init script does not return an error due to
a slow DHCP process (the timeout of dhclient is 60s).

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: make Linux bond functions idempotent

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Allow Nm.bring_pif_up (down) even when currently_attached is not false (true)

This is possible, because all functions of networkd are idempotent.

PIF.plug can now be used to sync networkd's internal state, even when
a PIF is already up, to ensure that it come back correctly after a reboot.

Furthermore, it is now no longer necessary to unplug a PIF when changing
a parameter such as the MTU. To change the MTU, set the new value on the
network object, and then do a PIF.plug right away to make it happen.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Remove lines that are redundant since the previous commit

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-73892: networkd: after upgrade, use the old script to bring up NICs

This needs to happen before xapi starts (especially on a pool slave).
Networkd does not have any state yet, because it was not present before
the upgrade. Therefore, it uses the old init script (management-interface)
to initially bring up and configure all interfaces.

When xapi starts up after that, it will sync up with networkd through
the "Best-effort bring up of physical NICs" startup item, in order to
fill networkd's cache.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
On xapi start, also plug PIFs with IP configuration

This ensures that the state of all PIFs that are configured by networkd
when the hosts starts (before xapi) gets updated.

Signed-off-by: Rob Hoes <rob.hoes@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>
Preserve API errors thrown by metadata import failure.

Signed-off-by: John Else <john.else@citrix.com>
CA-77726: Use a new session to create the return value from Host.migrate_receive.

If event.next and event.from are being used concurrently using the same
session, event.from dynamically adds and removes event subscriptions for
that session, which can cause event.next to intermittently fail with
SESSION_NOT_REGISTERED, even if the client has registered for events.

This prevents XenCenter from migrating VMs, since XenCenter and the
source host's xapi use the same session to talk to the destination
host's xapi, and xapi uses event.next as part of
Cli_util.wait_for_task_completion while XenCenter calls event.from all
the time.

Returning a new session from Host.migrate_receive is a quick fix - we
should investigate whether event.next and event.from can be called
concurrently with themselves and each other when a session reference is
shared.

Signed-off-by: John Else <john.else@citrix.com>
Remove a function which already exists in Listext.

Signed-off-by: John Else <john.else@citrix.com>
Merge commit '895fed281c138d2fdad8e3ab5554ac4dce41b42d'
Merge commit '67bda85462f7da34690793f308a58bad763b9fd0'
CA-78226: fix setup-vif-rules, used by VIF switch port locking

Unfortunately this delta was hidden in a merge request changeset in the cooper branch.

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