[ovirt-users] Hosted engine notifications don't work after upgrading ovirt from 3.5 to 3.6

Martin Sivak msivak at redhat.com
Wed Dec 16 10:43:10 UTC 2015


Hi Stefano,

we haven't touched the code for this, but I see that also. If you are
willing to experiment just a bit (it is revertable) you can apply the
attached patch to
/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/broker/notifications.py.
It seems to solve this for me.

diff --git a/ovirt_hosted_engine_ha/broker/notifications.py b/ovirt_hosted_engin
index 425822d..00e7e60 100644
--- a/ovirt_hosted_engine_ha/broker/notifications.py
+++ b/ovirt_hosted_engine_ha/broker/notifications.py
@@ -1,4 +1,4 @@
-from email.mime.text import MIMEText
+from email.parser import Parser
 from email.utils import formatdate
 import socket

@@ -24,7 +24,7 @@ def send_email(cfg, email_body):
         server = smtplib.SMTP(cfg["smtp-server"], port=cfg["smtp-port"])
         server.set_debuglevel(1)
         to_addresses = EMAIL_SPLIT_RE.split(cfg["destination-emails"].strip())
-        message = MIMEText(email_body)
+        message = Parser().parsestr(email_body)
         message["Date"] = formatdate(localtime=True)
         server.sendmail(cfg["source-email"],
                         to_addresses,

Then restart the ovirt-ha-broker service.

In any case, please open a new bug so we can properly fix it in the
nearest 3.6 update.

Regards

Martin Sivak


On Wed, Dec 16, 2015 at 10:26 AM, Stefano Danzi <s.danzi at hawai.it> wrote:
> Hello, there are a way to solve this?
>
>
>
> Il 09/11/2015 14.08, Stefano Danzi ha scritto:
>>
>> Hello,
>> I've made no changes than upgrading oVirt from 3.5 to 3.6
>> Distro is a standard CenOS 7.1
>>
>> Pyton is: python-2.7.5-18.el7_1.1.x86_64
>>
>> state_transition.txt hasn't an empty line as first line.
>>
>>
>>
>> Il 09/11/2015 13.32, Martin Sivak ha scritto:
>>>
>>> Btw, please check the template file
>>> (/etc/ovirt-hosted-engine-ha/notifications/state_transition.txt) and
>>> make sure it does not start with an empty line.
>>>
>>> Martin
>>>
>>> On Mon, Nov 9, 2015 at 1:25 PM, Martin Sivak <msivak at redhat.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> can you please tell us the Python version you are using? We are using
>>>> the smtplib and email.mime.text standard libraries to send emails so
>>>> this should not be our bug (unless the API changed).
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> Martin Sivak
>>>> SLA / oVirt
>>>>
>>>>
>>>> On Mon, Nov 9, 2015 at 1:11 PM, Sandro Bonazzola <sbonazzo at redhat.com>
>>>> wrote:
>>>>>
>>>>>
>>>>> On Mon, Nov 9, 2015 at 11:44 AM, Stefano Danzi <s.danzi at hawai.it>
>>>>> wrote:
>>>>>>
>>>>>> Your trick work fine! Thanks!
>>>>>>
>>>>>> Now I see that emails sent from brocker has "corrupted" headers:
>>>>>>
>>>>>> At the ent of message we can see:
>>>>>>
>>>>>> Content-Type: text/plain; charset="us-ascii"
>>>>>> MIME-Version: 1.0
>>>>>> Content-Transfer-Encoding: 7bit
>>>>>> Date: Mon, 09 Nov 2015 11:33:37 +0100
>>>>>> Message-Id: <20151109103337.D9C7D1260001 at my.server.lan>
>>>>>> From: mysender at server.lan
>>>>>> To: undisclosed-recipients:;
>>>>>>
>>>>>> From: mysender at server.lan
>>>>>> To: myreceiver at server.lan
>>>>>> Subject: ovirt-hosted-engine state transition
>>>>>> EngineUp-GlobalMaintenance
>>>>>>
>>>>>> The state machine changed state.
>>>>>>
>>>>>>
>>>>> Adding Roy and Martin, looks like a separate issue
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>  From and To are repeated twice. This cause that email client show
>>>>>> correctly the sender,
>>>>>> an empty recipient and an empty subject.
>>>>>>
>>>>>> On message body I see everything after "To: undisclosed-recipients:;"
>>>>>>
>>>>>> Il 06/11/2015 20.01, Simone Tiraboschi ha scritto:



More information about the Users mailing list