[virt-tools-list] [PATCH 2/3] virt-manager: ignore VIR_ERR_NO_DOMAIN when a domain was just deleted

Cole Robinson crobinso at redhat.com
Thu Aug 15 00:12:41 UTC 2013


On 08/09/2013 08:18 AM, Giuseppe Scrivano wrote:
> Some callbacks registered by `idle_add' could try to access a domain that
> was just deleted.  Detect these cases and don't propagate the exception.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
> NOTE:
> 
> The race situation appears quite seldom, for my tests I have created and
> deleted a bunch of LXC application containers.  I have noticed this issue
> while I was debugging 985291.
> 
>  virtManager/details.py | 11 +++++++++--
>  virtManager/domain.py  |  2 +-
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/virtManager/details.py b/virtManager/details.py
> index 2f7e7d4..cb9ea7a 100644
> --- a/virtManager/details.py
> +++ b/virtManager/details.py
> @@ -2635,8 +2635,15 @@ class vmmDetails(vmmGObjectUI):
>  
>          # If the dialog is visible, we want to make sure the XML is always
>          # up to date
> -        if self.is_visible():
> -            self.vm.refresh_xml()
> +        try:
> +            if self.is_visible():
> +                self.vm.refresh_xml()
> +        except libvirt.libvirtError, e:
> +            if (hasattr(libvirt, "VIR_ERR_NO_DOMAIN") and
> +                e.get_error_code() == getattr(libvirt, "VIR_ERR_NO_DOMAIN")):
> +                self.close()
> +                return
> +            raise
>  
>          # Stats page needs to be refreshed every tick
>          if (page == PAGE_DETAILS and
> diff --git a/virtManager/domain.py b/virtManager/domain.py
> index de0df8a..bd04452 100644
> --- a/virtManager/domain.py
> +++ b/virtManager/domain.py
> @@ -1560,6 +1560,7 @@ class vmmDomain(vmmLibvirtObject):
>          """
>          try:
>              info = self._backend.info()
> +            self._update_status(info[0])
>          except libvirt.libvirtError, e:
>              if (hasattr(libvirt, "VIR_ERR_NO_DOMAIN") and
>                  e.get_error_code() == getattr(libvirt, "VIR_ERR_NO_DOMAIN")):
> @@ -1567,7 +1568,6 @@ class vmmDomain(vmmLibvirtObject):
>                  return
>              raise
>  
> -        self._update_status(info[0])
>  
>      def _update_status(self, status):
>          """
> 

Idea is fine, but can you abstract that NO_DOMAIN check out into a util
function. There might be other similar uses in the code as well.

Thanks,
Cole




More information about the virt-tools-list mailing list