• [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
    
  • 相关阅读:
    firefox、chrome的DNS缓存清除方法
    MySQL中查询所有数据库占用磁盘空间大小和单个库中所有表的大小的sql语句
    PHP获取当前页面的网址
    JAVA接单10大平台
    线程
    创建一个简单的迭代器
    2016-09-20
    C# 静态构造函数
    ASP.NET MVC 右键点击添加没有区域(Area)、控制器、试图等选项
    Git的使用--如何将本地项目上传到Github(两种简单、方便的方法)
  • 原文地址:https://www.cnblogs.com/zhangzhang/p/2372379.html
Copyright © 2020-2023  润新知