On 2020-10-01 1:21 a.m., Michal Prívozník wrote: > On 10/1/20 3:42 AM, Digimer wrote: >> Hi all, >> >> Is there a way to tell when a tool made a change to guest (ie: used >> virt-manager to make a change)? Following, is there a way to check to >> see if there are changes queued to take effect when the guest next >> reboots? >> > > You can listen for events. For changes to inactive XML you will get > VIR_DOMAIN_EVENT_DEFINED+VIR_DOMAIN_EVENT_DEFINED_UPDATED lifecycle > event (+reason) and for changes to live XML (like hotplug and hotunplug) > you'll get DEVICE_ADDED or DEVICE_REMOVED. > > But there is no API/virsh command that you could call to get the > timestamp of last modification. You have to listen for events. > > And the second question - you can dump live and inactive XML and see if > there is any difference (modulo runtime configuration from live XML). > The live XML should be strictly bigger than inactive XML, meaning live > XML should be inactive XML + runtime info. But again, no API there, > because changes to inactive XML can be done any time - libvirt keeps > live and inactive XMLs separately. > >> If either of the above are not possible, is there a way to see when >> a guest last booted or how long a guest has been running? > > Again, if listening to evens - libvirt emits one when a guest is > started. But I don't think we store a timestamp of start anywhere nor > expose it through an API. Maybe there is some indirect way? > > Michal Thanks, Michal. Now I know not to keep looking. I do infer the boot time (explained in my reply to daggs and feri. In brief, when we notice a server is running, that had last been seen off, we use the pid to get the runtime in seconds and subtract that from the current time to get a boot time. -- Digimer Papers and Projects: https://alteeve.com/w/ "I am, somehow, less interested in the weight and convolutions of Einstein’s brain than in the near certainty that people of equal talent have lived and died in cotton fields and sweatshops." - Stephen Jay Gould