zoukankan      html  css  js  c++  java
  • [zz]libvirt Progress monitoring & cancellation of jobs

    This series introduces 2 new APIs to allow long running jobs to
    be monitored and cancelled. This applies to virDomainMigrate,
    virDomainSave, virDomainRestore and virDomainCoreDump at least.
    The implementation is provided for QEMU only, any others that
    are able to implementation can do so as desired.
    
    Usefulness of these new APIs requires use of multiple threads on
    a single connection, or multiple connections, since the main
    API calls are still all fully blocking. Instead a parallel thread
    or process can monitor. This can be seen with virsh
    
    In termainl 1
    
     $ virsh save demo demo.img
    
    In terminal 2
    
     $ ./virsh domjobinfo demo
      Job type:         Unbounded   
      Time elapsed:     795          ms
      Data processed:   22446080     bytes
      Data remaining:   219119616    bytes
      Data total:       241565696    bytes
      Memory processed: 22446080     bytes
      Memory remaining: 219119616    bytes
      Memory total:     241565696    bytes
    
     $ ./virsh domjobinfo demo
      Job type:         Unbounded   
      Time elapsed:     1669         ms
      Data processed:   139784192    bytes
      Data remaining:   101781504    bytes
      Data total:       241565696    bytes
      Memory processed: 139784192    bytes
      Memory remaining: 101781504    bytes
      Memory total:     241565696    bytes
    
     $ ./virsh domjobabort demo
    
    
    Back in terminal 1
    
      error: Failed to save domain demo to demo.img
      error: operation failed: Migration was cancelled by client
    Daniel P. Berrange 2010年02月05日 星期五 01时25分07秒
    The new virDomainAbortJob() method provides a way for a second
    thread to abort an ongoing job run by another thread. This
    extends to any API with  which the virDomainGetJobInfo() API
    is intended to work. Cancellation is not guarenteed, rather best
    effort on part of the hypervisor and not required to be implmented.
    
    * include/libvirt/libvirt.h.in: Define virDomainAbortJob()
    ---
     include/libvirt/libvirt.h.in |    2 ++
     1 files changed, 2 insertions(+), 0 deletions(-)
    
    diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
    index 5058bc0..0ffcf11 100644
    --- a/include/libvirt/libvirt.h.in
    +++ b/include/libvirt/libvirt.h.in
    @@ -1804,6 +1804,8 @@ struct _virDomainJobInfo {
     int virDomainGetJobInfo(virDomainPtr dom,
                             virDomainJobInfoPtr info);+int virDomainAbortJob(virDomainPtr dom);
    +
     #ifdef __cplusplus
     }
     #endif
    Daniel P. Berrange 2010年02月05日 星期五 01时25分09秒
    Introduce support for  virDomainGetJobInfo in the QEMU driver. This
    allows for monitoring of any API that uses the 'info migrate' monitor
    command. ie virDomainMigrate, virDomainSave and virDomainCoreDump
    
    Unfortunately QEMU does not provide a way to monitor incoming migration
    so we can't wire up virDomainRestore yet.
    
    The virsh tool gets a new command 'domjobinfo' to query status
    
  • 相关阅读:
    ROS学习笔记8-rqt_console和roslaunch
    ROS学习笔记11-写一个简单的服务和客户端(C++版本)
    ROS学习笔记10-写一个简单的订阅者和发布者(C++版本)
    ROS学习笔记9-创建ros消息和服务
    ROS学习笔记INF-重要操作列表
    ROS学习笔记1-引言
    ROS学习笔记6-理解主题
    ROS学习笔记5-理解节点(Node)
    ROS学习笔记4-创建一个ROS包
    算是入行 ISP 了吧
  • 原文地址:https://www.cnblogs.com/zhangzhang/p/2372379.html
Copyright © 2011-2022 走看看