From 62823df2fefb2c1d3e32c0fa5e31c272ac673b2d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 7 Jul 2010 19:13:40 +0000 Subject: [PATCH] -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 --- xCAT-server/lib/xcat/plugins/esx.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index 22a11cbc2..78c1a28c8 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -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) {