[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ha-dev
Subject: Re: [Linux-ha-dev] [PATCH][crmsh] deal with the case-insentive hostname
From: Dejan Muhamedagic <dejan () suse ! de>
Date: 2013-04-23 14:44:19
Message-ID: 20130423144419.GA3754 () squib
[Download RAW message or body]
Hi Junko-san,
Can you try the attached patch, instead of this one?
Cheers,
Dejan
On Wed, Apr 10, 2013 at 06:13:45PM +0900, Junko IKEDA wrote:
> Hi,
> I set upper-case hostname (GUEST03/GUEST4) and run Pacemaker 1.1.9 +
> Corosync 2.3.0.
>
> [root@GUEST04 ~]# crm_mon -1
> Last updated: Wed Apr 10 15:12:48 2013
> Last change: Wed Apr 10 14:02:36 2013 via crmd on GUEST04
> Stack: corosync
> Current DC: GUEST04 (3232242817) - partition with quorum
> Version: 1.1.9-e8caee8
> 2 Nodes configured, unknown expected votes
> 1 Resources configured.
>
>
> Online: [ GUEST03 GUEST04 ]
>
> dummy (ocf::pacemaker:Dummy): Started GUEST03
>
>
> for example, call crm shell with lower-case hostname.
>
> [root@GUEST04 ~]# crm node standby guest03
> ERROR: bad lifetime: guest03
>
> "crm node standby GUEST03" surely works well,
> so crm shell just doesn't take into account the hostname conversion.
> It's better to accept the both of the upper/lower-case.
>
> "node standby", "node delete", "resource migrate(move)" get hit with this
> issue.
> Please see the attached.
>
> Thanks,
> Junko
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
["node-ignorecase.patch" (text/x-diff)]
# HG changeset patch
# User Dejan Muhamedagic <dejan@hello-penguin.com>
# Date 1366728211 -7200
# Node ID cd4d36b347c17b06b76f3386c041947a03c708bb
# Parent 4a47465b1fe1f48123080b4336f0b4516d9264f6
Medium: node: ignore case when looking up nodes (thanks to Junko Ikeda)
diff -r 4a47465b1fe1 -r cd4d36b347c1 modules/ui.py.in
--- a/modules/ui.py.in Tue Apr 23 11:23:10 2013 +0200
+++ b/modules/ui.py.in Tue Apr 23 16:43:31 2013 +0200
@@ -924,7 +924,7 @@ class RscMgmt(UserInterface):
lifetime = None
opt_l = fetch_opts(argl, ["force"])
if len(argl) == 1:
- if not argl[0] in listnodes():
+ if not is_node(argl[0]):
lifetime = argl[0]
else:
node = argl[0]
@@ -1186,7 +1186,7 @@ class NodeMgmt(UserInterface):
if not args:
node = vars.this_node
if len(args) == 1:
- if not args[0] in listnodes():
+ if not is_node(args[0]):
node = vars.this_node
lifetime = args[0]
else:
@@ -1249,7 +1249,7 @@ class NodeMgmt(UserInterface):
'usage: delete <node>'
if not is_name_sane(node):
return False
- if not node in listnodes():
+ if not is_node(node):
common_err("node %s not found in the CIB" % node)
return False
rc = True
diff -r 4a47465b1fe1 -r cd4d36b347c1 modules/xmlutil.py
--- a/modules/xmlutil.py Tue Apr 23 11:23:10 2013 +0200
+++ b/modules/xmlutil.py Tue Apr 23 16:43:31 2013 +0200
@@ -159,6 +159,15 @@ def mk_rsc_type(n):
if ra_provider:
s2 = "%s:"%ra_provider
return ''.join((s1,s2,ra_type))
+def is_node(s):
+ '''
+ Check if s is in a list of our nodes (ignore case).
+ This is not fast, perhaps should be cached.
+ '''
+ for n in listnodes():
+ if n.lower() == s.lower():
+ return True
+ return False
def listnodes():
nodes_elem = cibdump2elem("nodes")
if nodes_elem is None:
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic