Bug 988050 - Hotplug disk fails in case a hook file is a binary, executable file
Hotplug disk fails in case a hook file is a binary, executable file
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: vdsm (Show other bugs)
3.3.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.3.0
Assigned To: Maor
Aharon Canan
storage
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-24 11:37 EDT by Katarzyna Jachim
Modified: 2016-02-10 15:26 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-02 11:28:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
amureini: Triaged+


Attachments (Terms of Use)
vdsm.log (6.09 MB, text/x-log)
2013-07-24 11:37 EDT, Katarzyna Jachim
no flags Details

  None (edit)
Description Katarzyna Jachim 2013-07-24 11:37:48 EDT
Created attachment 777844 [details]
vdsm.log

Description of problem:
If you put a binary, executable file into after_disk_hotplug or before_disk_hotplug hook directory, hotplug will fail:

Thread-1837::DEBUG::2013-07-24 17:25:42,344::utils::486::root::(execCmd) '/usr/libexec/vdsm/hooks/after_disk_hotplug/kjachim.jpg
' (cwd None)
Thread-1837::DEBUG::2013-07-24 17:25:42,388::utils::505::root::(execCmd) FAILED: <err> = '/usr/libexec/vdsm/hooks/after_disk_hot
plug/kjachim.jpg: /usr/libexec/vdsm/hooks/after_disk_hotplug/kjachim.jpg: cannot execute binary file\n'; <rc> = 126
Thread-1837::INFO::2013-07-24 17:25:42,389::hooks::88::root::(_runHooksDir) /usr/libexec/vdsm/hooks/after_disk_hotplug/kjachim.jpg: /usr/libexec/vdsm/hooks/after_disk_hotplug/kjachim.jpg: cannot execute binary file

Thread-1837::WARNING::2013-07-24 17:25:42,389::hooks::95::root::(_runHooksDir) hook returned unexpected return code 126
Thread-1837::ERROR::2013-07-24 17:25:42,390::BindingXMLRPC::998::vds::(wrapper) unexpected error
Traceback (most recent call last):
  File "/usr/share/vdsm/BindingXMLRPC.py", line 984, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/BindingXMLRPC.py", line 268, in vmHotplugDisk
    return vm.hotplugDisk(params)
  File "/usr/share/vdsm/API.py", line 431, in hotplugDisk
    return curVm.hotplugDisk(params)
  File "/usr/share/vdsm/vm.py", line 3245, in hotplugDisk
    params=customProps)
  File "/usr/share/vdsm/hooks.py", line 284, in after_disk_hotplug
    params=params)
  File "/usr/share/vdsm/hooks.py", line 98, in _runHooksDir
    raise HookError()
HookError

It works correctly if the file is not executable.

Version-Release number of selected component (if applicable): is6


How reproducible: 100%


Steps to Reproduce:
1. copy a jpeg file to /usr/libexec/vdsm/hooks/after_disk_hotplug
2. change its permissions to 755
3. try to hotplug a disk

Actual results:
An error is raised and disk is not plugged. Moreover, the system is in an incorrect state, even after removing the problematic hook you cannot hotplug the same disk, it fails with following error:

Thread-1992::DEBUG::2013-07-24 17:31:26,275::libvirtconnection::101::libvirtconnection::(wrapper) Unknown libvirterror: ecode: 1
 edom: 10 level: 2 message: internal error unable to reserve PCI address 0:0:11.0
Thread-1992::ERROR::2013-07-24 17:31:26,275::vm::3227::vm.Vm::(hotplugDisk) vmId=`d52f0ab3-b24a-473a-8d0a-6610c74e23d9`::Hotplug failed
Traceback (most recent call last):
  File "/usr/share/vdsm/vm.py", line 3225, in hotplugDisk
    self._dom.attachDevice(driveXml)
  File "/usr/share/vdsm/vm.py", line 824, in f
    ret = attr(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/vdsm/libvirtconnection.py", line 76, in wrapper
    ret = f(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 399, in attachDevice
    if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
libvirtError: internal error unable to reserve PCI address 0:0:11.0


Expected results:
Disk should be plugged.

Additional info:
Comment 3 Ayal Baron 2013-09-02 11:28:58 EDT
This is generic hooks behaviour.
The mechanism takes all the *executable* files in the relevant hooks dir and runs them one by one.

Note You need to log in before you can comment on or make changes to this bug.