Blame SOURCES/kvm-gluster-default-scheme-to-gluster-and-host-to-localh.patch

9ae3a8
From a5dba057d87136b90802c822f296164b52266273 Mon Sep 17 00:00:00 2001
9ae3a8
From: Jeffrey Cody <jcody@redhat.com>
9ae3a8
Date: Tue, 2 Sep 2014 19:26:26 +0200
9ae3a8
Subject: [PATCH 4/6] gluster: default scheme to gluster:// and host to localhost.
9ae3a8
9ae3a8
Message-id: <dad17090b75becd16b580a4f4da0dbe2d4ec5697.1409685668.git.jcody@redhat.com>
9ae3a8
Patchwork-id: 60813
9ae3a8
O-Subject: [PATCH qemu-kvm-rhev RHEL7.1] gluster: default scheme to gluster:// and host to localhost.
9ae3a8
Bugzilla: 1088150
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
Currently, "gluster:///volname/img" and (using file. options)
9ae3a8
"file.driver=gluster,file.filename=foo" will segfault.  Also,
9ae3a8
"//host/volname/img" will be rejected, but it is a valid URL
9ae3a8
that should be accepted just fine with "file.driver=gluster".
9ae3a8
Accept all of these, by inferring missing transport and host
9ae3a8
as TCP and localhost respectively.
9ae3a8
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Reviewed-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 24897a767bd778fc6a050537d024565f9272cd06)
9ae3a8
Signed-off-by: Jeff Cody <jcody@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/gluster.c |    4 ++--
9ae3a8
 1 files changed, 2 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/gluster.c b/block/gluster.c
9ae3a8
index da43d0c..5f85799 100644
9ae3a8
--- a/block/gluster.c
9ae3a8
+++ b/block/gluster.c
9ae3a8
@@ -134,7 +134,7 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename)
9ae3a8
     }
9ae3a8
 
9ae3a8
     /* transport */
9ae3a8
-    if (!strcmp(uri->scheme, "gluster")) {
9ae3a8
+    if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
9ae3a8
         gconf->transport = g_strdup("tcp");
9ae3a8
     } else if (!strcmp(uri->scheme, "gluster+tcp")) {
9ae3a8
         gconf->transport = g_strdup("tcp");
9ae3a8
@@ -170,7 +170,7 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename)
9ae3a8
         }
9ae3a8
         gconf->server = g_strdup(qp->p[0].value);
9ae3a8
     } else {
9ae3a8
-        gconf->server = g_strdup(uri->server);
9ae3a8
+        gconf->server = g_strdup(uri->server ? uri->server : "localhost");
9ae3a8
         gconf->port = uri->port;
9ae3a8
     }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8