Bug 1281428 - Hostdev_passthrough: Template creation should not include attached VM devices.
Summary: Hostdev_passthrough: Template creation should not include attached VM devices.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Virt
Version: 3.6.0.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-3.6.3
: 3.6.3
Assignee: Martin Betak
QA Contact: Nisim Simsolo
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-12 13:59 UTC by Nisim Simsolo
Modified: 2016-02-18 11:06 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-18 11:06:20 UTC
oVirt Team: Virt
Embargoed:
rule-engine: ovirt-3.6.z+
rule-engine: planning_ack+
michal.skrivanek: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)
engine log (2.31 MB, text/plain)
2015-11-12 14:00 UTC, Nisim Simsolo
no flags Details
vdsm log (10.11 MB, text/plain)
2015-11-12 14:01 UTC, Nisim Simsolo
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 52373 0 master MERGED utils: Remove extra parameters in copyVmDevices 2016-01-20 11:20:22 UTC
oVirt gerrit 52374 0 master MERGED core: Prevent host device copy on pinned host mismatch 2016-01-20 12:36:56 UTC
oVirt gerrit 52492 0 ovirt-engine-3.6 MERGED utils: Remove extra parameters in copyVmDevices 2016-01-26 16:14:31 UTC
oVirt gerrit 52493 0 ovirt-engine-3.6 MERGED core: Prevent host device copy on pinned host mismatch 2016-01-26 16:15:18 UTC

Description Nisim Simsolo 2015-11-12 13:59:39 UTC
Description of problem:
- Currently, when creating a template from VM with host device attached, the template includes the source VM attached devices.
- Trying to run VM created from this template on a different host, failed with: "VM is down with error. Exit message: Node device not found: no node device with matching name 'usb_1_11'." for example.
- Issue is relevant also for exporting template and then creating a VM from this template on a different cluster or DC.
- It is also possible to create VM using this template from user portal, which according to feature page, user portal should not have any touch with hostdev_passthrough.

Version-Release number of selected component (if applicable):
rhevm-3.6.0.3-0.1.el6 (3.6.0-18)
libvirt-client-1.2.17-5.el7.x86_64
sanlock-3.2.4-1.el7.x86_64
vdsm-4.17.10.1-0.el7ev.noarch
qemu-kvm-rhev-2.3.0-31.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create VM and attach some host devices to VM.
2. Power off VM. Create template from this VM.
3. Create VM from this template on a different host. 
4. Try to run VM.

Actual results:
- VM failed to run with the next error message:
"VM is down with error. Exit message: Node device not found: no node device with matching name 'usb_1_11'."
- Observing engine DB, shows that source VM host devices, are attached to new VM from:

engine=# select * from vm_device where vm_id='26fc68af-6431-4885-aec9-e85720214650';
              device_id               |                vm_id                 |    type    |      device      |                           address                            | boot_order |   
 spec_params     | is_managed | is_plugged | is_readonly |         _create_date         |         _update_date         |     alias      | custom_properties | snapshot_id | logical_name | is
_using_scsi_reservation 
--------------------------------------+--------------------------------------+------------+------------------+--------------------------------------------------------------+------------+---
-----------------+------------+------------+-------------+------------------------------+------------------------------+----------------+-------------------+-------------+--------------+---
------------------------
 89e4f068-8b3e-473f-b06c-030c1c39a439 | 26fc68af-6431-4885-aec9-e85720214650 | hostdev    | usb_1_11         |                                                              |          0 | { 
}                | t          | f          | f           | 2015-11-11 14:44:18.91275+02 | 2015-11-11 14:44:18.91275+02 |                | { }               |             |              | f



Expected results:
Template creation should not include host devices attached to source VM.

Additional info:
engine and vdsm logs attached.

Comment 1 Nisim Simsolo 2015-11-12 14:00:30 UTC
Created attachment 1093279 [details]
engine log

Comment 2 Nisim Simsolo 2015-11-12 14:01:37 UTC
Created attachment 1093280 [details]
vdsm log

Comment 3 Red Hat Bugzilla Rules Engine 2015-12-15 12:31:41 UTC
Bug tickets must have version flags set prior to targeting them to a release. Please ask maintainer to set the correct version flags and only then set the target milestone.

Comment 4 Marek Libra 2016-01-06 08:50:18 UTC
By adding hostdev to a VM, the VM is pinned to the particular host.
Subsequently created template stays pinned to the host and so do the VMs created from the template.

If the user explicitly repin the VM to a different host, the new host has to have same devices.
Avoiding copy of hostdevices when making a template is loosing functionality from my perspective.

The 'Start Running On' radioboxes in Add/Edit VM dialog can be enhanced for information that the VM has hostdevices and so the user should check devices on the new host.

Comment 5 Nisim Simsolo 2016-02-03 10:08:51 UTC
Verified using build: 
rhevm-3.6.3-0.1.el6
libvirt-client-1.2.17-13.el7_2.2.x86_64
qemu-kvm-rhev-2.3.0-31.el7_2.4.x86_64
vdsm-4.17.19-0.el7ev.noarch
sanlock-3.2.4-1.el7.x86_64

Verification scenario: 
1. Attach host PCI and USB devices to VM1.
2. Make template from VM1.
3. Create VM (VM2) from template on a different host.
4. verify no devices attached to VM2 by querying engine DB for vm_device.
5. Run VM2.
6. Verify VM2 is running properly. verify no USB and PCI host devices attached to this VM.
7. Power off VM2 and attach host PCI and USB devices to it. 
8. Run VM and verify host devices attached.


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