[xapi] avoid fetching unnecessary events from xenopsd when monitoring a task

If we call UPDATES.get None then we get an event on every object in the system.
Instead we only need to:

  last_id <- UPDATES.last_id
  TASK.stat
  UPDATES.from last_id

which will fetch only new events, and only in the case where the task hasn't
already finished.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
[xapi] Only update the storage.db if something has actually changed

We implement DP.destroy by iterating over every active VDI. If there
are 1000 active VDIs then we were pointlessly writing the database
1000 times. This saves 15s per DP.detach.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
networkd: split off config file functions into separate module

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: add a tool that returns networkd's configuration from

The tool reads /var/xapi/networkd.db and outputs the configuration
for a given bridge and/or interface. This is useful for the upgrade
path of the host installer.

Example:

$ networkd_db -bridge xapi0 -iface xapi0
interfaces=eth0,eth1
mode=static
ipaddr=10.80.228.25
netmask=255.255.240.0
gateway=10.80.224.1
dns=10.80.16.125,10.80.16.126
domain=uk.xensource.com
modev6=static
ipv6addr=fd00::666/64
gatewayv6=fd00::1

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
networkd: Improve exception handling when reading/writing config files

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
PR-1255: logging for SXM performance analysis

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-85168: Initialize dom0 memory_dynamic_min and memory_dynamic_max with some sensible values

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@ocamlpro.com>
CA-85168: xapi deal with memory values in bytes, xenops in KiB

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@ocamlpro.com>
CA-85544: if we attach the disk RO, mount the filesystem RO

Strangely mounting a filesystem RW on top of a RO tapdisk is succeeding
but spamming the logs with errors.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-85545: do not spamm the logs with harmless parsing errors

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@ocamlpro.com>
CA-85191: cancel device operations when a domain crashes

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@ocamlpro.com>
CA-85518, CA-82785: add missing errors in the datamodel

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@ocamlpro.com>
Started creating the RRD daemon (rrdd).

Signed-off-by: Rok Strnisa <rok.strnisa.com>
Moved the rrdd interface into its own directory for better code isolation.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>
Moved monitor.ml to temporary directory, redirecting xapi calls to it.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>
Moved monitor_rrds.ml to temporary directory, redirecting xapi calls to it.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>
Removed more dependencies between xapi and rrdd.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>
Started adapting monitor_rrd code for the rrdd daemon.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>
Moved more code from monitor_rrds to rrdd_server.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>
Moved migrate_push to rrdd_server.

Signed-off-by: Rok Strnisa <rok.strnisa@citrix.com>