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

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

 



On Fri, 25 Feb 2011 15:07:50 +0800
Hu Tao <hutao@xxxxxxxxxxxxxx> wrote:

> ACK with email address fixed at From: field.
> 
Ah, yes. I didn't configure this host's git...

==
>From 756eaa4230ab5fc8bbfb1b02a24b34dedad473b2 Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Date: Fri, 25 Feb 2011 17:13:28 +0900
Subject: [PATCH 1/4] 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.4.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]