Merge "Handle EPIPE Broken Pipe from Libvirt RPC"

This commit is contained in:
Zuul
2025-08-29 16:34:02 +00:00
committed by Gerrit Code Review

View File

@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import errno
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import tenacity import tenacity
@@ -107,11 +108,17 @@ def refresh_libvirt_connection(conf, klass):
def is_disconnection_exception(e): def is_disconnection_exception(e):
if not libvirt: if not libvirt:
return False return False
return (isinstance(e, libvirt.libvirtError) if not isinstance(e, libvirt.libvirtError):
and e.get_error_code() in (libvirt.VIR_ERR_SYSTEM_ERROR, return False
libvirt.VIR_ERR_INTERNAL_ERROR) is_libvirt_error = (
and e.get_error_domain() in (libvirt.VIR_FROM_REMOTE, e.get_error_code() in (libvirt.VIR_ERR_SYSTEM_ERROR,
libvirt.VIR_FROM_RPC)) libvirt.VIR_ERR_INTERNAL_ERROR)
and e.get_error_domain() in (libvirt.VIR_FROM_REMOTE,
libvirt.VIR_FROM_RPC))
is_system_error = (
e.get_error_domain() == libvirt.VIR_FROM_RPC
and e.get_error_code() == errno.EPIPE)
return is_libvirt_error or is_system_error
retry_on_disconnect = tenacity.retry( retry_on_disconnect = tenacity.retry(