Avoid down/up notifications for interfaces on agent restart
For #12 (closed) we remove all VIF data from xenstore for simplicity, to avoid stale information. Downside: watchers will see interfaces go down and up again, possibly using different IP address ordering within each interface (due to the constraint imposed by the "std" xenserver schema to index IP addresses, and our efforts to not cause flickering on all other IPs of a given interface when one IP is removed).
This would require a few reworks:
-
collector_net.collect_current()
returns a stream of events somain()
can use the same publisher API than events coming in during the life of the agent. This should be changed somain()
passes to a new publisher API the whole current network state; this API implementation for xenstore (and the schemas it supports) will be able to enumerate interfaces previously published to xenstore and drop the stale ones, as well as publish any change from the old state. - above-mentionned indexing of IP addresses (ie.
$VIF/ipv4/0
,$VIF/ipv4/1
etc) requires our xenstore "std" schema to keep a cache matching IPs to their indices. To be able to reuse existing entries we'll have to start by repopulating the cache from xenstore contents. Preferably before applying the removal of stale entries, so a single read of the xenstore contents drives both operations.