Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Refunding the restart mechanism.
[hpcvm.git] / src / and / hpcvm / VirtualMachine.java
index 95a6683..adeab1b 100644 (file)
@@ -10,7 +10,7 @@ import java.io.InputStreamReader;
 import java.util.ArrayList;
 
 public class VirtualMachine 
-{
+{      
        private String name ;
        private String ip ;
        private String initial_archive_name ;
@@ -25,7 +25,7 @@ public class VirtualMachine
        private Status status ;
        private int computation_id ;
        private String working_directory ;
-       private ArrayList<ServicesClient> save_neighbors ;
+       private ArrayList<SaveNeighbor> save_neighbors ;
        private String clientInVM ;
        private String vm_user ;
        private String vm_user_passwd ;
@@ -50,7 +50,7 @@ public class VirtualMachine
                status = new Status() ;
                status.setStatus( "stopped" ) ;
                computation_id  = -1 ;
-               save_neighbors = new ArrayList<ServicesClient>() ;
+               save_neighbors = new ArrayList<SaveNeighbor>() ;
                clientInVM = "/home/mpi/InGuest" ;
                vm_user = "mpi" ;
                vm_user_passwd = "mpi" ;
@@ -66,18 +66,18 @@ public class VirtualMachine
        }
        
        
-       public ArrayList<ServicesClient> getSaveNeighbors() { return save_neighbors ; }
+       public ArrayList<SaveNeighbor> getSaveNeighbors() { return save_neighbors ; }
        
        @SuppressWarnings("unchecked")
-       public void setSaveNeighbors( ArrayList<ServicesClient> _sn )
+       public void setSaveNeighbors( ArrayList<SaveNeighbor> _sn )
        {
                if( _sn != null ) 
                {
-                       save_neighbors = (ArrayList<ServicesClient>) _sn.clone() ;
+                       save_neighbors = (ArrayList<SaveNeighbor>) _sn.clone() ;
                }
        }
        
-       public void addSaveNeighbor( ServicesClient _sn )
+       public void addSaveNeighbor( SaveNeighbor _sn )
        {
                if( _sn != null )
                {
@@ -385,6 +385,10 @@ public class VirtualMachine
 
        public int checkVmx() 
        {
+               deploy = false ;
+               first = false ;
+               deployFault = false ;
+               
                // Initial deployment
                File file = new File( working_directory + "/" + directory + "/initial.hpcvm" ) ;
                
@@ -415,6 +419,12 @@ public class VirtualMachine
                
                file = null ;
                
+               // If nothing to do
+               if( ! deploy && ! first && ! deployFault )
+               {
+                       return 0 ;
+               }
+               
                // Deployment of the VM
                
                if( deploy )
@@ -531,7 +541,7 @@ public class VirtualMachine
                
                                if( p.exitValue() == 0 )
                                {
-                                       System.out.println( "Successfully deletion of the deployment mark." ) ;
+                                       System.out.println( "Successful deletion of the deployment mark." ) ;
                                } else {
                                        System.err.println( "Unsuccessful deletion of the deployment mark!" ) ;
                                        printProcessError( p ) ;
@@ -661,7 +671,7 @@ public class VirtualMachine
                
                                if( p.exitValue() == 0 )
                                {
-                                       System.out.println( "Successfully deletion of the first start mark." ) ;
+                                       System.out.println( "Successful deletion of the first start mark." ) ;
                                } else {
                                        System.err.println( "Unsuccessful deletion of the first start mark!" ) ;
                                        printProcessError( p ) ;
@@ -817,7 +827,7 @@ public class VirtualMachine
                
                                if( p.exitValue() == 0 )
                                {
-                                       System.out.println( "Successfully deletion of the fault mark." ) ;
+                                       System.out.println( "Successful deletion of the fault mark." ) ;
                                } else {
                                        System.err.println( "Unsuccessful deletion of the fault mark!" ) ;
                                        printProcessError( p ) ;