|
|
9119d9 |
From 169d41cce1b6d10bda18462a237d35a24c501c31 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <169d41cce1b6d10bda18462a237d35a24c501c31@dist-git>
|
|
|
9119d9 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
9119d9 |
Date: Wed, 12 Nov 2014 09:48:08 +0100
|
|
|
9119d9 |
Subject: [PATCH] Do not crash on gluster snapshots with no host name
|
|
|
9119d9 |
|
|
|
9119d9 |
virStorageFileBackendGlusterInit did not check nhosts.
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1162974
|
|
|
9119d9 |
(cherry picked from commit b66288faaba68e22a2876029872ddadf1794bda8)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/storage/storage_backend_gluster.c | 10 +++++++++-
|
|
|
9119d9 |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
|
|
|
9119d9 |
index 8a7d7e5..b79b634 100644
|
|
|
9119d9 |
--- a/src/storage/storage_backend_gluster.c
|
|
|
9119d9 |
+++ b/src/storage/storage_backend_gluster.c
|
|
|
9119d9 |
@@ -571,9 +571,17 @@ virStorageFileBackendGlusterInit(virStorageSourcePtr src)
|
|
|
9119d9 |
{
|
|
|
9119d9 |
virStorageFileBackendGlusterPrivPtr priv = NULL;
|
|
|
9119d9 |
virStorageNetHostDefPtr host = &(src->hosts[0]);
|
|
|
9119d9 |
- const char *hostname = host->name;
|
|
|
9119d9 |
+ const char *hostname;
|
|
|
9119d9 |
int port = 0;
|
|
|
9119d9 |
|
|
|
9119d9 |
+ if (src->nhosts != 1) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
9119d9 |
+ _("Expected exactly 1 host for the gluster volume"));
|
|
|
9119d9 |
+ return -1;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ hostname = host->name;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
VIR_DEBUG("initializing gluster storage file %p (gluster://%s:%s/%s%s)",
|
|
|
9119d9 |
src, hostname, host->port ? host->port : "0",
|
|
|
9119d9 |
NULLSTR(src->volume), src->path);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|