mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +00:00 
			
		
		
		
	qemu: Add a UUID field to the Config structure
The qemu UUID will be used to set the guest system UUID. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
		
							
								
								
									
										13
									
								
								qemu.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								qemu.go
									
									
									
									
									
								
							| @@ -148,6 +148,9 @@ type Config struct { | |||||||
| 	// FilesystemDevices is a list of filesystem devices. | 	// FilesystemDevices is a list of filesystem devices. | ||||||
| 	FilesystemDevices []FSDevice | 	FilesystemDevices []FSDevice | ||||||
|  |  | ||||||
|  | 	// UUID is the qemu process UUID. | ||||||
|  | 	UUID string | ||||||
|  |  | ||||||
| 	// Kernel is the guest kernel configuration. | 	// Kernel is the guest kernel configuration. | ||||||
| 	Kernel Kernel | 	Kernel Kernel | ||||||
|  |  | ||||||
| @@ -303,6 +306,15 @@ func appendFilesystemDevices(params []string, config Config) []string { | |||||||
| 	return params | 	return params | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func appendUUID(params []string, config Config) []string { | ||||||
|  | 	if config.UUID != "" { | ||||||
|  | 		params = append(params, "-uuid") | ||||||
|  | 		params = append(params, config.UUID) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return params | ||||||
|  | } | ||||||
|  |  | ||||||
| func appendKernel(params []string, config Config) []string { | func appendKernel(params []string, config Config) []string { | ||||||
| 	if config.Kernel.Path != "" { | 	if config.Kernel.Path != "" { | ||||||
| 		params = append(params, "-kernel") | 		params = append(params, "-kernel") | ||||||
| @@ -330,6 +342,7 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) { | |||||||
| 	var params []string | 	var params []string | ||||||
|  |  | ||||||
| 	params = appendName(params, config) | 	params = appendName(params, config) | ||||||
|  | 	params = appendUUID(params, config) | ||||||
| 	params = appendMachineParams(params, config) | 	params = appendMachineParams(params, config) | ||||||
| 	params = appendCPUModel(params, config) | 	params = appendCPUModel(params, config) | ||||||
| 	params = appendQMPSocket(params, config) | 	params = appendQMPSocket(params, config) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user