1. 30 11月, 2011 6 次提交
    • D
      Remove pointless strdup in node suspend code · 8c60bc16
      Daniel P. Berrange 提交于
      The command name for the suspend action does not need to be
      strdup'd. The constant string can be used directly. This
      also means the code can be trivially rearranged to make the
      switch clearer
      
      * src/util/virnodesuspend.c: Remove strdup of cmdString
      8c60bc16
    • D
      Do lazy init of host PM features · 2fc056c1
      Daniel P. Berrange 提交于
      To avoid probing the host power management features on any
      call to virInitialize, only initialize the mutex in
      virNodeSuspendInit. Do lazy load of the supported PM target
      mask when it is actually needed
      
      * src/util/virnodesuspend.c: Lazy init of supported features
      2fc056c1
    • D
      Remove powerMgmt_valid field from capabilities struct · f1f28611
      Daniel P. Berrange 提交于
      If we ensure that virNodeSuspendGetTargetMask always resets
      *bitmask to zero upon failure, there is no need for the
      powerMgmt_valid field.
      
      * src/util/virnodesuspend.c: Ensure *bitmask is zero upon
        failure
      * src/conf/capabilities.c, src/conf/capabilities.h: Remove
        powerMgmt_valid field
      * src/qemu/qemu_capabilities.c: Remove powerMgmt_valid
      f1f28611
    • D
      Move suspend capabilities APIs out of util.h into virnodesuspend.c · c92653f4
      Daniel P. Berrange 提交于
      The node suspend capabilities APIs should not have been put into
      util.[ch]. Instead move them into virnodesuspend.[ch]
      
      * src/util/util.c, src/util/util.h: Remove suspend capabilities APIs
      * src/util/virnodesuspend.c, src/util/virnodesuspend.h: Add
        suspend capabilities APIs
      * src/qemu/qemu_capabilities.c: Include virnodesuspend.h
      c92653f4
    • D
      Rename suspend capabilities APIs · 53c2aad8
      Daniel P. Berrange 提交于
      Rename virGetPMCapabilities to virNodeSuspendGetTargetMask and
      virDiscoverHostPMFeature to virNodeSuspendSupportsTarget.
      
      * src/util/util.c, src/util/util.h: Rename APIs
      * src/qemu/qemu_capabilities.c, src/util/virnodesuspend.c: Adjust
        for new names
      53c2aad8
    • D
      Fix values of PM target type constants · 866b0a70
      Daniel P. Berrange 提交于
      The VIR_NODE_SUSPEND_TARGET constants are not flags, so they
      should just be assigned straightforward incrementing values.
      
      * include/libvirt/libvirt.h.in: Change VIR_NODE_SUSPEND_TARGET
        values
      * src/util/virnodesuspend.c: Fix suspend target checks
      866b0a70
  2. 29 11月, 2011 1 次提交
    • S
      Implement the core API to suspend/resume the host · 4ddb37c3
      Srivatsa S. Bhat 提交于
      Add the core functions that implement the functionality of the API.
      Suspend is done by using an asynchronous mechanism so that we can return
      the status to the caller before the host gets suspended. This asynchronous
      operation is achieved by suspending the host in a separate thread of
      execution. However, returning the status to the caller is only best-effort,
      but not guaranteed.
      
      To resume the host, an RTC alarm is set up (based on how long we want to
      suspend) before suspending the host. When this alarm fires, the host
      gets woken up.
      
      Suspend-to-RAM operation on a host running Linux can take upto more than 20
      seconds, depending on the load of the system. (Freezing of tasks, an operation
      preceding any suspend operation, is given up after a 20 second timeout).
      And Suspend-to-Disk can take even more time, considering the time required
      for compaction, creating the memory image and writing it to disk etc.
      So, we do not allow the user to specify a suspend duration of less than 60
      seconds, to be on the safer side, since we don't want to prematurely declare
      failure when we only had to wait for some more time.
      4ddb37c3