Change in vdsm[ovirt-3.5]: vmfex hook: hold a ref for a virDomain object

danken at redhat.com danken at redhat.com
Mon Feb 8 13:32:18 UTC 2016


Dan Kenigsberg has submitted this change and it was merged.

Change subject: vmfex hook: hold a ref for a virDomain object
......................................................................


vmfex hook: hold a ref for a virDomain object

commit 93feb1c introduced a weakref to virDomain object to avoid
reference cycles. This causes a surprising behaviour: if we do not hold
a reference to virdomain.Notifying, the underlying virDomain is
garbage-collected before being accessed for the first time.

This patch quickly holds a named reference to the domain. I did not find
other pieces of code with the same problem, however, the mechanism seems
dangerously error-prone.

This bug is easily reproduced with

    from vdsm import libvirtconnection
    c = libvirtconnection.get()
    print(c.lookupByName('my-vm').XMLDesc(0))

and "solved" by

    from vdsm import libvirtconnection
    c = libvirtconnection.get()
    v = c.lookupByName('my-vm')
    print(v.XMLDesc(0))

Change-Id: Ida7488db5f8af51da5a2931d8b8a6c51d99c36f0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1305338
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/53160
Reviewed-on: https://gerrit.ovirt.org/53203
Reviewed-by: Francesco Romani <fromani at redhat.com>
---
M vdsm_hooks/vmfex_dev/vmfex_vnic.py
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Dan Kenigsberg: Verified; Passed CI tests
  Francesco Romani: Looks good to me, approved



-- 
To view, visit https://gerrit.ovirt.org/53203
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ida7488db5f8af51da5a2931d8b8a6c51d99c36f0
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list