Skip to contentSkip to conversation

XendAPIStore - do not remove non-existent item

PATCH New Jim Fehlig 1 participant 1 message Feb 3, 2009

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

PATCH 1/1 XendAPIStore - do not remove non-existent item

If list is searched and item not found, then don't attempt to delete the item.

I've seen this bug manifest as

xen81:~/bin # xm li
Name ID Mem VCPUs State Time(s)

Domain-0                                     0  3151    16     r-----   1240.8
pxe                                          3   256     1     -b----     26.4

xen81:~/bin # xm des 3
Error: ('d59cd309-80cd-66b3-d4f3-cff439eadc8a', 'VM_metrics')
Usage: xm destroy <Domain>

Terminate a domain immediately.

I'm not sure why this vm had no metrics object associated with it but nonetheless I don't think we should be throwing exceptions by removing non-existent objects from XendAPIStore.

tools/python/xen/xend/XendAPIStore.py +2 -1
Index: xen-3.3.1-testing/tools/python/xen/xend/XendAPIStore.py
===================================================================
@@ -33,7 +33,8 @@ def register(uuid, type, inst):
 
 def deregister(uuid, type):
     old = get(uuid, type)
-    del __classes[(uuid, type)]
+    if old is not None:
+        del __classes[(uuid, type)]
     return old
 
 def get(uuid, type):

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel