Bug 1250363

Summary: HostDeviceManager allocates devices on unrelated hosts
Product: [oVirt] ovirt-engine Reporter: Martin Betak <mbetak>
Component: GeneralAssignee: Martin Betak <mbetak>
Status: CLOSED CURRENTRELEASE QA Contact: Nisim Simsolo <nsimsolo>
Severity: medium Docs Contact:
Priority: medium    
Version: ---CC: bugs, gklein, lsurette, mavital, michal.skrivanek, nsimsolo, rbalakri, yeylon, ykaul
Target Milestone: ovirt-3.6.0-rcFlags: rule-engine: ovirt-3.6.0+
ylavi: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.6.0-10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-23 09:02:06 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:

Description Martin Betak 2015-08-05 08:51:23 UTC
Description of problem:

MarkHostDevicesUsedByVmId stored procedure (invoked by HostDeviceManager) looked only on device name when marking the appropriate host devices in DB. This could potentially result (when having device of same name on more than 1 host) in additional allocation of unrelated host devices with given name on all hosts.

Version-Release number of selected component (if applicable):
ovirt-engine-3.6

How reproducible:
Difficult. Have to have pass-through-able devices on at least two hosts with the same device_name.

Steps to Reproduce:
1. Configure host device with given name for a VM
2. Run the VM (should run successfully)
3. check host_device table in DB which host devices have set vm_id to that of the running VM

Actual results:
More than the host_device (belonging to the VM's pinned host) has the vm_id set
to that of the running VM.

Expected results:
Only host devices belonging to VM's (unique) pinned host should be marked with vm_id.

Comment 1 Nisim Simsolo 2016-02-22 14:44:56 UTC
Verified: 
rhevm-3.6.3.2-0.1.el6
libvirt-client-1.2.17-13.el7_2.2.x86_64
vdsm-4.17.21-0.el7ev.noarch
qemu-kvm-rhev-2.3.0-31.el7_2.4.x86_64
sanlock-3.2.4-1.el7.x86_64

Verification scenario:
1. Use 2 hosts that support passthrough.
2. Browse webadmin --> hosts tab --> select host --> host devices tab, find PCI device with an equal name to the second host PCI name (for example pci_0003_03_00_0).
3. Attach the first host PCI device to VM and run VM.
4. Verify VM is running with PCI device attached.
5. Observe engine DB --> host_device table, verify that this device only is allocated to the first host only (actually the verification is to validate that identical PCI ID is not attached to the second host also because of the name duplication)