Bug 1532151

Summary: cannot run vm after upgrade to 4.2-beta - AttributeError: 'Element' object has no attribute '_elem'
Product: [oVirt] vdsm Reporter: Jiri Belka <jbelka>
Component: GeneralAssignee: Milan Zamazal <mzamazal>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.20.11CC: bugs, michal.skrivanek, mzamazal, pstehlik
Target Milestone: ovirt-4.2.1Keywords: Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
VMs with devices having custom properties couldn't be started from pre-4.2 Engine on hosts running oVirt 4.2. This has been fixed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-12 11:52:46 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 Jiri Belka 2018-01-08 07:46:01 UTC
Description of problem:

i can't run any VM on a host which was upgraded from 4.1 to 4.2 - still managed with 4.1.8 engine:

2018-01-08 08:37:50,749+0100 ERROR (vm/7dcb82ea) [virt.vm] (vmId='7dcb82ea-582e-47b1-8e9b-7c5a85d1b69e') The vm start process failed (vm:915)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line 844, in _startUnderlyingVm
    self._run()
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line 2729, in _run
    domxml = hooks.before_vm_start(self._buildDomainXML(),
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line 2189, in _buildDomainXML
    return self._make_domain_xml()
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line 2237, in _make_domain_xml
    domxml._devices.appendChild(element=dev)
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vmxml.py", line 395, in appendChild
    append_child(self._elem, element, etree_element)
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vmxml.py", line 237, in append_child
    element.append(child._elem)
AttributeError: 'Element' object has no attribute '_elem'
2018-01-08 08:37:50,754+0100 INFO  (vm/7dcb82ea) [virt.vm] (vmId='7dcb82ea-582e-47b1-8e9b-7c5a85d1b69e') Changed state to Down: 'Element' object has no attribute '_elem' (code=1) (vm:1634)
2018-01-08 08:37:50,759+0100 INFO  (vm/7dcb82ea) [virt.vm] (vmId='7dcb82ea-582e-47b1-8e9b-7c5a85d1b69e') Stopping connection (guestagent:438)

events (newest first):

Jan 8, 2018 8:37:54 AM
Failed to run VM jbelka-sles-01 (User: jbelka@redhat-authz).
e75bb1b7-5a1e-46d5-a561-2b74ed027705
oVirt

Jan 8, 2018 8:37:54 AM
Failed to run VM jbelka-sles-01 on Host slot-7c.
e75bb1b7-5a1e-46d5-a561-2b74ed027705
oVirt

Jan 8, 2018 8:37:54 AM
VM jbelka-sles-01 is down with error. Exit message: 'Element' object has no attribute '_elem'.
oVirt

Jan 8, 2018 8:37:47 AM
VM jbelka-sles-01 was started by jbelka@redhat-authz (Host: slot-7c).
e75bb1b7-5a1e-46d5-a561-2b74ed027705
oVirt

Version-Release number of selected component (if applicable):
ovirt-host-4.2.0-1.el7ev.x86_64
vdsm-4.20.11-1.el7ev.x86_64
libvirt-daemon-3.2.0-14.el7_4.7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.13.x86_64
iscsi-initiator-utils-6.2.0.874-4.el7.x86_64
kernel-3.10.0-693.11.6.el7.x86_64
redhat-release-server-7.4-18.el7.x86_64

engine - 4.1.8.2-0.1.el7

How reproducible:
100%

Steps to Reproduce:
1. have 4.1 env
2. upgrade a host to 4.2
3.

Actual results:
start of VMs fails with an exit message: 'Element' object has no attribute '_elem'.

Expected results:
should work

Additional info:

Comment 2 Jiri Belka 2018-01-08 08:58:30 UTC
downgrade to 4.1 vdsm caused VM start be successful.

# rpm -q vdsm ; virsh list
vdsm-4.19.43-3.el7ev.x86_64
 Id    Name                           State
----------------------------------------------------
 1     jbelka-sles-01                 running
 2     system-ge-host-6               running

Comment 3 Milan Zamazal 2018-01-08 10:12:51 UTC
The problem apparently appears when 
- not using Engine XML
and
- the VM has a device with custom properties (e.g. ifacemacspoof in a network interface).

I'm working on a fix.

Comment 4 Jiri Belka 2018-01-16 16:08:03 UTC
ok, vdsm-python-4.20.13-1.el7ev.noarch

vm with custom device property can be started on 4.2 host and migrated to such host without issues (using 4.1 engine).

Comment 5 Sandro Bonazzola 2018-02-12 11:52:46 UTC
This bugzilla is included in oVirt 4.2.1 release, published on Feb 12th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.1 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.