Improve assert_homogeneous_vswitch_configuration on pool join

This assert only blocked openvswitch hosts to join bridge pool,
and not the other way around. According to the original commit
message, that was not the intention.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: make bridge_create less destructive

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: move types and defaults to interface file

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: rename restore_config fuctions to make_config and add non-conservative mode

Thus far, the restore_config functions were used only when networkd starts up,
to restore the cache configuration. This was done "conservatively", leaving
alone interfaces and bridges that were already configured, as well as non-
persistent bridges and interfaces.

This patch adds a "non-conservative" mode, and exposes the functions through
the interface, so they can be used more generally (e.g. by xapi).

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: remove IP address when destroying a bridge to stop dhclient (if running)

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Use make_config to configure interfaces and bridges in Nm

Nm used to make call to the low-level networkd functions to create
and configure bridges and interfaces when "bringing up" a PIF.

Now, Nm essentially transforms the relevant bit of the xapi database
into a networkd configuration structure, which is passed into
Bridge.make_config and Interface.make_config. These two networkd
functions take care of setting things up in the right order, using the
same code that is used when the hosts starts up.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Move mtu and ethtool settings for management interface outside create_bridges

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Do not depend on backend type in Nm

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Combine Bridge.destroy calls

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Split infrastructure setup and management IP configuration

This split is necessary for a future move to network driver domains, where
the infrastructure setup (configuring bridges and physical interfaces
etc.) should happen in the driver domains, while the IP addresses should
be configured in the domain where xapi is running.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: properly log failures in startup thread

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: also configure physical interface on first boot

Mainly to set the default ethtool parameters.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: also (re)configure interfaces that are already up on startup

Only configuring interfaces that are not yet up when networkd starts
(which was done to not mess up any interfaces that may have been configured
by some other tool) does not work, because networkd also creates and brings
up interfaces as part of the bridge creation process that runs slightly
earlier.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Eliminate a DB call that may happen while a slave has no IP

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Change comment.

Signed-off-by: John Else <john.else@citrix.com>
Change API error thrown when trying to destroy or forget an attached SR.

Signed-off-by: John Else <john.else@citrix.com>
Change error message for SR_HAS_PBD.

Signed-off-by: John Else <john.else@citrix.com>
CA-76466: Disallow SR.destroy if SR has no PBDs.

If an SR has no PBDs then we have no way of communicating with the
storage provider, so destroying the SR is not possible.

Signed-off-by: John Else <john.else@citrix.com>
CA-76466: Update SR.allowed_operations after PBD.{create|destroy}

This requires upgrading PBD.create and PBD.destroy to "official" SR
operations.

Signed-off-by: John Else <john.else@citrix.com>
CA-76466: Remove partial application, so that things get executed in the right order.

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