File tree Expand file tree Collapse file tree
core/src/com/cloud/hypervisor/xen/resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3975,9 +3975,19 @@ public Type getType() {
39753975 protected boolean getHostInfo (Connection conn ) throws IllegalArgumentException {
39763976 try {
39773977 Host myself = Host .getByUuid (conn , _host .uuid );
3978+ Set <HostCpu > hcs = null ;
3979+ for (int i = 0 ; i < 10 ; i ++) {
3980+ hcs = myself .getHostCPUs (conn );
3981+ _host .cpus = hcs .size ();
3982+ if (_host .cpus > 0 ) {
3983+ break ;
3984+ }
3985+ Thread .sleep (5000 );
3986+ }
3987+ if (_host .cpus <= 0 ) {
3988+ throw new CloudRuntimeException ("Cannot get the numbers of cpu from XenServer host " + _host .ip );
3989+ }
39783990
3979- Set <HostCpu > hcs = myself .getHostCPUs (conn );
3980- _host .cpus = hcs .size ();
39813991 for (final HostCpu hc : hcs ) {
39823992 _host .speed = hc .getSpeed (conn ).intValue ();
39833993 break ;
@@ -4051,7 +4061,7 @@ protected boolean getHostInfo(Connection conn) throws IllegalArgumentException{
40514061 } catch (XenAPIException e ) {
40524062 s_logger .warn ("Unable to get host information for " + _host .ip , e );
40534063 return false ;
4054- } catch (XmlRpcException e ) {
4064+ } catch (Exception e ) {
40554065 s_logger .warn ("Unable to get host information for " + _host .ip , e );
40564066 return false ;
40574067 }
You can’t perform that action at this time.
0 commit comments