mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
remote_daemon: Initialize host boot time global variable
This is not strictly needed, but it makes sure we initialize the @bootTime global variable. Thing is, in order to validate XATTRs and prune those set in some previous runs of the host, a timestamp is recorded in XATTRs. The host boot time was unique enough so it was chosen as the timestamp value. And to avoid querying and parsing /proc/uptime every time, the query function does that only once and stores the boot time in a global variable. However, the only time the query function is called is in a child process that does lock files and changes seclabels. So effectively, we are doing exactly what we wanted to prevent from happening. The fix is simple, call the virHostBootTimeInit() function which sets the global variable. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
9d69bc19b9
commit
35d603d5ae
@ -57,6 +57,7 @@
|
|||||||
#include "virgettext.h"
|
#include "virgettext.h"
|
||||||
#include "util/virnetdevopenvswitch.h"
|
#include "util/virnetdevopenvswitch.h"
|
||||||
#include "virsystemd.h"
|
#include "virsystemd.h"
|
||||||
|
#include "virhostuptime.h"
|
||||||
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
|
||||||
@ -1150,6 +1151,14 @@ int main(int argc, char **argv) {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Let's try to initialize global variable that holds the host's boot time. */
|
||||||
|
if (virHostBootTimeInit() < 0) {
|
||||||
|
/* This is acceptable failure. Maybe we won't need the boot time
|
||||||
|
* anyway, and if we do, then virHostGetBootTime() returns an
|
||||||
|
* appropriate error. */
|
||||||
|
VIR_DEBUG("Ignoring failed boot time init");
|
||||||
|
}
|
||||||
|
|
||||||
daemonSetupNetDevOpenvswitch(config);
|
daemonSetupNetDevOpenvswitch(config);
|
||||||
|
|
||||||
if (daemonSetupAccessManager(config) < 0) {
|
if (daemonSetupAccessManager(config) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user