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

[libvirt] [Patch]Fix bugs of Sheepdog storage driver



virStorageBackendSheepdogCreateVol calls virCommandRun whihout checking
the return value, which this return value determines us whether we should
call virStorageBackendSheepdogRefreshVol func. And we should also give a 
return value to virStorageBackendSheepdogRefreshVol func because it may
cause errors. Following patch can fix these bugs. This patch have checked
by 'make syntax-check'.

Signed-off-by: Harry Wei <harryxiyou gmail com>
---
 src/storage/storage_backend_sheepdog.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index cd18f33..f987604 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -168,9 +168,12 @@ virStorageBackendSheepdogCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
     virCommandAddArgFormat(cmd, "%llu", vol->capacity);
     virStorageBackendSheepdogAddHostArg(cmd, pool);
     ret = virCommandRun(cmd, NULL);
+    if (ret < 0)
+        goto cleanup;
 
-    virStorageBackendSheepdogRefreshVol(conn, pool, vol);
+    ret = virStorageBackendSheepdogRefreshVol(conn, pool, vol);
 
+cleanup:
     virCommandFree(cmd);
     return ret;
 }
-- 
1.7.0.4


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