Преглед изворни кода

qvm-sync-clock: use qubes.SetDateTime service instead of direct "date" call

This way it gives more control over time synchronization to the VM. For
example Whonix VMs can decide to not use this mechanism. Also VM can
choose how that time will be set (chronyc call?). And finally it will be
possible to implement the same for other OS-es (Windows).

Additionally because of calling date as "localcmd" each time, instead of
once at the beginning, time synchronization is more accurrate now. If
some VM stall the time set call, other VMs time will no longer be
affected (but still synchronization will be delayed).
Marek Marczykowski-Górecki пре 9 година
родитељ
комит
5f9a30d335
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      qvm-tools/qvm-sync-clock

+ 2 - 2
qvm-tools/qvm-sync-clock

@@ -111,8 +111,8 @@ def main():
             if verbose:
             if verbose:
                 print >> sys.stderr, '--> Syncing \'%s\' clock.' % vm.name
                 print >> sys.stderr, '--> Syncing \'%s\' clock.' % vm.name
             try:
             try:
-                vm.run('date -u -R -s "%s"' % date_out, user="root",
-                       gui=False, verbose=verbose)
+                vm.run_service("qubes.SetDateTime", user="root",
+                               localcmd="date -u -Iseconds")
             except Exception as e:
             except Exception as e:
                 print >> sys.stderr, "ERROR syncing time in VM '%s': %s" % (vm.name, str(e))
                 print >> sys.stderr, "ERROR syncing time in VM '%s': %s" % (vm.name, str(e))
                 pass
                 pass