-Speed up vmware host view retrieval

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6668 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-07-07 19:13:40 +00:00
parent a05bbf506c
commit 62823df2fe

View File

@ -861,6 +861,19 @@ sub get_hostview {
foreach (split /\s+/,$aliases) {
push @matchvalues,$_;
}
my $view;
$subargs{filter}={'name' =~ qr/$host(?:\.|\z)/};
$view = $args{conn}->find_entity_view(%subargs);
if ($view) { return $view; }
foreach (@matchvalues) {
$subargs{filter}={'name' =~ qr/$_(?:\.|\z)/};
$view = $args{conn}->find_entity_view(%subargs);
if ($view) { return $view; }
}
$subargs{filter}={'name' =~ qr/localhost(?:\.|\z)/};
$view = $args{conn}->find_entity_view(%subargs);
if ($view) { return $view; }
$subargs{filter}={'name' =~ qr/.*/};
foreach (@{$args{conn}->find_entity_views(%subargs)}) {
my $view = $_;
if ($_->name =~ /$host(?:\.|\z)/ or $_->name =~ /localhost(?:\.|\z)/ or grep { $view->name =~ /$_(?:\.|\z)/ } @matchvalues) {