mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Improve disk used heuristics. Disk preallocation is disabled by default (again)
This commit is contained in:
		
							parent
							
								
									fcc050ed82
								
							
						
					
					
						commit
						7553e77b11
					
				
					 2 changed files with 23 additions and 14 deletions
				
			
		|  | @ -314,10 +314,9 @@ Add additional lines to your virtual machine configuration: | |||
| 
 | ||||
| ## Disk preallocation | ||||
| 
 | ||||
| Preallocation mode (allowed values: `off`, `metadata` (default), `falloc`, `full`). | ||||
| Preallocation mode (allowed values: `off` (default), `metadata`, `falloc`, `full`). | ||||
| An image with preallocated metadata is initially larger but can improve performance | ||||
| when the image needs to grow. `falloc` and `full` preallocations are like the | ||||
| same options of raw format, but sets up metadata also. | ||||
| when the image needs to grow. | ||||
| 
 | ||||
| Specify what disk preallocation should be used, if any, when creating the system | ||||
| disk image by adding a line like this to your VM configuration. | ||||
|  |  | |||
							
								
								
									
										20
									
								
								quickemu
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								quickemu
									
										
									
									
									
								
							|  | @ -142,6 +142,7 @@ function check_cpu_flag() { | |||
| function vm_boot() { | ||||
|   local BALLOON="-device virtio-balloon" | ||||
|   local CPU="" | ||||
|   local DISK_USED="" | ||||
|   local GUEST_CPU_CORES="" | ||||
|   local GUEST_CPU_LOGICAL_CORES="" | ||||
|   local GUEST_CPU_THREADS="" | ||||
|  | @ -384,12 +385,15 @@ function vm_boot() { | |||
|         exit 1 | ||||
|       fi | ||||
|       echo "             Just created, booting from ${iso}${img}" | ||||
|       DISK_USED="no" | ||||
|   elif [ -e "${disk_img}" ]; then | ||||
|     # Check there isn't already a process attached to the disk image. | ||||
|     if ! ${QEMU_IMG} info "${disk_img}" >/dev/null; then | ||||
|       echo "             Failed to get \"write\" lock. Is another process using the disk?" | ||||
|       exit 1 | ||||
|     else | ||||
|       # Only check disk image size if preallocation is off | ||||
|       if [ "${preallocation}" == "off" ]; then | ||||
|         DISK_CURR_SIZE=$(stat -c%s "${disk_img}") | ||||
|         if [ "${DISK_CURR_SIZE}" -le "${DISK_MIN_SIZE}" ]; then | ||||
|           echo "             Looks unused, booting from ${iso}${img}" | ||||
|  | @ -398,13 +402,19 @@ function vm_boot() { | |||
|             exit 1 | ||||
|           fi | ||||
|         else | ||||
|         # If there is a disk image, assume there is an install and do not boot | ||||
|         # from installation media. | ||||
|           DISK_USED="yes" | ||||
|         fi | ||||
|       else | ||||
|         DISK_USED="yes" | ||||
|       fi | ||||
|     fi | ||||
|   fi | ||||
| 
 | ||||
|   if [ "${DISK_USED}" == "yes" ]; then | ||||
|     # If there is a disk image that appears to be used do not boot from installation media. | ||||
|     iso="" | ||||
|     img="" | ||||
|   fi | ||||
|     fi | ||||
|   fi | ||||
| 
 | ||||
|   # Has the status quo been requested? | ||||
|   if [ "${STATUS_QUO}" == "-snapshot" ]; then | ||||
|  | @ -776,7 +786,7 @@ img="" | |||
| iso="" | ||||
| macos_release="" | ||||
| port_forwards=() | ||||
| preallocation="metadata" | ||||
| preallocation="off" | ||||
| ram="" | ||||
| tpm="off" | ||||
| usb_devices=() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue