Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
First ~stable~ version.
[hpcvm.git] / src / and / hpcvm / Server.java
1 package and.hpcvm ;
2
3 import java.rmi.Naming;
4 import java.rmi.RemoteException;
5 import java.rmi.registry.LocateRegistry;
6 import java.rmi.registry.Registry;
7 import java.rmi.server.UnicastRemoteObject;
8 import java.util.ArrayList;
9 import java.util.Iterator;
10
11
12 public class Server extends UnicastRemoteObject implements ServicesServer
13 {
14         private class DiscCount
15         {
16                 private int nb ;
17                 
18                 DiscCount() { nb = 0 ; }
19                 
20                 protected void inc() { nb++ ; }
21                 
22                 protected void dec() { 
23                         if( nb > 0 )
24                         {
25                                 nb-- ;
26                         }
27                 }
28                 
29                 protected int getNb() { return nb ; }
30         }
31         
32         
33         private class ConnectedClient
34         {
35                 private ServicesClient stub ;
36                 private int timeout ;
37                 private Status state ;
38                 private String ip ;
39                 private String name ;
40                 private ComputingClient cl ;
41                 
42                 ConnectedClient( ServicesClient _stub )
43                 {
44                         stub = _stub ;
45                         timeout = 0 ;
46                         state = new Status() ;
47                         state.setStatus( "connected" ) ;
48                         try {
49                                 ip = stub.getIPHost() ;
50                                 name = stub.getName() ;
51                         } catch (RemoteException e) {
52                                 e.printStackTrace();
53                         }
54                         cl = null ;
55                 }
56                 
57                 protected ServicesClient getStub() { return stub ; }
58                 
59                 protected void setStub( ServicesClient _stub ) { stub = _stub ; }
60                 
61                 protected int getTimeout() { return timeout ; }
62                 
63                 protected void incTimeout() { timeout++ ; }
64                 
65                 protected void resetTimeout() { timeout = 0 ; }
66                 
67                 protected String getStatus() { return state.getStatus() ; }
68                 
69                 protected void setStatus( String _state ) { state.setStatus( _state ) ; }
70                 
71                 protected String getIP() { return ip ; }
72                 
73                 protected String getName() { return name ; } ;
74                 
75                 protected void setComputingClient( ComputingClient _cl ) { cl = _cl ; }
76                 
77                 protected ComputingClient getComputingClient() { return cl ; } 
78         }
79         
80         
81         private class ComputingClient
82         {
83                 private ConnectedClient client ;
84                 private boolean save_status ;
85                 private String save_neighbor ;
86                 private String lastSaveName ;
87                 
88                 ComputingClient( ConnectedClient cl )
89                 {
90                         client = cl ;
91                         save_status = false ;
92                         save_neighbor = "none" ;
93                         lastSaveName = "none" ;
94                 }
95                 
96                 protected ConnectedClient getClient() { return client ; }
97                 
98                 protected boolean getSaveStatus(){ return save_status ; }
99                 
100                 protected void setSaveStatus( boolean _status ) { save_status = _status ; }
101                 
102                 protected void setSaveNeighbor( String _sn ) 
103                 { 
104                         if( _sn != null && ! _sn.isEmpty() )
105                         {
106                                 save_neighbor = _sn ; 
107                         
108                                 try {
109                                         client.getStub().setSavingNeighbor( _sn ) ;
110                                 } catch( RemoteException e ) {
111                                         System.err.println( "Error while setting save neighbor on " + 
112                                                         client.getName() + "(" + client.getIP() + ")!" ) ;
113                                         e.printStackTrace() ;
114                                 }
115                         }
116                 }
117                 
118                 protected String getSaveNeighbor() { return save_neighbor ; }
119
120                 public void setLastSave( String _saveName ) 
121                 {
122                         lastSaveName = _saveName ;                      
123                 }
124                 
125                 public String getLastSave() { return lastSaveName ; }
126                 
127         }
128         
129         
130         private class IPAssociation
131         {
132                 private String vmIP ;
133                 private String hostIP ;
134                 
135                 IPAssociation()
136                 {
137                         vmIP = null ;
138                         hostIP = null ;
139                 }
140                 
141                 protected void setVmIP( String _vmIP )
142                 {
143                         vmIP = _vmIP ;
144                 }
145                 
146                 protected void setHostIP( String _hostIP )
147                 {
148                         hostIP = _hostIP ;
149                 }
150                 
151                 protected String getVmIP()
152                 {
153                         return vmIP ;
154                 }
155                 
156                 protected String getHostIP()
157                 {
158                         return hostIP ;
159                 }
160         }
161         
162         
163         
164         private static final long serialVersionUID = 1L ;
165         private int port ;
166         private ArrayList<ConnectedClient> clients ;
167         private ArrayList<ComputingClient> computingClients ;
168         private int max_timeout ;
169         private ConnectedMonitor monitor ;
170         private DiscCount counter ;
171         private ArrayList<IPAssociation> vmIPs ;
172         
173         
174         protected Server() throws RemoteException 
175         {
176                 super() ;
177         }
178
179
180
181         @Override
182         public Integer register( ServicesClient _stub ) 
183         {
184                 if( _stub != null )
185                 {
186                         String ip = "" ;
187                         try {
188                                 ip = _stub.getIPHost() ;
189                         } catch (RemoteException e) {
190                                 e.printStackTrace() ;
191                                 return 1 ;
192                         }
193                         
194                         boolean exists = false ;
195                         int i ;
196                         
197                         for( i = 0 ; i < clients.size() ; i++ )
198                         {
199                                 if( ip.equals( clients.get( i ).getIP() ) )
200                                 {
201                                         exists = true ;
202                                         System.out.println( "Client already connected!" ) ;
203                                         break ;
204                                 }
205                         }
206                         
207                         if( exists )
208                         {
209                                 System.out.println( "The client stub will be replaced." ) ;
210                                 clients.get( i ).setStub( _stub ) ;
211                                 System.out.println( "(reconnection of " + clients.get( i ).getName() + ")" ) ;
212                                 return 2 ;
213                         } else {
214                                 System.out.println( "New connection!" ) ;
215                                 clients.add( new ConnectedClient( _stub ) ) ;
216                                 System.out.println( "(connection of " + clients.get( clients.size() - 1 ).getName() + ")" ) ;
217                                 generateVmIP( ip ) ;
218                                 
219                                 if( clients.size() == 0 )
220                                 {
221                                         System.out.println( "There is no client connected." ) ;
222                                 } else if( clients.size() == 1 ) {
223                                         System.out.println( "There is one client connected." ) ;
224                                 } else {
225                                         System.out.println( "There are " + clients.size() + " clients connected." ) ;
226                                 }
227
228                                 return 0 ;
229                         }
230                 }
231                 
232                 return 1 ;
233         }
234
235         
236         private void generateVmIP( String _ip ) 
237         {
238                 if( _ip != null && ! _ip.equals( "" ) ) 
239                 {       
240                         for( int i = 0 ; i < vmIPs.size() ; i++ )
241                         {
242                                 if( vmIPs.get( i ).getHostIP() == null )
243                                 {
244                                         vmIPs.get( i ).setHostIP( _ip ) ;
245                                         
246                                         break ;
247                                 }
248                         }
249                 }
250         }
251         
252
253         @Override
254         public void ping( String _ip ) 
255         {
256                 if( _ip != null )
257                 {
258                         for( int i = 0 ; i < clients.size() ; i++ )
259                         {
260                                 if( _ip.equals( clients.get( i ).getIP() ) ) 
261                                 {
262                                         clients.get( i ).resetTimeout() ;
263                                         break ;
264                                 }
265                         }
266                 }               
267         }
268
269         
270         @Override
271         public void changeStatus( String _ip, String _status ) 
272         {
273                 if( _ip != null && _status != null )
274                 {
275                         for( int i = 0 ; i < clients.size() ; i++ )
276                         {
277                                 if( _ip.equals( clients.get( i ).getIP() ) ) 
278                                 {
279                                         clients.get( i ).setStatus( _status ) ;
280                                         System.out.println( "Client " + clients.get( i ).getName() + " changed its status to: " + _status ) ;
281                                         break ;
282                                 }
283                         }
284                 }
285         }
286         
287
288         public void init( int _port ) 
289         {       
290                 port = _port ;
291                 max_timeout = 4 ;
292                 
293                 clients = new ArrayList<Server.ConnectedClient>() ;
294                 computingClients = new ArrayList<Server.ComputingClient>() ;
295                 monitor = null ;
296                 
297                 exportObject() ;
298
299                 vmIPs = new ArrayList<IPAssociation>() ;
300                 // TODO initialisation of VM IPs
301                 for( int i = 2 ; i < 101 ; i++ )
302                 {
303                         vmIPs.add( new IPAssociation() ) ;
304                         vmIPs.get( vmIPs.size() - 1 ).setVmIP( "10.11.10." + i ) ;
305                 }
306                 
307                 clients = new ArrayList<Server.ConnectedClient>() ;
308                 
309                 counter = new DiscCount() ;
310                 
311                 monitor = new ConnectedMonitor() ;
312                 monitor.start() ;
313         }
314         
315         
316         public void stop()
317         {
318                 if( monitor != null ) { monitor.stopMonitor() ; }
319                 
320                 for( int i = 0 ; i < clients.size() ; i++ )
321                 {
322                         try {
323                                 clients.get( i ).getStub().stop() ;
324                         } catch (RemoteException e) {
325                                 e.printStackTrace();
326                         }
327                 }
328                 
329                 // unexportObject ?
330                 
331                 System.exit( 0 ) ;
332         }
333
334         
335         private void exportObject() 
336         {
337                 ServicesServer ref = null ;
338                 Registry reg = null ;
339                 
340                 try 
341                 {       
342                         while( true )
343                         {
344                                 reg = LocateRegistry.getRegistry( port ) ;
345
346                                 String tab[] = reg.list() ;
347                         
348                                 System.out.println( "There is an existing RMI Registry on port " +
349                                                 port + " with " + tab.length + " entries!" ) ;
350                                 for( int i = 0 ; i < tab.length ; i++ )
351                                 {
352                                         try {
353                                                 if( UnicastRemoteObject.unexportObject( Naming.lookup(tab[i]), true ) )
354                                                 {
355                                                         System.out.println( "Register successfuly deleted!" ) ;
356                                                 } else {
357                                                         System.err.println( "Register undeleted !!!" ) ;
358                                                 }
359                                         } catch( Exception e ) {
360                                                 e.printStackTrace() ;
361                                         }
362                                 } 
363                         }
364                 } catch( RemoteException e ) {
365                 }       
366                                 
367                 try {
368                         if ( System.getSecurityManager() == null ) 
369                         {
370                     System.setSecurityManager( new SecurityManager() ) ;
371                 }
372                         
373                         LocateRegistry.createRegistry( port ) ;
374                         LocateRegistry.getRegistry( port ).rebind( "Server", this ) ;
375                         ref = (ServicesServer) Naming.lookup( "rmi://"
376                                         + LocalHost.Instance().getIP() + ":" + port
377                                         + "/Server" ) ;
378                 } catch ( Exception e ) {
379                         System.err.println( "Error in Server.exportObject() when creating local services:" + e ) ;
380                         System.err.println( "Exit from Server.exportObject" ) ;
381                         System.exit( 1 ) ;
382                 }
383
384                 LocalHost.Instance().setServerStub( ref ) ;
385                 
386                 System.out.println( "Server launched on IP " + LocalHost.Instance().getIP() + 
387                                 " on port " + port + "." ) ;
388         }
389         
390         /** Fault manager thread **/
391         private class FaultManager extends Thread
392         {
393                 ConnectedClient cl ;
394                 
395                 FaultManager( ConnectedClient _cl )
396                 {
397                         cl = _cl ;
398                 }
399                 
400                 @Override
401                 public void run() 
402                 {
403                         synchronized( counter ){
404                         counter.inc() ;}
405                         System.out.println("ici");
406                         if( cl != null && cl.getStatus().equalsIgnoreCase( "running" ) ||
407                                         cl.getStatus().equalsIgnoreCase( "saving" ) )
408                         {
409                                 System.out.println("ok");
410                                 ComputingClient cc = cl.getComputingClient() ;
411                                 String ipDead = cc.getClient().getIP() ;
412                                 
413                                 boolean ok = false ;
414                                 
415                                 for( int i = 0 ; i < clients.size() ; i++ )
416                                 {
417                                         if( clients.get( i ).getStatus().equalsIgnoreCase( "connected" ) ) 
418                                         {
419 //                                              int res = 1 ;
420 //                                              try {
421 //                                                      res = clients.get( i ).getStub().startVM() ;
422 //                                              } catch( RemoteException e ) {
423 //                                                      e.printStackTrace();
424 //                                              }
425 //                                              
426 //                                              if( res == 0 )
427 //                                              {
428                                                         //clients.get(i).setStatus( "running" ) ;
429                                                 
430                                                 int pos = computingClients.indexOf( cc )  ;
431                                                 if( pos == -1 )
432                                                 {
433                                                         System.err.println( "Dead client not found in the computing clients list!" ) ;
434                                                 } else {
435                                                         System.out.println( "Trying to replace " + cc.getClient().getName() + " with " +
436                                                                         clients.get(i).getName() + " ... " ) ;
437                                                                 
438                                                         ComputingClient ccl = new ComputingClient( clients.get(i) ) ;
439                                                         clients.get( i ).setComputingClient( ccl ) ;
440                                                         String sn = computingClients.get( pos ).getSaveNeighbor() ;
441                                                         ccl.setSaveNeighbor( sn ) ;
442                                                         computingClients.set( pos, ccl ) ;
443 //                                                              computingClients.get( pos ).setSaveNeighbor( sn ) ;
444                                                                 
445                                                                 
446                                                         int res = 1 ;
447                                                         try {
448                                                                 res = computingClients.get( pos ).getClient().getStub().
449                                                                 retrieveSave( computingClients.get(i).getLastSave() ) ;
450                                                         } catch( RemoteException e ) {
451                                                                 System.err.println( "Unable to indicate to client to retrieve last save!" ) ;
452                                                                 e.printStackTrace() ;
453                                                         }
454                                                                 
455                                                         if( res == 0 )
456                                                         {
457                                                                 ok = true ;
458                                                                         
459                                                                         // replace dead client in vmIPs
460                                                                 for( int j = 0 ; j < vmIPs.size() ; j++ )
461                                                                 {
462                                                                         if( vmIPs.get( j ).getHostIP().equalsIgnoreCase( ipDead ) )
463                                                                         {
464                                                                                 String vmIP = vmIPs.get( j ).getVmIP() ;
465                                                                                 vmIPs.get( j ).setHostIP( computingClients.get( pos ).getClient().getIP() ) ;
466                                                                                         
467                                                                                 try {
468                                                                                         computingClients.get( pos ).getClient().getStub().setIPVM( vmIP ) ;
469                                                                                 } catch( RemoteException e ) {
470                                                                                         System.err.println( "Unable to set the new VM IP on the replacing client!" ) ;
471                                                                                         e.printStackTrace() ;
472                                                                                 }
473                                                                                 break ;
474                                                                         }
475                                                                 }
476                                                                         
477                                                                 System.out.println( "Successful redeployment of the VM." ) ;
478                                                         } else {
479                                                                 System.err.println( "Unable to deploy the save on the new computing client!" ) ;
480                                                         }
481                                                 }
482 //                                              } else {
483 //                                                      System.err.println( "Problem while launching the VM on " 
484 //                                                                      + clients.get(i).getName() + "!" ) ;
485 //                                              }
486                                                         
487                                                 if( ok )
488                                                 {
489                                                         System.out.println( "Dead client successfully replaced." ) ;
490                                                         // restart vms
491                                                         break ;
492                                                 } else {
493                                                         System.err.println( "Dead client not replaced!!" ) ;
494                                                 }
495                                         }
496                                 }
497                         }
498                         
499                         try {
500                                 synchronized( counter ) {
501                                         counter.dec() ;
502                                         counter.notifyAll() ;}
503                         } catch( Exception e ) {}
504                 }
505         }
506         
507         
508         /** Monitoring thread **/
509         private class ConnectedMonitor extends Thread
510         {
511                 boolean run ;
512                 
513                 ConnectedMonitor()
514                 {
515                         run = true ;
516                 }
517                 
518                 protected void stopMonitor() { run = false ; }
519                 
520                 @Override
521                 public void run() 
522                 {
523                         boolean change ;
524                         
525                         while( run )
526                         {
527                                 change = false ;
528                                 Iterator<ConnectedClient> it = clients.iterator() ;
529                                 int nb_disconnections = 0 ;
530                                 int nb_disconnections_computing = 0 ;
531                                 
532                                 while( it.hasNext() )
533                                 {
534                                         ConnectedClient cl = it.next() ;
535                                         cl.incTimeout() ;
536                                         
537                                         if( cl.getTimeout() > max_timeout )
538                                         {
539                                                 System.out.println( "Disconnection of " + cl.getName() ) ;
540                                                 if( cl.getStatus().equalsIgnoreCase( "running" ) || cl.getStatus().equalsIgnoreCase( "saving" ) )
541                                                 {
542                                                         System.out.println( "A VM was running on it!!" ) ;
543                                                         System.out.println( "I will redeploy a save and restart all VM ..." ) ;
544                                 
545 //                                                      for( int i = 0 ; i < computingClients.size() ; i++ )
546 //                                                      {
547 //                                                              if( computingClients.get( i ).getClient().getIP().equals( cl.getIP() ) )
548 //                                                              {
549 //                                                                      computingClients.remove( i ) ;
550 //                                                                      break ;
551 //                                                              }
552 //                                                      }
553                                                         
554                                                         new Server.FaultManager( cl ).start() ;
555                                                         nb_disconnections_computing++ ;
556                                                 } else {
557                                                         System.out.println( "There was no VM running on it." ) ;
558                                                         System.out.println( "Maybe it will come back later :)" ) ;
559                                                 }
560                                                 
561                                                 it.remove() ;
562                                                 nb_disconnections++ ;
563                                                 change = true ;
564                                         }
565                                 }
566                                 
567                                 if( change )
568                                 {
569                                         if( clients.size() == 0 )
570                                         {
571                                                 System.out.println( "There is no client connected." ) ;
572                                         } else if( clients.size() == 1 ) {
573                                                 System.out.println( "There is one client connected." ) ;
574                                         } else {
575                                                 System.out.println( "There are " + clients.size() + " clients connected." ) ;
576                                         }
577                                 }
578                                 
579                                 
580                                 if( nb_disconnections_computing > 0 )
581                                 {
582                                         System.out.println( "I will redeploy save and restart VMs ..." ) ;
583                                         
584                                         synchronized( counter ) 
585                                         {
586                                                 if( counter.getNb() > 0 )
587                                                 {
588                                                         System.out.println( "... waiting all redeployments done ..." ) ;
589                                                 }
590                                         
591                                                 while( counter.getNb() != 0 )
592                                                 {
593                                                         try {
594                                                                 counter.wait() ;  // !!!!! synchro
595                                                         } catch( InterruptedException e ) {
596                                                                 e.printStackTrace() ;
597                                                         }
598                                                 }
599                                         }
600                                         
601                                         for( int  i = 0 ; i < computingClients.size() ; i++ )
602                                         {
603                                                 final ServicesClient sc = computingClients.get( i ).getClient().getStub() ;
604                                                 
605                                                 new Thread( new Runnable() {
606                                                         
607                                                         @Override
608                                                         public void run() 
609                                                         {
610                                                                 try {
611                                                                         sc.restartVMAfterCrash() ;
612                                                                 } catch( RemoteException e ) {
613                                                                         e.printStackTrace() ;
614                                                                 }
615                                                         }
616                                                 } ).start() ;
617                                         }
618                                 }
619                                 
620                                 try 
621                                 {
622                                         Thread.sleep( 2000 ) ;
623                                 } catch( InterruptedException e ) {
624                                         e.printStackTrace() ;
625                                 }
626                         }
627                 }
628         }
629
630         @Override
631         public Integer saveOk( String _ip, String _saveName ) 
632         {
633                 int i ;
634                 for( i = 0 ; i < computingClients.size() ; i ++ )
635                 {
636                         if( computingClients.get( i ).getClient().getIP().equalsIgnoreCase( _ip ) ) 
637                         {
638                                 computingClients.get( i ).setLastSave( _saveName ) ;
639                                 computingClients.get( i ).setSaveStatus( true ) ;
640                                 break ;
641                         }
642                 }
643                 
644                 
645                 boolean all_ok = true ;
646                 i = 0 ;
647                 
648                 while( all_ok && i < computingClients.size() )
649                 {
650                         all_ok = all_ok & computingClients.get( i ).getSaveStatus() ;
651                         i++ ;
652                 }
653                 
654                 if( all_ok )
655                 {
656                         for( i = 0 ; i < computingClients.size() ; i++ )
657                         {
658                                 try {
659                                         computingClients.get( i ).getClient().getStub().saveOk() ;
660                                 } catch (RemoteException e) {
661                                         e.printStackTrace();
662                                 }
663                                 computingClients.get( i ).setSaveStatus( false ) ;
664                         }
665                 }
666                 
667                 return 0 ;
668         }
669
670
671
672         @Override
673         public ArrayList<ServicesClient> startApplication( int _nb ) 
674         {
675                 int nb = clients.size() - computingClients.size() ;
676                 
677                 if( nb > _nb )
678                 {
679                         ArrayList<ServicesClient> ac = new ArrayList<ServicesClient>() ;
680                         ArrayList<ComputingClient> tmp = new ArrayList<Server.ComputingClient>() ;
681                         
682                         int i = 0 ;
683                         
684                         while( i < clients.size() && ac.size() < _nb )
685                         {
686                                 if( clients.get(i).getStatus().equalsIgnoreCase( "connected" ) ) 
687                                 {
688                                         int res = 1 ;
689                                         try {
690                                                 res = clients.get( i ).getStub().startVM( 0 ) ;
691                                         } catch( RemoteException e ) {
692                                                 e.printStackTrace();
693                                         }
694                                         
695                                         if( res == 0 )
696                                         {
697                                                 ac.add( clients.get( i ).getStub() ) ;
698                                                 clients.get( i ).setStatus( "running" ) ;
699                                                 ComputingClient cl = new ComputingClient( clients.get( i ) ) ;
700                                                 clients.get( i ).setComputingClient( cl ) ;
701                                                 computingClients.add( cl ) ;
702                                                 tmp.add( cl ) ;
703                                         } else {
704                                                 System.err.println( "Problem while launching the VM on " 
705                                                                 + clients.get(i).getName() + "!" ) ;
706                                         }
707                                 }
708                                 
709                                 i++ ;
710                         }
711                         
712                         if( ac.size() == _nb )
713                         {
714                                 int index, index2 ;
715                                 /* Choosing save neighbors */
716                                 for( i = 0 ; i < tmp.size() ; i++ )
717                                 {
718                                         if( i == tmp.size() - 1 )
719                                         {
720                                                 index = computingClients.indexOf( tmp.get( i ) ) ;
721                                                 index2 = computingClients.indexOf( tmp.get( 0 ) ) ;
722                                                 
723                                                 if( index == -1 || index2 == -1 )
724                                                 {
725                                                         System.err.println( "Problem in ComputingClients list!" ) ;
726                                                 } else {
727                                                         computingClients.get( index ).setSaveNeighbor( computingClients.get( index2 ).getClient().getIP() ) ;
728                                                 }
729                                         } else {
730                                                 index = computingClients.indexOf( tmp.get( i ) ) ;
731                                                 index2 = computingClients.indexOf( tmp.get( i + 1 ) ) ;
732                                                 
733                                                 if( index == -1 || index2 == -1 )
734                                                 {
735                                                         System.err.println( "Problem in ComputingClients list!" ) ;
736                                                 } else {
737                                                         computingClients.get( index ).setSaveNeighbor( computingClients.get( index2 ).getClient().getIP() ) ;
738                                                 }
739                                         }
740                                 }
741                         }
742                         
743                         /* Cleaning */
744                         tmp.clear() ;
745                         tmp = null ;
746                         
747                         return ac ;
748                 }
749                 
750                 return null ;
751         }
752
753
754
755         @Override
756         public void endApplication() 
757         {
758                 Iterator<ComputingClient> it = computingClients.iterator() ;
759                 
760                 while( it.hasNext() )
761                 {
762                         ComputingClient cl = it.next() ;
763
764                         try {
765                                 cl.getClient().getStub().stopVM() ;
766                         } catch (RemoteException e) {
767                                 e.printStackTrace();
768                         }
769                         
770                         cl.getClient().setStatus( "connected" ) ;
771                         cl.getClient().setComputingClient( null ) ;
772                         it.remove() ;
773                         cl = null ;
774                 }
775                 
776         }
777
778
779
780         @Override
781         public String getAssociatedIP( String _ip ) throws RemoteException 
782         {
783                 String ret = null ;
784                 
785                 for( int i = 0 ; i < vmIPs.size() ; i++ )
786                 {
787                         if( vmIPs.get( i ).getHostIP().equalsIgnoreCase( _ip ) )
788                         {
789                                 ret = vmIPs.get( i ).getVmIP() ;
790                                 break ;
791                         }
792                 }
793                 
794                 return ret ;
795         }
796         
797 }
798
799 /** La programmation est un art, respectons ceux qui la pratiquent !! **/
800