From a0e0e18639e6a4bbaa347bf6360b5940db350ecb Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Thu, 11 Nov 2021 16:12:24 -0800 Subject: [PATCH] hypervisors: introduce pkg to unbreak vc/persist dependency Initial hypervisors pkg, with just basic state types defined. Fixes: #2883 Signed-off-by: Eric Ernst --- .../pkg/hypervisors/hypervisor_state.go | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/runtime/pkg/hypervisors/hypervisor_state.go diff --git a/src/runtime/pkg/hypervisors/hypervisor_state.go b/src/runtime/pkg/hypervisors/hypervisor_state.go new file mode 100644 index 000000000..6dae6222c --- /dev/null +++ b/src/runtime/pkg/hypervisors/hypervisor_state.go @@ -0,0 +1,50 @@ +// Copyright (c) 2019 Huawei Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// + +package hypervisors + +// Bridge is a bridge where devices can be hot plugged +type Bridge struct { + // DeviceAddr contains information about devices plugged and its address in the bridge + DeviceAddr map[uint32]string + + // Type is the type of the bridge (pci, pcie, etc) + Type string + + //ID is used to identify the bridge in the hypervisor + ID string + + // Addr is the PCI/e slot of the bridge + Addr int +} + +// CPUDevice represents a CPU device which was hot-added in a running VM +type CPUDevice struct { + // ID is used to identify this CPU in the hypervisor options. + ID string +} + +type HypervisorState struct { + BlockIndexMap map[int]struct{} + + // Type of hypervisor, E.g. qemu/firecracker/acrn. + Type string + UUID string + // clh sepcific: refer to 'virtcontainers/clh.go:CloudHypervisorState' + APISocket string + + // Belows are qemu specific + // Refs: virtcontainers/qemu.go:QemuState + Bridges []Bridge + // HotpluggedCPUs is the list of CPUs that were hot-added + HotpluggedVCPUs []CPUDevice + + HotpluggedMemory int + VirtiofsdPid int + Pid int + PCIeRootPort int + + HotplugVFIOOnRootBus bool +}