mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 17:37:20 +00:00 
			
		
		
		
	runtime: Check config for supported CLH (cold|hot)_plug_vfio values
The only supported options are hot_plug_vfio=root-port or no-port. cold_plug_vfio not supported yet. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
		| @@ -1680,8 +1680,8 @@ func checkConfig(config oci.RuntimeConfig) error { | |||||||
| // Only allow one of the following settings for cold-plug: | // Only allow one of the following settings for cold-plug: | ||||||
| // no-port, root-port, switch-port | // no-port, root-port, switch-port | ||||||
| func checkPCIeConfig(coldPlug config.PCIePort, hotPlug config.PCIePort, machineType string, hypervisorType virtcontainers.HypervisorType) error { | func checkPCIeConfig(coldPlug config.PCIePort, hotPlug config.PCIePort, machineType string, hypervisorType virtcontainers.HypervisorType) error { | ||||||
| 	if hypervisorType != virtcontainers.QemuHypervisor { | 	if hypervisorType != virtcontainers.QemuHypervisor && hypervisorType != virtcontainers.ClhHypervisor { | ||||||
| 		kataUtilsLogger.Warn("Advanced PCIe Topology only available for QEMU hypervisor, ignoring hot(cold)_vfio_port setting") | 		kataUtilsLogger.Warn("Advanced PCIe Topology only available for QEMU/CLH hypervisor, ignoring hot(cold)_vfio_port setting") | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -1696,6 +1696,14 @@ func checkPCIeConfig(coldPlug config.PCIePort, hotPlug config.PCIePort, machineT | |||||||
| 	if machineType != "q35" && machineType != "virt" { | 	if machineType != "q35" && machineType != "virt" { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  | 	if hypervisorType == virtcontainers.ClhHypervisor { | ||||||
|  | 		if coldPlug != config.NoPort { | ||||||
|  | 			return fmt.Errorf("cold-plug not supported on CLH") | ||||||
|  | 		} | ||||||
|  | 		if hotPlug != config.RootPort { | ||||||
|  | 			return fmt.Errorf("only hot-plug=%s supported on CLH", config.RootPort) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	var port config.PCIePort | 	var port config.PCIePort | ||||||
| 	if coldPlug != config.NoPort { | 	if coldPlug != config.NoPort { | ||||||
|   | |||||||
| @@ -68,6 +68,7 @@ func newClhConfig() (HypervisorConfig, error) { | |||||||
| 		NetRateLimiterBwOneTimeBurst:  int64(0), | 		NetRateLimiterBwOneTimeBurst:  int64(0), | ||||||
| 		NetRateLimiterOpsMaxRate:      int64(0), | 		NetRateLimiterOpsMaxRate:      int64(0), | ||||||
| 		NetRateLimiterOpsOneTimeBurst: int64(0), | 		NetRateLimiterOpsOneTimeBurst: int64(0), | ||||||
|  | 		HotPlugVFIO:                   config.NoPort, | ||||||
| 	}, nil | 	}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user