mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Prevent starting multiple instances of the same VM
This commit is contained in:
		
							parent
							
								
									d48dc74e95
								
							
						
					
					
						commit
						fb627583b9
					
				
					 1 changed files with 13 additions and 6 deletions
				
			
		
							
								
								
									
										7
									
								
								quickemu
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								quickemu
									
										
									
									
									
								
							|  | @ -84,6 +84,12 @@ function vm_boot() { | ||||||
|       exit 1 |       exit 1 | ||||||
|     fi |     fi | ||||||
|   elif [ -e ${disk_img} ]; then |   elif [ -e ${disk_img} ]; then | ||||||
|  |     # Check there isn't already a process attached to the disk image. | ||||||
|  |     QEMU_LOCK_TEST=$(${QEMU_IMG} info ${disk_img} 2>/dev/null) | ||||||
|  |     if [ $? -ne 0 ]; then | ||||||
|  |       echo "             Failed to get "write" lock. Is another process using the disk?" | ||||||
|  |       exit 1 | ||||||
|  |     else | ||||||
|       disk_curr_size=$(stat -c%s "${disk_img}") |       disk_curr_size=$(stat -c%s "${disk_img}") | ||||||
|       if [ ${disk_curr_size} -le ${disk_min_size} ]; then |       if [ ${disk_curr_size} -le ${disk_min_size} ]; then | ||||||
|         echo "             Looks unused, booting from ${iso}" |         echo "             Looks unused, booting from ${iso}" | ||||||
|  | @ -93,6 +99,7 @@ function vm_boot() { | ||||||
|         iso="" |         iso="" | ||||||
|       fi |       fi | ||||||
|     fi |     fi | ||||||
|  |   fi | ||||||
| 
 | 
 | ||||||
|   local cores="1" |   local cores="1" | ||||||
|   local allcores=$(nproc --all) |   local allcores=$(nproc --all) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue