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:
Zvonko Kaiser
2023-05-08 08:00:39 +00:00
parent de39fb7d38
commit da42801c38
13 changed files with 69 additions and 21 deletions

View File

@@ -289,11 +289,19 @@ type HypervisorConfig struct {
HotplugVFIOOnRootBus bool
// 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
// 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
// root port, switch or no port
// root port, switch, bridge or no port
ColdPlugVFIO hv.PCIePort
// BootToBeTemplate used to indicate if the VM is created to be a template VM

View File

@@ -516,14 +516,15 @@ type HypervisorConfig struct {
// ColdPlugVFIO is used to indicate if devices need to be coldplugged on the
// root port, switch or no port
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
// The PCIe Root Port device is used to hot-plug the PCIe device
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 uint32

View File

@@ -488,8 +488,10 @@ func loadSandboxConfig(id string) (*SandboxConfig, error) {
DisableNestingChecks: hconf.DisableNestingChecks,
DisableImageNvdimm: hconf.DisableImageNvdimm,
HotplugVFIOOnRootBus: hconf.HotplugVFIOOnRootBus,
HotPlugVFIO: hconf.HotPlugVFIO,
ColdPlugVFIO: hconf.ColdPlugVFIO,
PCIeRootPort: hconf.PCIeRootPort,
PCIeSwitchPort: hconf.PCIeSwitchPort,
BootToBeTemplate: hconf.BootToBeTemplate,
BootFromTemplate: hconf.BootFromTemplate,
DisableVhostNet: hconf.DisableVhostNet,

View File

@@ -203,8 +203,12 @@ type HypervisorConfig struct {
// root bus instead of a bridge.
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
// root port or a switch or no-port
// root, bridge, switch or no-port
ColdPlugVFIO hv.PCIePort
// BootToBeTemplate used to indicate if the VM is created to be a template VM

View File

@@ -84,6 +84,7 @@ type QemuState struct {
PCIeRootPort int
PCIeSwitchPort int
HotplugVFIOOnRootBus bool
HotplugVFIO 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.state.UUID = uuid.Generate().String()
q.state.HotPlugVFIO = q.config.HotPlugVFIO
q.state.ColdPlugVFIO = q.config.ColdPlugVFIO
q.state.HotplugVFIOOnRootBus = q.config.HotplugVFIOOnRootBus
q.state.PCIeRootPort = int(q.config.PCIeRootPort)