From bad0bdbee1225d4d5831bc7ea7d4113df4de743d Mon Sep 17 00:00:00 2001
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
Date: Tue, 29 Nov 2022 10:01:51 +0000
Subject: [PATCH 08/24] libvirt-guests: Sync time for autostarted guests
 Setting SYNC_TIME=1 does not work on autostarted guests.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See https://bugzilla.redhat.com/show_bug.cgi?id=1555398.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Signed-off-by: tangbin <tangbin_yewu@cmss.chinamobile.com>
(cherry-pick from a501fa7cae2b93807496295945e6d3b51e5ccb3f)
---
 tools/libvirt-guests.sh.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index a881f6266e..74286a12c4 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -200,9 +200,9 @@ start() {
                     retval run_virsh "$uri" start $bypass "$name" \
                         >/dev/null && \
                     gettext "done"; echo
-                    if "$sync_time"; then
-                        run_virsh "$uri" domtime --sync "$name" >/dev/null
-                    fi
+                fi
+                if "$sync_time"; then
+                    run_virsh "$uri" domtime --sync "$name" >/dev/null
                 fi
             fi
         done
-- 
2.27.0

