Bug 1281428 - Hostdev_passthrough: Template creation should not include attached VM devices.
Hostdev_passthrough: Template creation should not include attached VM devices.
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: BLL.Virt (Show other bugs)
3.6.0.2
Unspecified Unspecified
unspecified Severity high (vote)
: ovirt-3.6.3
: 3.6.3
Assigned To: Martin Betak
Nisim Simsolo
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-12 08:59 EST by Nisim Simsolo
Modified: 2016-02-18 06:06 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-18 06:06:20 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
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 09:00 EST, Nisim Simsolo
no flags Details
vdsm log (10.11 MB, text/plain)
2015-11-12 09:01 EST, Nisim Simsolo
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 52373 master MERGED utils: Remove extra parameters in copyVmDevices 2016-01-20 06:20 EST
oVirt gerrit 52374 master MERGED core: Prevent host device copy on pinned host mismatch 2016-01-20 07:36 EST
oVirt gerrit 52492 ovirt-engine-3.6 MERGED utils: Remove extra parameters in copyVmDevices 2016-01-26 11:14 EST
oVirt gerrit 52493 ovirt-engine-3.6 MERGED core: Prevent host device copy on pinned host mismatch 2016-01-26 11:15 EST

  None (edit)
Description Nisim Simsolo 2015-11-12 08:59:39 EST
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 09:00 EST
Created attachment 1093279 [details]
engine log
Comment 2 Nisim Simsolo 2015-11-12 09:01 EST
Created attachment 1093280 [details]
vdsm log
Comment 3 Red Hat Bugzilla Rules Engine 2015-12-15 07:31:41 EST
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 03:50:18 EST
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 05:08:51 EST
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.