Simplify network module for xapi -> networkd calls

Also move it from ocaml/network to ocaml/xapi for consistency.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Nm

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Xapi_pif

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Create_misc

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Helpers

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Mtc

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Dbsync_slave

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Xapi_network

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Xapi_pool

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Stop using Netdev module in Monitor_master

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: setup HIMN interface in driver domain

* Rename it to "xenapi".
* Obtain an IP from DHCP.
* Listen on the IP.
* Write the IP to xenstore.

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>
xenopsd: Set permissive flag in pciback for PCI passthru

This is necessary for certain network drivers to function in a driver
domain. Perhaps we need to make it configurable, as I am not sure whether
this options is safe to be enabled in all cases.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: Enable use in a driver domain

* Add {Interface,Bridge}.set_driver_domain functions to allow the
  client (xapi) to specify which VM owns the interface or bridge
  (by UUID). Networkd keeps track of this in its persistent state.
* Introduce a forwarding layer for API calls. A call is executed
  locally or sent off to a networkd instance in a driver domain
  depending on the above mentioned driver-domain state.
* When an API call is forwarded, the IP address of the driver doamin
  is obtained from xenstore.
* Functions such as Interface.get_all query all known driver domains
  to obtain the required information across the host.
* We also expose some further utility functions: Interface.{is_vif_front,
  get_pci_bus_path,rename}.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: Obtain MAC addresses from sysfs rather than the ip command

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Add utility functions for network driver domains to Network module

* Network.driver_domain_devs returns the PCI devices that are "managed"
  by a given VM as configured in other-config:managed-pci-uuids.
* Network.get_driver_domain returns, for a given PIF, the VM that is
  "managing" it (as above). It furthermore behaves correctly for VLANs
  and other higher-level PIFs: e.g. a VLAN PIF is managed by whatever
  VM manages its underlying physical PIF.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Pass through PCI devices to network driver domains as required

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Set VIF backends properly with regards to network driver domains

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Set driver domain when plugging a PIF

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