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.
Created attachment 1093279 [details] engine log
Created attachment 1093280 [details] vdsm log
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.
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.
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.