[libvirt] [PATCH v3] util: set minimum value of nodesuspend duration to 60 seconds

Guannan Ren gren at redhat.com
Wed Jul 25 05:52:49 UTC 2012


Change the permissible minimum value of nodesuspend duration time
to 60 seconds. If option is less than the value, reports error.
Update virsh help and manpage the infomation.
---
 src/util/virnodesuspend.c |    2 +-
 tools/virsh.c             |    2 +-
 tools/virsh.pod           |    3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 71beb3d..91dfdf6 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -90,7 +90,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
     virCommandPtr setAlarmCmd;
     int ret = -1;
 
-    if (alarmTime <= MIN_TIME_REQ_FOR_SUSPEND) {
+    if (alarmTime < MIN_TIME_REQ_FOR_SUSPEND) {
         virReportError(VIR_ERR_INVALID_ARG, "%s", _("Suspend duration is too short"));
         return -1;
     }
diff --git a/tools/virsh.c b/tools/virsh.c
index 6d65036..d236950 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -6986,7 +6986,7 @@ static const vshCmdInfo info_nodesuspend[] = {
 static const vshCmdOptDef opts_node_suspend[] = {
     {"target", VSH_OT_DATA, VSH_OFLAG_REQ, N_("mem(Suspend-to-RAM), "
                                                "disk(Suspend-to-Disk), hybrid(Hybrid-Suspend)")},
-    {"duration", VSH_OT_INT, VSH_OFLAG_REQ, N_("Suspend duration in seconds")},
+    {"duration", VSH_OT_INT, VSH_OFLAG_REQ, N_("Suspend duration in seconds, at least 60")},
     {"flags", VSH_OT_INT, VSH_OFLAG_NONE, N_("Suspend flags, 0 for default")},
     {NULL, 0, 0, NULL}
 };
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 6ecf6ce..dffd588 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -290,7 +290,8 @@ If I<cell> is specified, this will prints specified cell statistics only.
 Puts the node (host machine) into a system-wide sleep state such as
 Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend and sets up a
 Real-Time-Clock interrupt to fire (to wake up the node) after a time delay
-specified by the 'duration' parameter.
+specified by the 'duration' parameter. The duration time should be
+at least 60 seconds.
 
 =item B<capabilities>
 
-- 
1.7.7.5




More information about the libvir-list mailing list