]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commit
libxl: add infrastructure to track and query 'recent' domids
authorPaul Durrant <pdurrant@amazon.com>
Tue, 7 Jan 2020 13:46:45 +0000 (13:46 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 24 Feb 2020 17:17:35 +0000 (17:17 +0000)
commit2b02882ebbbc5225182824fb66b1fb80724bb22a
treebc3d95d2b256927dc76cf2b5c50f60e151df4444
parent310c32faab7024d121047d36bc5a32a6764df089
libxl: add infrastructure to track and query 'recent' domids

A domid is considered recent if the domain it represents was destroyed
less than a specified number of seconds ago. For debugging and/or testing
purposes the number can be set using the environment variable
LIBXL_DOMID_REUSE_TIMEOUT. If the variable does not exist then a default
value of 60s is used.

Whenever a domain is destroyed, a time-stamped record will be written into
a history file (/var/run/xen/domid-history). To avoid the history file
growing too large, any records with time-stamps that indicate that the
age of a domid has exceeded the re-use timeout will also be purged.

A new utility function, libxl__is_recent_domid(), has been added. This
function reads the same history file checking whether a specified domid
has a record that does not exceed the re-use timeout. Since this utility
function does not write to the file, no records are actually purged by it.

NOTE: The history file is purged on boot to it is safe to use
      CLOCK_MONOTONIC as a time source.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/helpers/xen-init-dom0.c
tools/libxl/libxl.h
tools/libxl/libxl_domain.c
tools/libxl/libxl_internal.c
tools/libxl/libxl_internal.h