This flag can be used to sync the domain's time right after domain CPUs are started. It's basically backing call of two subsequent APIs into one: 1) virDomainResume(dom) 2) virDomainSetTime(dom, 0, 0, VIR_DOMAIN_TIME_SYNC) Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- include/libvirt/libvirt-domain.h | 4 ++++ src/qemu/qemu_driver.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 1795dd3..8d763c7 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -867,6 +867,10 @@ int virDomainFree (virDomainPtr domain); /* * Domain suspend/resume */ +typedef enum { + VIR_DOMAIN_RESUME_SYNC_TIME = 1 << 0, /* on resume sync domain time from its RTC */ +} virDomainResumeFlagsValues; + int virDomainSuspend (virDomainPtr domain); int virDomainResume (virDomainPtr domain); int virDomainResumeFlags (virDomainPtr domain, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 903ca5d..38926c4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1933,7 +1933,7 @@ qemuDomainResumeFlags(virDomainPtr dom, virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; - virCheckFlags(0, -1); + virCheckFlags(VIR_DOMAIN_RESUME_SYNC_TIME, -1); if (!(vm = qemuDomObjFromDomain(dom))) return -1; @@ -1974,6 +1974,11 @@ qemuDomainResumeFlags(virDomainPtr dom, goto endjob; if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) goto endjob; + + if (flags & VIR_DOMAIN_RESUME_SYNC_TIME && + qemuDomainSetTimeImpl(driver, vm, 0, 0, true) < 0) + goto endjob; + ret = 0; endjob: -- 2.0.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list