[virt-tools-list] [PATCH] virtinst: refresh pools status before fetch_pools

Chen, Hanxiao chenhanxiao at cn.fujitsu.com
Fri Dec 5 09:10:23 UTC 2014



> -----Original Message-----
> From: virt-tools-list-bounces at redhat.com
> [mailto:virt-tools-list-bounces at redhat.com] On Behalf Of Chunyan Liu
> Sent: Friday, December 05, 2014 4:40 PM
> To: virt-tools-list at redhat.com
> Subject: [virt-tools-list] [PATCH] virtinst: refresh pools status before
> fetch_pools
> 
> Currently, when connecting to hypervisor, if there are pools active
> but in fact target path already deleted (or for other reasons the
> pool is not working), libvirtd not refresh status yet, fetch_pools
> will fail, that will cause "connecting to hypervisor" process
> reporting error and exit. The whole connection work failed.
> 
> With the patch, always refresh pool status before fetch pools. Let
> the libvirtd pool status reflect the reality, avoid the non-synced
> status affects the hypervisor connection.
> 
> Signed-off-by: Chunyan Liu <cyliu at suse.com>
> ---
>  virtinst/pollhelpers.py | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
> index a9b1527..e8702f0 100644
> --- a/virtinst/pollhelpers.py
> +++ b/virtinst/pollhelpers.py
> @@ -133,6 +133,19 @@ def fetch_pools(backend, origmap, build_func):
> 
>      if backend.check_support(
>          backend.SUPPORT_CONN_LISTALLSTORAGEPOOLS) and not _force_old_poll:
> +
> +        # Refresh pools before poll_helper. For those
> +        # 'active' but target path not exist (or other reasons
> +        # causing the pool not working), but libvirtd not
> +        # refresh the status, this will make it refreshed
> +        # and mark that pool as 'inactive'.
> +        objs = backend.listAllStoragePools()
> +        for obj in objs:
> +            try:
> +                obj.refresh(0)
> +            except Exception, e:
> +                pass
> +
>          return _new_poll_helper(origmap, name,
>                                  backend.listAllStoragePools, build_func)
>      else:
> --
> 1.8.4.5

ACK.

Thanks,
- Chen




More information about the virt-tools-list mailing list