Bug 1127739

Summary: [vdsm] disk hotplug fails with a libvirtError when reactivating it
Product: [Retired] oVirt Reporter: Elad <ebenahar>
Component: vdsmAssignee: Liron Aravot <laravot>
Status: CLOSED NOTABUG QA Contact: Gil Klein <gklein>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5CC: acanan, acathrow, amureini, bazulay, bugs, ebenahar, ecohen, gklein, iheim, mgoldboi, scohen, yeylon
Target Milestone: ---Keywords: Triaged
Target Release: 3.5.0   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-08 15:31:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
logs from engine and vdsm none

Description Elad 2014-08-07 12:54:09 UTC
Created attachment 924901 [details]
logs from engine and vdsm

Description of problem:
Hotplug disk to a running VM fails with the following error message from libvirt:

Thread-13::DEBUG::2014-08-07 15:40:05,898::vm::3788::vm.Vm::(hotplugDisk) vmId=`07d86581-7a0d-413c-993d-4cd2024ff82f`::Hotplug disk xml: <disk device="disk" snapshot="no" type="file">
        <address bus="0x00" domain="0x0000" function="0x0" slot="0x06" type="pci"/>
        <source file="/rhev/data-center/dad5e45b-b776-43fb-b818-26fbf0f93732/1e0328e9-e426-4083-8cae-9132f593b030/images/aee37ae8-eb0f-47c4-b987-83ffb147661b/4b3b61f9-92fd-482e-8f55-a0d0110674cc"/>
        <target bus="virtio" dev="vdc"/>
        <serial>aee37ae8-eb0f-47c4-b987-83ffb147661b</serial>
        <driver cache="none" error_policy="stop" io="threads" name="qemu" type="raw"/>
</disk>

Thread-13::DEBUG::2014-08-07 15:40:05,923::libvirtconnection::143::root::(wrapper) Unknown libvirterror: ecode: 1 edom: 10 level: 2 message: internal error unable to execute QEMU command 'device_add': Device 'virt
io-blk-pci' could not be initialized
Thread-13::ERROR::2014-08-07 15:40:05,923::vm::3796::vm.Vm::(hotplugDisk) vmId=`07d86581-7a0d-413c-993d-4cd2024ff82f`::Hotplug failed
Traceback (most recent call last):
  File "/usr/share/vdsm/virt/vm.py", line 3794, in hotplugDisk
    self._dom.attachDevice(driveXml)
  File "/usr/share/vdsm/virt/vm.py", line 625, in f
    ret = attr(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/vdsm/libvirtconnection.py", line 111, 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 execute QEMU command 'device_add': Device 'virtio-blk-pci' could not be initialized


Version-Release number of selected component (if applicable):
ovirt-3.5-rc1
ovirt-engine-3.5.0-0.0.master.20140804172041.git23b558e.el6.noarch
vdsm-4.16.1-6.gita4a4614.el6.x86_64
libvirt-0.10.2-29.el6_5.10.x86_64
qemu-kvm-rhev-0.12.1.2-2.415.el6_5.14.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create a VM with 2 disks plugged to it
2. Start the VM
3. Deactivate 1 of the disks
4. Activate the disk

Actual results:
The hotplug operation fails with the mentioned error

Expected results:
Hotplug disk should work

Additional info:
logs from engine and vdsm

Comment 1 Allon Mureinik 2014-08-07 13:38:34 UTC
Elad, do you have a guest OS installed?

Comment 2 Elad 2014-08-07 14:52:18 UTC
(In reply to Allon Mureinik from comment #1)
> Elad, do you have a guest OS installed?

Hotplug disk succeeds in case there is an OS installed

Comment 3 Allon Mureinik 2014-08-08 15:31:17 UTC
(In reply to Elad from comment #2)
> (In reply to Allon Mureinik from comment #1)
> > Elad, do you have a guest OS installed?
> 
> Hotplug disk succeeds in case there is an OS installed

Hotplug relies on the underlying guest OS support to complete properly. The fact that it works with an OS installed proves there's no problem in VDSM's flow itself - closing.