Re: [PATCH] storage: fix build with iscsi

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

 



On 04/30/2012 10:50 AM, Stefan Berger wrote:
> On 04/30/2012 12:38 PM, Eric Blake wrote:
>> The previous storage patch missed an instance affected by the struct
>> member rename.
>>
> 
>> @@ -589,11 +589,13 @@
>> virStorageBackendISCSIFindPoolSources(virConnectPtr conn
>> ATTRIBUTE_UNUSED,
>>       }
>>
>>       for (i = 0 ; i<  ntargets ; i++) {
>> -        if (VIR_ALLOC_N(list.sources[i].devices, 1)<  0) {
>> +        if (VIR_ALLOC_N(list.sources[i].devices, 1)<  0 ||
>> +            VIR_ALLOC_N(list.sources[i].hosts, 1)) {
> 
> Nit: '< 0'.

Not only that, but 'make check' still fails, due to some bad indentation
in the output.  Here's what I'm really pushing, after further testing.

From 29e702e57698699cecb7067deb44d0d078e4172e Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@xxxxxxxxxx>
Date: Mon, 30 Apr 2012 10:36:44 -0600
Subject: [PATCH] storage: fix build with iscsi

The previous storage patch missed an instance affected by the struct
member rename.  It also had some botched whitespace detected by
'make check'.

* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIFindPoolSources): Adjust to new struct.
* src/conf/storage_conf.c (virStoragePoolSourceFormat): Fix
indentation.
---
 src/conf/storage_conf.c             |    2 +-
 src/storage/storage_backend_iscsi.c |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3b7879f..0b34f28 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -825,7 +825,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
     virBufferAddLit(buf,"  <source>\n");
     if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) && src->nhost) {
         for (i = 0; i < src->nhost; i++) {
-            virBufferAsprintf(buf, " <host name='%s'", src->hosts[i].name);
+            virBufferAsprintf(buf, "    <host name='%s'",
src->hosts[i].name);
             if (src->hosts[i].port)
                 virBufferAsprintf(buf, " port='%d'", src->hosts[i].port);
             virBufferAddLit(buf, "/>\n");
diff --git a/src/storage/storage_backend_iscsi.c
b/src/storage/storage_backend_iscsi.c
index 22a34af..e286c84 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -1,7 +1,7 @@
 /*
  * storage_backend_iscsi.c: storage backend for iSCSI handling
  *
- * Copyright (C) 2007-2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2008, 2010-2012 Red Hat, Inc.
  * Copyright (C) 2007-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -589,11 +589,13 @@
virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
     }

     for (i = 0 ; i < ntargets ; i++) {
-        if (VIR_ALLOC_N(list.sources[i].devices, 1) < 0) {
+        if (VIR_ALLOC_N(list.sources[i].devices, 1) < 0 ||
+            VIR_ALLOC_N(list.sources[i].hosts, 1) < 0) {
             virReportOOMError();
             goto cleanup;
         }
-        list.sources[i].host = source->hosts[0];
+        list.sources[i].nhost = 1;
+        list.sources[i].hosts[0] = source->hosts[0];
         list.sources[i].initiator = source->initiator;
         list.sources[i].ndevice = 1;
         list.sources[i].devices[0].path = targets[i];
@@ -607,8 +609,10 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr
conn ATTRIBUTE_UNUSED,

 cleanup:
     if (list.sources) {
-        for (i = 0 ; i < ntargets ; i++)
+        for (i = 0 ; i < ntargets ; i++) {
+            VIR_FREE(list.sources[i].hosts);
             VIR_FREE(list.sources[i].devices);
+        }
         VIR_FREE(list.sources);
     }
     for (i = 0 ; i < ntargets ; i++)
-- 
1.7.7.6



-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]