On Wed, Jan 08, 2025 at 19:42:50 +0000, Daniel P. Berrangé wrote: > This is maintained in the same way as the autostart flag, using a > symlink. The difference is that instead of '.xml', the symlink > suffix is '.xml.once'. The link is also deleted immediately after > it has been read. > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > --- > src/conf/domain_conf.c | 6 +++++- > src/conf/domain_conf.h | 1 + > src/conf/virdomainobjlist.c | 7 ++++++- > 3 files changed, 12 insertions(+), 2 deletions(-) [...] > diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c > index 72207450c5..ba2f9f544d 100644 > --- a/src/conf/virdomainobjlist.c > +++ b/src/conf/virdomainobjlist.c [...] > @@ -500,13 +501,17 @@ virDomainObjListLoadConfig(virDomainObjList *doms, > return NULL; > > autostartLink = virDomainConfigFile(autostartDir, name); > + autostartOnceLink = g_strdup_printf("%s.once", autostartLink); > > autostart = virFileLinkPointsTo(autostartLink, configFile); > + autostartOnce = virFileLinkPointsTo(autostartOnceLink, configFile); > + unlink(autostartOnceLink); Actually this will not work properly if you restart the daemon before rebooting the host as configs will be loaded, thus the file unlinked but then the only place this is recorded is in memory. The unlinking of the file needs to happen only after autostart was actually attempted, which should be reasonably doable now that's centralised.