Change in vdsm[master]: vmfex hook: hold a ref for a virDomain object
danken at redhat.com
danken at redhat.com
Sun Feb 7 12:41:49 UTC 2016
Dan Kenigsberg has uploaded a new change for review.
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
refernce circles. 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.
Change-Id: Ida7488db5f8af51da5a2931d8b8a6c51d99c36f0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1305338
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm_hooks/vmfex_dev/vmfex_vnic.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/53160/1
diff --git a/vdsm_hooks/vmfex_dev/vmfex_vnic.py b/vdsm_hooks/vmfex_dev/vmfex_vnic.py
index 780ebba..e54f0c6 100755
--- a/vdsm_hooks/vmfex_dev/vmfex_vnic.py
+++ b/vdsm_hooks/vmfex_dev/vmfex_vnic.py
@@ -81,8 +81,9 @@
def qbhInUse(conn):
"""Returns whether there is already some VM with a 802.1Qbh (most likely to
be vmfex)."""
- for vm in conn.listDomainsID():
- domxml = minidom.parseString(conn.lookupByID(vm).XMLDesc(0))
+ for vmid in conn.listDomainsID():
+ domobj = conn.lookupByID(vmid)
+ domxml = minidom.parseString(domobj.XMLDesc(0))
for vport in domxml.getElementsByTagName('virtualport'):
if vport.getAttribute('type') == '802.1Qbh':
return True
--
To view, visit https://gerrit.ovirt.org/53160
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida7488db5f8af51da5a2931d8b8a6c51d99c36f0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
More information about the vdsm-patches
mailing list