Bug 1546967

Summary: [4.1.10 clone] Call vdsm 'after_vm_pause' hooks when the VM has been paused because an I/O Error
Product: Red Hat Enterprise Virtualization Manager Reporter: Michal Skrivanek <michal.skrivanek>
Component: vdsmAssignee: Milan Zamazal <mzamazal>
Status: CLOSED ERRATA QA Contact: Polina <pagranat>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: bgraveno, bugs, lsurette, lveyde, michal.skrivanek, mkalinin, mmartinv, mtessun, pagranat, ratamir, srevivo, ycui, ykaul, ylavi
Target Milestone: ovirt-4.1.10Keywords: ZStream
Target Release: ---Flags: lsvaty: testing_plan_complete-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
This update fixes an issue where 'after_vm_pause' VDSM hooks were not executed after I/O errors.
Story Points: ---
Clone Of: 1543103 Environment:
Last Closed: 2018-03-20 16:38:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1543103    
Bug Blocks: 1540548    

Comment 2 RHV bug bot 2018-02-22 16:02:10 UTC
WARN: Bug status wasn't changed from MODIFIED to ON_QA due to the following reason:

[Found non-acked flags: '{'rhevm-4.1.z': '?'}', ]

For more info please contact: rhv-devops: Bug status wasn't changed from MODIFIED to ON_QA due to the following reason:

[Found non-acked flags: '{'rhevm-4.1.z': '?'}', ]

For more info please contact: rhv-devops

Comment 3 RHV bug bot 2018-02-22 16:07:53 UTC
WARN: Bug status wasn't changed from MODIFIED to ON_QA due to the following reason:

[Found non-acked flags: '{'rhevm-4.1.z': '?'}', ]

For more info please contact: rhv-devops: Bug status wasn't changed from MODIFIED to ON_QA due to the following reason:

[Found non-acked flags: '{'rhevm-4.1.z': '?'}', ]

For more info please contact: rhv-devops

Comment 5 Polina 2018-03-05 12:23:12 UTC
the verification test performed on rhv-release-4.1.10-4-001.noarch.

the hook installed in /usr/libexec/vdsm/hooks/after_vm_pause and seen in Admin Portal under HostHooks.
just some simple python file (permission 755).

In vdsm.log there is no even attempt to execute (like it is in 4.2).

#!/usr/bin/python

import os

d = os.path.dirname(__file__) # directory of script
p = r'{}/results/hook_test'.format(d) # path to be created

try:
    os.makedirs(p)
except OSError:
    pass

Comment 6 Miguel Martin 2018-03-05 12:53:09 UTC
Maybe I am wrong but vdsm version must be 4.19.47 or later, could you please verify this in your environment?

Comment 7 Michal Skrivanek 2018-03-09 09:38:38 UTC
Miguel, did it work for you on RHEL 7.4 libvirt?
The vdsm version in that internal build should be 4.19.48, containing the fix.

Polina, attach vdsm logs and versions of libvirt pkgs.

Comment 8 Miguel Martin 2018-03-09 11:32:39 UTC
Michal, I have not tested it, I just looked into the git repo and saw the tags containing the required change and then suggested Polina to check vdsm minimum required version accordingly.

Comment 9 Milan Zamazal 2018-03-09 14:04:18 UTC
I checked again that it works for me with Vdsm 4.19.49 and libvirt 3.2.0-14.el7_4.7.x86_64.

Polina, could you please check that:

- You have DEBUG log messages enabled in order to see the hook invocation in vdsm.log.
- Your hook works as expected.

It's not a good idea to silently swallow os.makedirs(p) exceptions in the hook; it's better to report errors somewhere, e.g.:

  except OSError as e:
      open("/tmp/after_vm_pause_failure", 'a').write('oops: %s\n' % (e,))

On my system, your hook produces the following error:

  [Errno 13] Permission denied: '/usr/libexec/vdsm/hooks/after_vm_pause/results'

I used a simpler version of the hook in my testing:

  #!/bin/sh
  touch /tmp/after_vm_pause_activated

If you checked your setup as suggested above and it still doesn't work, please provide the information requested by Michal.

Comment 10 Polina 2018-03-09 20:09:06 UTC
it was tested on latest build BUILD VERSION: 4.1.10-4 which contains vdsm-4.19.48-1.el7ev.x86_64. 

If the feature is only supposed to work from vdsm-4.19.49, I'll re-check on the last release BUILD VERSION: 4.1.10-5 and update the BZ with the info .

Comment 11 Polina 2018-03-12 08:18:40 UTC
verified in BUILD VERSION: 4.1.10-5 & vdsm-4.19.49

2018-03-12 10:07:00,360+0200 DEBUG (libvirt/events) [root] /usr/bin/taskset --cpu-list 0-3 /usr/libexec/vdsm/hooks/after_vm_pause/50_test_hook (cwd None) (commands:69)
2018-03-12 10:07:00,374+0200 DEBUG (event/31) [storage.Event.storage.DomainMonitor.onDomainStateChange] Emitting event (misc:514)
2018-03-12 10:07:00,376+0200 DEBUG (event/30) [storage.Event.storage.DomainMonitor.onDomainStateChange] Calling registered method `_domainStateChange` (misc:524)
2018-03-12 10:07:00,377+0200 DEBUG (event/33) [storage.Event.storage.DomainMonitor.onDomainStateChange] Emitting event (misc:514)
2018-03-12 10:07:00,378+0200 DEBUG (libvirt/events) [root] SUCCESS: <err> = ''; <rc> = 0 (commands:93)

Comment 14 errata-xmlrpc 2018-03-20 16:38:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0563

Comment 15 Franta Kust 2019-05-16 13:09:46 UTC
BZ<2>Jira Resync

Comment 16 Daniel Gur 2019-08-28 13:15:27 UTC
sync2jira

Comment 17 Daniel Gur 2019-08-28 13:21:14 UTC
sync2jira