From 5000dcff7ee48452e86f4f43d9043cc6327faa6f Mon Sep 17 00:00:00 2001 From: Praharshitha Metla Date: Thu, 30 Jul 2020 16:30:06 +0530 Subject: [PATCH] Removed the host FQDN from the exception message Deletion of an instance after disabling the hypervisor by a non-admin user leaks the host fqdn in fault msg of instance.Removing the 'host' field from the error message of HypervisorUnavaiable cause it's leaking host fqdn to non-admin users. The admin user will see the Hypervisor unavailable exception msg but will be able to figure on which compute host the guest is on and that the connection is broken. Change-Id: I0eae19399670f59c17c9a1a24e1bfcbf1b514e7b Closes-Bug: #1851587 (cherry picked from commit a89ffab83261060bbb9dedb2b8de6297b2d07efd) (cherry picked from commit ff82601204e9d724b3032dc94c49fa5c8de2699b) (cherry picked from commit c5abbd17b5552209e53ad61713c4787f47f463c6) (cherry picked from commit d5ff9f87c8af335e1f83476319a2540fead5224c) (cherry picked from commit 8c4af53d7754737f6857c25820a256487c45e676) (cherry picked from commit 4efdf632bcafb65d9725e1077bb249529db40015) --- nova/exception.py | 2 +- nova/virt/libvirt/host.py | 2 +- nova/virt/libvirt/volume/mount.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/exception.py b/nova/exception.py index 85fe8f8b0f3e..4eb436b82744 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -462,7 +462,7 @@ class ComputeResourcesUnavailable(ServiceUnavailable): class HypervisorUnavailable(NovaException): - msg_fmt = _("Connection to the hypervisor is broken on host: %(host)s") + msg_fmt = _("Connection to the hypervisor is broken on host") class ComputeServiceUnavailable(ServiceUnavailable): diff --git a/nova/virt/libvirt/host.py b/nova/virt/libvirt/host.py index 10a7dabfa469..3a885d33cd19 100644 --- a/nova/virt/libvirt/host.py +++ b/nova/virt/libvirt/host.py @@ -457,7 +457,7 @@ class Host(object): rpc.get_notifier('compute').error(nova_context.get_admin_context(), 'compute.libvirt.error', payload) - raise exception.HypervisorUnavailable(host=CONF.host) + raise exception.HypervisorUnavailable() return conn diff --git a/nova/virt/libvirt/volume/mount.py b/nova/virt/libvirt/volume/mount.py index 476e9149324c..86ace4d5c6c0 100644 --- a/nova/virt/libvirt/volume/mount.py +++ b/nova/virt/libvirt/volume/mount.py @@ -84,7 +84,7 @@ class _HostMountStateManager(object): with self.cond: state = self.state if state is None: - raise exception.HypervisorUnavailable(host=CONF.host) + raise exception.HypervisorUnavailable() self.use_count += 1 try: