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

Sorry for the late reaction.

> diff -r da93d3523e6a modules/ui.py.in
> --- a/modules/ui.py.in        Tue Mar 26 11:44:17 2013 +0100
> +++ b/modules/ui.py.in        Mon Apr 08 17:49:00 2013 +0900
> @@ -924,10 +924,14 @@
>          lifetime = None
>          opt_l = fetch_opts(argl, ["force"])
>          if len(argl) == 1:
> -            if not argl[0] in listnodes():
> -                lifetime = argl[0]
> -            else:
> -                node = argl[0]
> +         for i in listnodes():
> +             pattern = re.compile(i, re.IGNORECASE)
> +             if pattern.match(argl[1]) and len(i) == len(argl[1]):
> +                 node = argl[1]


This is not exactly equivalent.

   Before, we had a string comparison.
   Now we have a regexp match.

   This may be considered as a new feature.
   But it should then be done intentionally.

   Otherwise, "i" would need to be "quote-meta"ed first.
   In Perl I'd write "\Q$i\E", in python we probably have to
   insert some '\' into it first.

   I admit in most setups it would not make any difference,
   as there should at most be dots in there ".",
   and they should be at places where they won't be ambiguous,
   especially with the additional "len()" check.

Maybe rather compare argl[0].lower() with listnodes(), which
should also return all elements as .lower().


        Lars
_______________________________________________________
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/

Reply via email to