mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
gpu: Add config settings tests for hot-plug
Updated all references and config settings for hot-plug to match cold-plug Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
de39fb7d38
commit
da42801c38
@ -114,8 +114,9 @@ type HypervisorInfo struct {
|
|||||||
Msize9p uint32
|
Msize9p uint32
|
||||||
MemorySlots uint32
|
MemorySlots uint32
|
||||||
PCIeRootPort uint32
|
PCIeRootPort uint32
|
||||||
ColdPlugVFIO hv.PCIePort
|
|
||||||
PCIeSwitchPort uint32
|
PCIeSwitchPort uint32
|
||||||
|
HotPlugVFIO hv.PCIePort
|
||||||
|
ColdPlugVFIO hv.PCIePort
|
||||||
HotplugVFIOOnRootBus bool
|
HotplugVFIOOnRootBus bool
|
||||||
Debug bool
|
Debug bool
|
||||||
}
|
}
|
||||||
@ -318,9 +319,11 @@ func getHypervisorInfo(config oci.RuntimeConfig) (HypervisorInfo, error) {
|
|||||||
EntropySource: config.HypervisorConfig.EntropySource,
|
EntropySource: config.HypervisorConfig.EntropySource,
|
||||||
SharedFS: config.HypervisorConfig.SharedFS,
|
SharedFS: config.HypervisorConfig.SharedFS,
|
||||||
VirtioFSDaemon: config.HypervisorConfig.VirtioFSDaemon,
|
VirtioFSDaemon: config.HypervisorConfig.VirtioFSDaemon,
|
||||||
|
HotPlugVFIO: config.HypervisorConfig.HotPlugVFIO,
|
||||||
ColdPlugVFIO: config.HypervisorConfig.ColdPlugVFIO,
|
ColdPlugVFIO: config.HypervisorConfig.ColdPlugVFIO,
|
||||||
HotplugVFIOOnRootBus: config.HypervisorConfig.HotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: config.HypervisorConfig.HotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: config.HypervisorConfig.PCIeRootPort,
|
PCIeRootPort: config.HypervisorConfig.PCIeRootPort,
|
||||||
|
PCIeSwitchPort: config.HypervisorConfig.PCIeSwitchPort,
|
||||||
SocketPath: socketPath,
|
SocketPath: socketPath,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ func createConfig(configPath string, fileData string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeConfig, err error) {
|
func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeConfig, err error) {
|
||||||
|
var hotPlugVFIO hv.PCIePort
|
||||||
var coldPlugVFIO hv.PCIePort
|
var coldPlugVFIO hv.PCIePort
|
||||||
const logPath = "/log/path"
|
const logPath = "/log/path"
|
||||||
hypervisorPath := filepath.Join(prefixDir, "hypervisor")
|
hypervisorPath := filepath.Join(prefixDir, "hypervisor")
|
||||||
@ -88,6 +89,8 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
|
|||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
pcieRootPort := uint32(2)
|
pcieRootPort := uint32(2)
|
||||||
|
pcieSwitchPort := uint32(2)
|
||||||
|
hotPlugVFIO = hv.BridgePort
|
||||||
coldPlugVFIO = hv.NoPort
|
coldPlugVFIO = hv.NoPort
|
||||||
disableNewNetNs := false
|
disableNewNetNs := false
|
||||||
sharedFS := "virtio-9p"
|
sharedFS := "virtio-9p"
|
||||||
@ -132,8 +135,10 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
|
|||||||
BlockDeviceDriver: blockStorageDriver,
|
BlockDeviceDriver: blockStorageDriver,
|
||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
|
HotPlugVFIO: hotPlugVFIO,
|
||||||
ColdPlugVFIO: coldPlugVFIO,
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
PCIeSwitchPort: pcieSwitchPort,
|
||||||
DisableNewNetNs: disableNewNetNs,
|
DisableNewNetNs: disableNewNetNs,
|
||||||
DefaultVCPUCount: hypConfig.NumVCPUs,
|
DefaultVCPUCount: hypConfig.NumVCPUs,
|
||||||
DefaultMaxVCPUCount: hypConfig.DefaultMaxVCPUs,
|
DefaultMaxVCPUCount: hypConfig.DefaultMaxVCPUs,
|
||||||
@ -278,6 +283,8 @@ func getExpectedHypervisor(config oci.RuntimeConfig) HypervisorInfo {
|
|||||||
|
|
||||||
HotplugVFIOOnRootBus: config.HypervisorConfig.HotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: config.HypervisorConfig.HotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: config.HypervisorConfig.PCIeRootPort,
|
PCIeRootPort: config.HypervisorConfig.PCIeRootPort,
|
||||||
|
PCIeSwitchPort: config.HypervisorConfig.PCIeSwitchPort,
|
||||||
|
HotPlugVFIO: config.HypervisorConfig.HotPlugVFIO,
|
||||||
ColdPlugVFIO: config.HypervisorConfig.ColdPlugVFIO,
|
ColdPlugVFIO: config.HypervisorConfig.ColdPlugVFIO,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +309,7 @@ func TestCreateContainerConfigFail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createAllRuntimeConfigFiles(dir, hypervisor string) (config string, err error) {
|
func createAllRuntimeConfigFiles(dir, hypervisor string) (config string, err error) {
|
||||||
|
var hotPlugVFIO hv.PCIePort
|
||||||
var coldPlugVFIO hv.PCIePort
|
var coldPlugVFIO hv.PCIePort
|
||||||
if dir == "" {
|
if dir == "" {
|
||||||
return "", fmt.Errorf("BUG: need directory")
|
return "", fmt.Errorf("BUG: need directory")
|
||||||
@ -331,9 +332,11 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config string, err err
|
|||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
pcieRootPort := uint32(2)
|
pcieRootPort := uint32(2)
|
||||||
|
pcieSwitchPort := uint32(3)
|
||||||
disableNewNetNs := false
|
disableNewNetNs := false
|
||||||
sharedFS := "virtio-9p"
|
sharedFS := "virtio-9p"
|
||||||
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
||||||
|
hotPlugVFIO = hv.BridgePort
|
||||||
coldPlugVFIO = hv.RootPort
|
coldPlugVFIO = hv.RootPort
|
||||||
|
|
||||||
configFileOptions := ktu.RuntimeConfigOptions{
|
configFileOptions := ktu.RuntimeConfigOptions{
|
||||||
@ -350,9 +353,11 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config string, err err
|
|||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
PCIeSwitchPort: pcieSwitchPort,
|
||||||
DisableNewNetNs: disableNewNetNs,
|
DisableNewNetNs: disableNewNetNs,
|
||||||
SharedFS: sharedFS,
|
SharedFS: sharedFS,
|
||||||
VirtioFSDaemon: virtioFSdaemon,
|
VirtioFSDaemon: virtioFSdaemon,
|
||||||
|
HotPlugVFIO: hotPlugVFIO,
|
||||||
ColdPlugVFIO: coldPlugVFIO,
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,13 +45,13 @@ const (
|
|||||||
func (p PCIePort) String() string {
|
func (p PCIePort) String() string {
|
||||||
switch p {
|
switch p {
|
||||||
case RootPort:
|
case RootPort:
|
||||||
return "root-port"
|
fallthrough
|
||||||
case SwitchPort:
|
case SwitchPort:
|
||||||
return "switch-port"
|
fallthrough
|
||||||
case BridgePort:
|
case BridgePort:
|
||||||
return "bridge-port"
|
fallthrough
|
||||||
case NoPort:
|
case NoPort:
|
||||||
return "no-port"
|
return string(p)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("<unknown PCIePort: %s>", string(p))
|
return fmt.Sprintf("<unknown PCIePort: %s>", string(p))
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ type HypervisorState struct {
|
|||||||
Pid int
|
Pid int
|
||||||
PCIeRootPort int
|
PCIeRootPort int
|
||||||
PCIeSwitchPort int
|
PCIeSwitchPort int
|
||||||
ColdPlugVFIO PCIePort
|
|
||||||
HotPlugVFIO PCIePort
|
HotPlugVFIO PCIePort
|
||||||
|
ColdPlugVFIO PCIePort
|
||||||
HotplugVFIOOnRootBus bool
|
HotplugVFIOOnRootBus bool
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,8 @@ type RuntimeConfigOptions struct {
|
|||||||
JaegerPassword string
|
JaegerPassword string
|
||||||
PFlash []string
|
PFlash []string
|
||||||
PCIeRootPort uint32
|
PCIeRootPort uint32
|
||||||
|
PCIeSwitchPort uint32
|
||||||
|
HotPlugVFIO hv.PCIePort
|
||||||
ColdPlugVFIO hv.PCIePort
|
ColdPlugVFIO hv.PCIePort
|
||||||
DefaultVCPUCount uint32
|
DefaultVCPUCount uint32
|
||||||
DefaultMaxVCPUCount uint32
|
DefaultMaxVCPUCount uint32
|
||||||
@ -319,6 +321,7 @@ func MakeRuntimeConfigFileData(config RuntimeConfigOptions) string {
|
|||||||
enable_iothreads = ` + strconv.FormatBool(config.EnableIOThreads) + `
|
enable_iothreads = ` + strconv.FormatBool(config.EnableIOThreads) + `
|
||||||
hotplug_vfio_on_root_bus = ` + strconv.FormatBool(config.HotplugVFIOOnRootBus) + `
|
hotplug_vfio_on_root_bus = ` + strconv.FormatBool(config.HotplugVFIOOnRootBus) + `
|
||||||
pcie_root_port = ` + strconv.FormatUint(uint64(config.PCIeRootPort), 10) + `
|
pcie_root_port = ` + strconv.FormatUint(uint64(config.PCIeRootPort), 10) + `
|
||||||
|
pcie_switch_port = ` + strconv.FormatUint(uint64(config.PCIeSwitchPort), 10) + `
|
||||||
cold_plug_vfio = "` + config.ColdPlugVFIO.String() + `"
|
cold_plug_vfio = "` + config.ColdPlugVFIO.String() + `"
|
||||||
msize_9p = ` + strconv.FormatUint(uint64(config.DefaultMsize9p), 10) + `
|
msize_9p = ` + strconv.FormatUint(uint64(config.DefaultMsize9p), 10) + `
|
||||||
enable_debug = ` + strconv.FormatBool(config.HypervisorDebug) + `
|
enable_debug = ` + strconv.FormatBool(config.HypervisorDebug) + `
|
||||||
|
@ -83,6 +83,7 @@ const defaultDisableNestingChecks bool = false
|
|||||||
const defaultMsize9p uint32 = 8192
|
const defaultMsize9p uint32 = 8192
|
||||||
const defaultHotplugVFIOOnRootBus bool = false
|
const defaultHotplugVFIOOnRootBus bool = false
|
||||||
const defaultPCIeRootPort = 0
|
const defaultPCIeRootPort = 0
|
||||||
|
const defaultPCIeSwitchPort = 0
|
||||||
const defaultEntropySource = "/dev/urandom"
|
const defaultEntropySource = "/dev/urandom"
|
||||||
const defaultGuestHookPath string = ""
|
const defaultGuestHookPath string = ""
|
||||||
const defaultVirtioFSCacheMode = "never"
|
const defaultVirtioFSCacheMode = "never"
|
||||||
@ -108,6 +109,7 @@ const defaultVMCacheEndpoint string = "/var/run/kata-containers/cache.sock"
|
|||||||
// Default config file used by stateless systems.
|
// Default config file used by stateless systems.
|
||||||
var defaultRuntimeConfiguration = "@CONFIG_PATH@"
|
var defaultRuntimeConfiguration = "@CONFIG_PATH@"
|
||||||
|
|
||||||
const defaultColdPlugVFIO = hv.NoPort
|
|
||||||
const defaultHotPlugVFIO = hv.BridgePort
|
const defaultHotPlugVFIO = hv.BridgePort
|
||||||
const defaultPCIeSwitchPort = 0
|
const defaultColdPlugVFIO = hv.NoPort
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ type hypervisor struct {
|
|||||||
EnableIOThreads bool `toml:"enable_iothreads"`
|
EnableIOThreads bool `toml:"enable_iothreads"`
|
||||||
DisableImageNvdimm bool `toml:"disable_image_nvdimm"`
|
DisableImageNvdimm bool `toml:"disable_image_nvdimm"`
|
||||||
HotplugVFIOOnRootBus bool `toml:"hotplug_vfio_on_root_bus"`
|
HotplugVFIOOnRootBus bool `toml:"hotplug_vfio_on_root_bus"`
|
||||||
HotPlugVFIO hv.PCIePort `toml:"hotplug_vfio"`
|
HotPlugVFIO hv.PCIePort `toml:"hot_plug_vfio"`
|
||||||
ColdPlugVFIO hv.PCIePort `toml:"cold_plug_vfio"`
|
ColdPlugVFIO hv.PCIePort `toml:"cold_plug_vfio"`
|
||||||
DisableVhostNet bool `toml:"disable_vhost_net"`
|
DisableVhostNet bool `toml:"disable_vhost_net"`
|
||||||
GuestMemoryDumpPaging bool `toml:"guest_memory_dump_paging"`
|
GuestMemoryDumpPaging bool `toml:"guest_memory_dump_paging"`
|
||||||
@ -870,8 +870,8 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
Msize9p: h.msize9p(),
|
Msize9p: h.msize9p(),
|
||||||
DisableImageNvdimm: h.DisableImageNvdimm,
|
DisableImageNvdimm: h.DisableImageNvdimm,
|
||||||
HotplugVFIOOnRootBus: h.HotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: h.HotplugVFIOOnRootBus,
|
||||||
|
HotPlugVFIO: h.hotPlugVFIO(),
|
||||||
ColdPlugVFIO: h.coldPlugVFIO(),
|
ColdPlugVFIO: h.coldPlugVFIO(),
|
||||||
HotPlugVFIO: h.HotPlugVFIO,
|
|
||||||
PCIeRootPort: h.PCIeRootPort,
|
PCIeRootPort: h.PCIeRootPort,
|
||||||
PCIeSwitchPort: h.PCIeSwitchPort,
|
PCIeSwitchPort: h.PCIeSwitchPort,
|
||||||
DisableVhostNet: h.DisableVhostNet,
|
DisableVhostNet: h.DisableVhostNet,
|
||||||
@ -1674,11 +1674,15 @@ func checkConfig(config oci.RuntimeConfig) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hotPlugVFIO := config.HypervisorConfig.HotPlugVFIO
|
||||||
coldPlugVFIO := config.HypervisorConfig.ColdPlugVFIO
|
coldPlugVFIO := config.HypervisorConfig.ColdPlugVFIO
|
||||||
machineType := config.HypervisorConfig.HypervisorMachineType
|
machineType := config.HypervisorConfig.HypervisorMachineType
|
||||||
if err := checkPCIeConfig(coldPlugVFIO, machineType); err != nil {
|
if err := checkPCIeConfig(coldPlugVFIO, machineType); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := checkPCIeConfig(hotPlugVFIO, machineType); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1692,12 +1696,13 @@ func checkPCIeConfig(vfioPort hv.PCIePort, machineType string) error {
|
|||||||
if machineType != "q35" {
|
if machineType != "q35" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if vfioPort == hv.NoPort || vfioPort == hv.RootPort || vfioPort == hv.SwitchPort {
|
if vfioPort == hv.NoPort || vfioPort == hv.BridgePort ||
|
||||||
|
vfioPort == hv.RootPort || vfioPort == hv.SwitchPort {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("invalid vfio_port=%s setting, allowed values %s, %s, %s",
|
return fmt.Errorf("invalid vfio_port=%s setting, allowed values %s, %s, %s, %s",
|
||||||
vfioPort, hv.NoPort, hv.RootPort, hv.SwitchPort)
|
vfioPort, hv.NoPort, hv.BridgePort, hv.RootPort, hv.SwitchPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkNetNsConfig performs sanity checks on disable_new_netns config.
|
// checkNetNsConfig performs sanity checks on disable_new_netns config.
|
||||||
|
@ -71,6 +71,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
if hypervisor == "" {
|
if hypervisor == "" {
|
||||||
return config, fmt.Errorf("BUG: need hypervisor")
|
return config, fmt.Errorf("BUG: need hypervisor")
|
||||||
}
|
}
|
||||||
|
var hotPlugVFIO hv.PCIePort
|
||||||
var coldPlugVFIO hv.PCIePort
|
var coldPlugVFIO hv.PCIePort
|
||||||
hypervisorPath := path.Join(dir, "hypervisor")
|
hypervisorPath := path.Join(dir, "hypervisor")
|
||||||
kernelPath := path.Join(dir, "kernel")
|
kernelPath := path.Join(dir, "kernel")
|
||||||
@ -86,6 +87,8 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
pcieRootPort := uint32(2)
|
pcieRootPort := uint32(2)
|
||||||
|
pcieSwitchPort := uint32(3)
|
||||||
|
hotPlugVFIO = hv.BridgePort
|
||||||
coldPlugVFIO = hv.RootPort
|
coldPlugVFIO = hv.RootPort
|
||||||
disableNewNetNs := false
|
disableNewNetNs := false
|
||||||
sharedFS := "virtio-9p"
|
sharedFS := "virtio-9p"
|
||||||
@ -109,6 +112,8 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
PCIeSwitchPort: pcieSwitchPort,
|
||||||
|
HotPlugVFIO: hotPlugVFIO,
|
||||||
ColdPlugVFIO: coldPlugVFIO,
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
DisableNewNetNs: disableNewNetNs,
|
DisableNewNetNs: disableNewNetNs,
|
||||||
DefaultVCPUCount: defaultVCPUCount,
|
DefaultVCPUCount: defaultVCPUCount,
|
||||||
@ -173,6 +178,8 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
PCIeSwitchPort: pcieSwitchPort,
|
||||||
|
HotPlugVFIO: hotPlugVFIO,
|
||||||
ColdPlugVFIO: coldPlugVFIO,
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
Msize9p: defaultMsize9p,
|
Msize9p: defaultMsize9p,
|
||||||
MemSlots: defaultMemSlots,
|
MemSlots: defaultMemSlots,
|
||||||
@ -566,9 +573,9 @@ func TestMinimalRuntimeConfig(t *testing.T) {
|
|||||||
GuestHookPath: defaultGuestHookPath,
|
GuestHookPath: defaultGuestHookPath,
|
||||||
VhostUserStorePath: defaultVhostUserStorePath,
|
VhostUserStorePath: defaultVhostUserStorePath,
|
||||||
VirtioFSCache: defaultVirtioFSCacheMode,
|
VirtioFSCache: defaultVirtioFSCacheMode,
|
||||||
HotPlugVFIO: defaultHotPlugVFIO,
|
|
||||||
BlockDeviceAIO: defaultBlockDeviceAIO,
|
BlockDeviceAIO: defaultBlockDeviceAIO,
|
||||||
DisableGuestSeLinux: defaultDisableGuestSeLinux,
|
DisableGuestSeLinux: defaultDisableGuestSeLinux,
|
||||||
|
HotPlugVFIO: defaultHotPlugVFIO,
|
||||||
ColdPlugVFIO: defaultColdPlugVFIO,
|
ColdPlugVFIO: defaultColdPlugVFIO,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,11 +289,19 @@ type HypervisorConfig struct {
|
|||||||
HotplugVFIOOnRootBus bool
|
HotplugVFIOOnRootBus bool
|
||||||
|
|
||||||
// PCIeRootPort is used to indicate the number of PCIe Root Port devices
|
// PCIeRootPort is used to indicate the number of PCIe Root Port devices
|
||||||
// The PCIe Root Port device is used to hot-plug the PCIe device
|
// The PCIe Root Port device is used to hot(cold)-plug the PCIe device
|
||||||
PCIeRootPort uint32
|
PCIeRootPort uint32
|
||||||
|
|
||||||
|
// PCIeSwitchPort is used to indicate the number of PCIe Switch Ports
|
||||||
|
// The PCIe Switch port is used to hot(cold)-plug the PCIe device
|
||||||
|
PCIeSwitchPort uint32
|
||||||
|
|
||||||
|
// HotPlugVFIO is used to indicate if devices need to be hotplugged on the
|
||||||
|
// root port, switch, bridge or no port
|
||||||
|
HotPlugVFIO hv.PCIePort
|
||||||
|
|
||||||
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
|
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
|
||||||
// root port, switch or no port
|
// root port, switch, bridge or no port
|
||||||
ColdPlugVFIO hv.PCIePort
|
ColdPlugVFIO hv.PCIePort
|
||||||
|
|
||||||
// BootToBeTemplate used to indicate if the VM is created to be a template VM
|
// BootToBeTemplate used to indicate if the VM is created to be a template VM
|
||||||
|
@ -516,14 +516,15 @@ type HypervisorConfig struct {
|
|||||||
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
|
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
|
||||||
// root port, switch or no port
|
// root port, switch or no port
|
||||||
ColdPlugVFIO hv.PCIePort
|
ColdPlugVFIO hv.PCIePort
|
||||||
// PCIeSwitchPort is used to indicate the number of PCIe Switch devices
|
|
||||||
// The PCIe Switch Port device is sued to hot-plug PCIe devices
|
|
||||||
PCIeSwitchPort uint32
|
|
||||||
|
|
||||||
// PCIeRootPort is used to indicate the number of PCIe Root Port devices
|
// PCIeRootPort is used to indicate the number of PCIe Root Port devices
|
||||||
// The PCIe Root Port device is used to hot-plug the PCIe device
|
// The PCIe Root Port device is used to hot-plug the PCIe device
|
||||||
PCIeRootPort uint32
|
PCIeRootPort uint32
|
||||||
|
|
||||||
|
// PCIeSwitchPort is used to indicate the number of PCIe Switch devices
|
||||||
|
// The PCIe Switch Port device is sued to hot-plug PCIe devices
|
||||||
|
PCIeSwitchPort uint32
|
||||||
|
|
||||||
// NumVCPUs specifies default number of vCPUs for the VM.
|
// NumVCPUs specifies default number of vCPUs for the VM.
|
||||||
NumVCPUs uint32
|
NumVCPUs uint32
|
||||||
|
|
||||||
|
@ -488,8 +488,10 @@ func loadSandboxConfig(id string) (*SandboxConfig, error) {
|
|||||||
DisableNestingChecks: hconf.DisableNestingChecks,
|
DisableNestingChecks: hconf.DisableNestingChecks,
|
||||||
DisableImageNvdimm: hconf.DisableImageNvdimm,
|
DisableImageNvdimm: hconf.DisableImageNvdimm,
|
||||||
HotplugVFIOOnRootBus: hconf.HotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hconf.HotplugVFIOOnRootBus,
|
||||||
|
HotPlugVFIO: hconf.HotPlugVFIO,
|
||||||
ColdPlugVFIO: hconf.ColdPlugVFIO,
|
ColdPlugVFIO: hconf.ColdPlugVFIO,
|
||||||
PCIeRootPort: hconf.PCIeRootPort,
|
PCIeRootPort: hconf.PCIeRootPort,
|
||||||
|
PCIeSwitchPort: hconf.PCIeSwitchPort,
|
||||||
BootToBeTemplate: hconf.BootToBeTemplate,
|
BootToBeTemplate: hconf.BootToBeTemplate,
|
||||||
BootFromTemplate: hconf.BootFromTemplate,
|
BootFromTemplate: hconf.BootFromTemplate,
|
||||||
DisableVhostNet: hconf.DisableVhostNet,
|
DisableVhostNet: hconf.DisableVhostNet,
|
||||||
|
@ -203,8 +203,12 @@ type HypervisorConfig struct {
|
|||||||
// root bus instead of a bridge.
|
// root bus instead of a bridge.
|
||||||
HotplugVFIOOnRootBus bool
|
HotplugVFIOOnRootBus bool
|
||||||
|
|
||||||
|
// HotPlugVFIO is used to indicate if devices need to be hotplugged on the
|
||||||
|
// root, switch, bridge or no-port
|
||||||
|
HotPlugVFIO hv.PCIePort
|
||||||
|
|
||||||
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
|
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
|
||||||
// root port or a switch or no-port
|
// root, bridge, switch or no-port
|
||||||
ColdPlugVFIO hv.PCIePort
|
ColdPlugVFIO hv.PCIePort
|
||||||
|
|
||||||
// BootToBeTemplate used to indicate if the VM is created to be a template VM
|
// BootToBeTemplate used to indicate if the VM is created to be a template VM
|
||||||
|
@ -84,6 +84,7 @@ type QemuState struct {
|
|||||||
PCIeRootPort int
|
PCIeRootPort int
|
||||||
PCIeSwitchPort int
|
PCIeSwitchPort int
|
||||||
HotplugVFIOOnRootBus bool
|
HotplugVFIOOnRootBus bool
|
||||||
|
HotplugVFIO hv.PCIePort
|
||||||
ColdPlugVFIO hv.PCIePort
|
ColdPlugVFIO hv.PCIePort
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +284,7 @@ func (q *qemu) setup(ctx context.Context, id string, hypervisorConfig *Hyperviso
|
|||||||
|
|
||||||
q.Logger().Debug("Creating UUID")
|
q.Logger().Debug("Creating UUID")
|
||||||
q.state.UUID = uuid.Generate().String()
|
q.state.UUID = uuid.Generate().String()
|
||||||
|
q.state.HotPlugVFIO = q.config.HotPlugVFIO
|
||||||
q.state.ColdPlugVFIO = q.config.ColdPlugVFIO
|
q.state.ColdPlugVFIO = q.config.ColdPlugVFIO
|
||||||
q.state.HotplugVFIOOnRootBus = q.config.HotplugVFIOOnRootBus
|
q.state.HotplugVFIOOnRootBus = q.config.HotplugVFIOOnRootBus
|
||||||
q.state.PCIeRootPort = int(q.config.PCIeRootPort)
|
q.state.PCIeRootPort = int(q.config.PCIeRootPort)
|
||||||
|
Loading…
Reference in New Issue
Block a user