]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remove no longer needed calls to virReportOOMError
authorChristophe Fergeau <teuf@gnome.org>
Thu, 17 Feb 2011 21:14:58 +0000 (22:14 +0100)
committerEric Blake <eblake@redhat.com>
Thu, 17 Feb 2011 23:59:14 +0000 (16:59 -0700)
Now that the virHash handling functions call virReportOOMError by
themselves when needed, users of the virHash API no longer need to
do it by themselves. Since users of the virHash API were not
consistently calling virReportOOMError after memory failures from
the virHash code, this has the added benefit of making OOM
reporting from this code more consistent and reliable.

src/conf/domain_conf.c
src/conf/nwfilter_conf.c
src/conf/nwfilter_params.c
src/nwfilter/nwfilter_gentech_driver.c
src/nwfilter/nwfilter_learnipaddr.c
src/openvz/openvz_conf.c
src/qemu/qemu_command.c
src/qemu/qemu_process.c

index 01a5b2ce2c60b113d3d6c473dc14417e52ae0561..351daf76838954619a26862712274b38992ac194 100644 (file)
@@ -394,10 +394,8 @@ VIR_ENUM_IMPL(virDomainTimerMode, VIR_DOMAIN_TIMER_MODE_LAST,
 int virDomainObjListInit(virDomainObjListPtr doms)
 {
     doms->objs = virHashCreate(50);
-    if (!doms->objs) {
-        virReportOOMError();
+    if (!doms->objs)
         return -1;
-    }
     return 0;
 }
 
@@ -1061,7 +1059,6 @@ virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
     virUUIDFormat(def->uuid, uuidstr);
     if (virHashAddEntry(doms->objs, uuidstr, domain) < 0) {
         VIR_FREE(domain);
-        virReportOOMError();
         return NULL;
     }
 
@@ -8189,10 +8186,8 @@ static virDomainObjPtr virDomainLoadStatus(virCapsPtr caps,
         goto error;
     }
 
-    if (virHashAddEntry(doms->objs, uuidstr, obj) < 0) {
-        virReportOOMError();
+    if (virHashAddEntry(doms->objs, uuidstr, obj) < 0)
         goto error;
-    }
 
     if (notify)
         (*notify)(obj, 1, opaque);
@@ -8750,7 +8745,6 @@ virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr s
 
     if (virHashAddEntry(snapshots->objs, snap->def->name, snap) < 0) {
         VIR_FREE(snap);
-        virReportOOMError();
         return NULL;
     }
 
@@ -8761,10 +8755,8 @@ virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr s
 int virDomainSnapshotObjListInit(virDomainSnapshotObjListPtr snapshots)
 {
     snapshots->objs = virHashCreate(50);
-    if (!snapshots->objs) {
-        virReportOOMError();
+    if (!snapshots->objs)
         return -1;
-    }
     return 0;
 }
 
@@ -9053,10 +9045,8 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
                                  _("could not close file %s"),
                                  path);
 
-        if (virHashAddEntry(paths, path, (void*)0x1) < 0) {
-            virReportOOMError();
+        if (virHashAddEntry(paths, path, (void*)0x1) < 0)
             goto cleanup;
-        }
 
         depth++;
         nextpath = meta.backingStore;
index a5703cb8b71ec2b0fe7c6d60956c0056ae26b0a9..c6a4d6f6d75a52c3f2353ea1edcb7cc94b4fee34 100644 (file)
@@ -2300,10 +2300,8 @@ virNWFilterTriggerVMFilterRebuild(virConnectPtr conn)
         .skipInterfaces = virHashCreate(0),
     };
 
-    if (!cb.skipInterfaces) {
-        virReportOOMError();
+    if (!cb.skipInterfaces)
         return 1;
-    }
 
     for (i = 0; i < nCallbackDriver; i++) {
         callbackDrvArray[i]->vmFilterRebuild(conn,
index 7a5938745b547a2e4db0c30aca9df6ee3a526cf6..23423fa8eabfc5b75045605e6babfa5ec2346c47 100644 (file)
@@ -121,7 +121,6 @@ virNWFilterHashTableCreate(int n) {
     }
     ret->hashTable = virHashCreate(n);
     if (!ret->hashTable) {
-        virReportOOMError();
         VIR_FREE(ret);
         return NULL;
     }
index 9ef36925e1da1b9b3c3b88aa216101d376c8035b..d81aac8bb39fa91c2d4f674e51b2a50b115fb028 100644 (file)
@@ -1037,8 +1037,6 @@ virNWFilterDomainFWUpdateCB(void *payload,
                         cb->err = virHashAddEntry(cb->skipInterfaces,
                                                   net->ifname,
                                                   (void *)~0);
-                        if (cb->err)
-                            virReportOOMError();
                     }
                     break;
 
index c5934816313c14d8a5426ea4b86b86201f39d6c6..02af9188b186adffd94afd54cd3cb8202a9ca985 100644 (file)
@@ -165,7 +165,6 @@ virNWFilterLockIface(const char *ifname) {
         }
 
         while (virHashAddEntry(ifaceLockMap, ifname, ifaceLock)) {
-            virReportOOMError();
             VIR_FREE(ifaceLock);
             goto err_exit;
         }
@@ -825,7 +824,6 @@ virNWFilterLearnInit(void) {
 
     pendingLearnReq = virHashCreate(0);
     if (!pendingLearnReq) {
-        virReportOOMError();
         return 1;
     }
 
@@ -848,7 +846,6 @@ virNWFilterLearnInit(void) {
 
     ifaceLockMap = virHashCreate(0);
     if (!ifaceLockMap) {
-        virReportOOMError();
         virNWFilterLearnShutdown();
         return 1;
     }
index dae66a5c27885d190edad044e992332d049e00a4..0eb5ab30755b869e52cc0a546b2bb92a3d8ea579 100644 (file)
@@ -526,7 +526,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
 
         virUUIDFormat(dom->def->uuid, uuidstr);
         if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0)
-            goto no_memory;
+            goto cleanup;
 
         virDomainObjUnlock(dom);
         dom = NULL;
index 618d3a97d453409f902e1c1f3511200dcc135750..c9feb9b0b7ae7301f2bfd6e5e7c83e9a092401f3 100644 (file)
@@ -753,7 +753,7 @@ qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def)
         goto no_memory;
 
     if (!(addrs->used = virHashCreate(10)))
-        goto no_memory;
+        goto error;
 
     if (virDomainDeviceInfoIterate(def, qemuCollectPCIAddress, addrs) < 0)
         goto error;
index 46da600a9986a63c75b5721440762de6f0382648..5237e2b08a0893a3cce98c1020c4f4a6352260d3 100644 (file)
@@ -995,10 +995,8 @@ qemuProcessWaitForMonitor(struct qemud_driver* driver,
      * Note that the monitor itself can be on a pty, so we still need to try the
      * log output method. */
     paths = virHashCreate(0);
-    if (paths == NULL) {
-        virReportOOMError();
+    if (paths == NULL)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
     qemuDomainObjPrivatePtr priv = vm->privateData;