[PATCH v2 5/5] virsh: Implement virDomainResumeFlags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is done by introducing '--sync-time' to already existing
'resume' command. If the option is used, the newer Flags() API
is called.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tools/virsh-domain.c | 13 ++++++++++++-
 tools/virsh.pod      | 11 +++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index bd5f404..d264cd9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5135,6 +5135,10 @@ static const vshCmdOptDef opts_resume[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("domain name, id or uuid")
     },
+    {.name = "sync-time",
+     .type = VSH_OT_BOOL,
+     .help = N_("sync domain's time from its RTC")
+    },
     {.name = NULL}
 };
 
@@ -5144,11 +5148,18 @@ cmdResume(vshControl *ctl, const vshCmd *cmd)
     virDomainPtr dom;
     bool ret = true;
     const char *name;
+    unsigned int flags = 0;
 
     if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
         return false;
 
-    if (virDomainResume(dom) == 0) {
+    if (vshCommandOptBool(cmd, "sync-time"))
+        flags |= VIR_DOMAIN_RESUME_SYNC_TIME;
+
+    if ((flags &&
+         virDomainResumeFlags(dom, flags) == 0) ||
+        (!flags &&
+         virDomainResume(dom) == 0)) {
         vshPrint(ctl, _("Domain %s resumed\n"), name);
     } else {
         vshError(ctl, _("Failed to resume domain %s"), name);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index daddb48..faa5928 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2101,11 +2101,14 @@ is only supported with container based virtualization.
 Suspend a running domain. It is kept in memory but won't be scheduled
 anymore.
 
-=item B<resume> I<domain>
+=item B<resume> I<domain> [I<--sync-time>]
 
-Moves a domain out of the suspended state.  This will allow a previously
-suspended domain to now be eligible for scheduling by the underlying
-hypervisor.
+Moves a domain out of the suspended state.  This will allow a
+previously suspended domain to now be eligible for scheduling by the
+underlying hypervisor. Moreover, if I<--sync-time> is specified the
+domain's time is synced after the domain CPUs are started. Note, that
+this may require guest agent on some hypervisors and thus creates a
+window where some instructions can be executed with old time.
 
 =item B<dompmsuspend> I<domain> I<target> [I<--duration>]
 
-- 
2.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]