[libvirt] [PATCH v2 5/9] gluster: Check for validity of pool source hostname

John Ferlan jferlan at redhat.com
Thu Apr 23 20:12:13 UTC 2015


Prior to attempting to open the gluster connection, let's make sure we
can resolve the source pool hostname.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_backend_gluster.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index d2e79bc..a10f784 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -1,7 +1,7 @@
 /*
  * storage_backend_gluster.c: storage backend for Gluster handling
  *
- * Copyright (C) 2013-2014 Red Hat, Inc.
+ * Copyright (C) 2013-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -96,6 +96,10 @@ virStorageBackendGlusterOpen(virStoragePoolObjPtr pool)
             trailing_slash = false;
     }
 
+    if (virSocketAddrParseName(NULL, pool->def->source.hosts[0].name,
+                               AF_UNSPEC, IPPROTO_TCP) < 0)
+        return NULL;
+
     if (VIR_ALLOC(ret) < 0)
         return NULL;
 
-- 
2.1.0




More information about the libvir-list mailing list