From patchwork Thu May 8 11:44:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wido den Hollander X-Patchwork-Id: 4135771 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A76F89F1E1 for ; Thu, 8 May 2014 11:51:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1B5C201D3 for ; Thu, 8 May 2014 11:51:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83795201C0 for ; Thu, 8 May 2014 11:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754090AbaEHLvH (ORCPT ); Thu, 8 May 2014 07:51:07 -0400 Received: from smtp01.mail.pcextreme.nl ([109.72.87.137]:47189 "EHLO smtp01.mail.pcextreme.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753437AbaEHLvH (ORCPT ); Thu, 8 May 2014 07:51:07 -0400 X-Greylist: delayed 375 seconds by postgrey-1.27 at vger.kernel.org; Thu, 08 May 2014 07:51:06 EDT Received: from localhost.localdomain (unknown [171.33.130.93]) by smtp01.mail.pcextreme.nl (Postfix) with ESMTPA id 2FEDB761F6; Thu, 8 May 2014 13:48:24 +0200 (CEST) From: Wido den Hollander To: ceph-devel@vger.kernel.org Cc: Wido den Hollander Subject: [PATCH] Write correct 'mon_host' with IPv6 addresses Date: Thu, 8 May 2014 13:44:43 +0200 Message-Id: <1399549483-14813-1-git-send-email-wido@widodh.nl> X-Mailer: git-send-email 1.7.9.5 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the IP-address from a monitor is a IPv6 address, encapsulate it with [ and ] Fixes: #8309 Signed-off-by: Wido den Hollander --- ceph_deploy/new.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ceph_deploy/new.py b/ceph_deploy/new.py index 3680821..fc4c5f4 100644 --- a/ceph_deploy/new.py +++ b/ceph_deploy/new.py @@ -5,6 +5,7 @@ import uuid import struct import time import base64 +import socket from ceph_deploy.cliutil import priority from ceph_deploy import conf, hosts, exc @@ -90,7 +91,12 @@ def new(args): ip = net.get_nonlocal_ip(host) LOG.debug('Monitor %s at %s', name, ip) mon_initial_members.append(name) - mon_host.append(ip) + try: + socket.inet_pton(socket.AF_INET6, ip) + mon_host.append("[" + ip + "]") + except socket.error: + mon_host.append(ip) + if args.ssh_copykey: ssh_copy_keys(host, args.username)