Cloud plugin always generate communication with 169.254.169.254, even if the plugin is disabled #3316

This commit is contained in:
nicolargo 2025-10-18 10:52:18 +02:00
parent 6fc887839e
commit a41a67edf7
1 changed files with 5 additions and 2 deletions

View File

@ -52,6 +52,8 @@ class CloudPlugin(GlancesPluginModel):
self.reset()
# Enable threads only if the plugin is enabled
self.OPENSTACK = None
self.OPENSTACKEC2 = None
if self.is_enabled():
# Init thread to grab OpenStack stats asynchronously
self.OPENSTACK = ThreadOpenStack()
@ -63,8 +65,9 @@ class CloudPlugin(GlancesPluginModel):
def exit(self):
"""Overwrite the exit method to close threads."""
if self.is_enabled():
if self.OPENSTACK:
self.OPENSTACK.stop()
if self.OPENSTACKEC2:
self.OPENSTACKEC2.stop()
# Call the father class
super().exit()
@ -84,7 +87,7 @@ class CloudPlugin(GlancesPluginModel):
return stats
# Update the stats
if self.input_method == 'local':
if self.input_method == 'local' and (self.OPENSTACK or self.OPENSTACKEC2):
stats = self.OPENSTACK.stats
if not stats:
stats = self.OPENSTACKEC2.stats