Check config file for hostname

When sending an alert from the instancemonitor check the monitors
config file for the hostname before sending the alert.

Change-Id: If11aa1abb1142941d6dcd00c46063d9015644978
Closes-Bug: #1866638
This commit is contained in:
Liam Young 2020-03-09 17:10:59 +00:00 committed by Tushar Patil
parent 5f712ad968
commit 85dda1b0eb
1 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from oslo_log import log as oslo_logging
from oslo_utils import excutils
from oslo_utils import timeutils
import masakarimonitors.conf
from masakarimonitors.instancemonitor.libvirt_handler import callback
from masakarimonitors.instancemonitor.libvirt_handler \
import eventfilter_table as evft
@ -27,6 +28,7 @@ from masakarimonitors.objects import event_constants as ec
LOG = oslo_logging.getLogger(__name__)
CONF = masakarimonitors.conf.CONF
class EventFilter(object):
@ -45,7 +47,7 @@ class EventFilter(object):
"""
noticeType = ec.EventConstants.TYPE_VM
hostname = socket.gethostname()
hostname = CONF.hostname or socket.gethostname()
currentTime = timeutils.utcnow()
# All Event Output if debug mode is on.