Bug #328

REQUIREMENTS=HOSTNAME does not matches when HOSTNAME is an IP-Address

Added by Marlon Nerling over 10 years ago. Updated over 10 years ago.

Status:ClosedStart date:08/24/2010
Priority:HighDue date:
Assignee:Ruben S. Montero% Done:

0%

Category:Core & System
Target version:Release 1.4.2
Resolution:worksforme Pull request:
Affected Versions:

Description

This seems to work: # onevm show 262 | grep REQUIRE
REQUIREMENTS=HOSTNAME = "support*"

But above case do not: # onevm show 264 | grep REQUIRE
REQUIREMENTS=HOSTNAME = "172.23.5.*"

if I try escaping the point into the address, it does not work, too: # onevm show 265 | grep REQUIRE
REQUIREMENTS=HOSTNAME = "172\.23\.5\.*"

I'm building one of the svn (revision 976) plus the patches from:
http://dev.opennebula.org/issues/196#change-540

History

#1 Updated by Marlon Nerling over 10 years ago

I should say .. the case hereunder do not (work)

#2 Updated by Ruben S. Montero over 10 years ago

  • Status changed from New to Closed
  • Resolution set to worksforme

The function used to do the match is fnmatch, which supports shell wildcard patterns (?[]). The second form should work, i.e HOSTNAME = "172.23.5." (at least is working here).

#3 Updated by Marlon Nerling over 10 years ago

Yes, I can see it!
./host/host_rank.y:27:#include <fnmatch.h>
./host/host_requirements.cc:101:#include <fnmatch.h>
./host/host_requirements.cc:1515: (yyval.val_int) = val.empty() ? false :fnmatch((yyvsp[(3) - (3)].val_str), val.c_str(), 0) == 0;
./host/host_requirements.cc:1526: (yyval.val_int) = val.empty() ? false : fnmatch((yyvsp[(4) - (4)].val_str), val.c_str(), 0) != 0;
./host/host_requirements.y:27:#include <fnmatch.h>
./host/host_requirements.y:138: $$ = val.empty() ? false :fnmatch($3, val.c_str(), 0) == 0;
./host/host_requirements.y:146: $$ = val.empty() ? false : fnmatch($4, val.c_str(), 0) != 0;
./host/host_rank.cc:101:#include <fnmatch.h>

I'm still using our own compiled source of opennebula 1.4.
I take the svn revision #974 and apply the patches of git revisions b59616d00a1f7a18da14ffb5b4d91f142b1d68bb and 61d7079cc2c89f16d855ddd5304030951e6da6fb. (As seen under http://dev.opennebula.org/issues/196#change-540 ).
The above code slice was taken from our debian source repository.

And still.. I cannot use HOSTNAME if hostname is an IP-address!
Just to remember: Your 1.4 source code as found under http://downloads.dsa-research.org/opennebula/one-1.4.0 is not patched against the bug 196! Would be there a released 1.4 without the bug, and I would use it.

Best regards.

Also available in: Atom PDF