[PATCH v3 1/3] libvirt/conf - report OOM error in virDomainDiskInsert()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for review. This is v3.

==
>From 0757ef3ff30779b3a9a5a07959fff6ada9b68d61 Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa@bluextal.(none)>
Date: Thu, 24 Feb 2011 16:00:29 +0900
Subject: [PATCH 1/3] report OOMError in virDomainDiskInsert()

Now, virDomainDiskInsert() returns -1 at memory allocation
failure but it should call virReportOOMError() by itself.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c |    4 +++-
 src/xen/xm_internal.c  |    4 +---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b97c1f0..b4193b9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4857,8 +4857,10 @@ int virDomainDiskInsert(virDomainDefPtr def,
                         virDomainDiskDefPtr disk)
 {
 
-    if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
+    if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
+        virReportOOMError();
         return -1;
+    }
 
     virDomainDiskInsertPreAlloced(def, disk);
 
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 27cc387..c3c72fe 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1385,10 +1385,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
     switch (dev->type) {
     case VIR_DOMAIN_DEVICE_DISK:
     {
-        if (virDomainDiskInsert(def, dev->data.disk) < 0) {
-            virReportOOMError();
+        if (virDomainDiskInsert(def, dev->data.disk) < 0)
             goto cleanup;
-        }
         dev->data.disk = NULL;
     }
     break;
-- 
1.7.1


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]