yeahuh / rpms / qemu-kvm

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