mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
hypervisors: Confidential Guests do not support Device hotplug
Similarly to VCPUs hotplug, Confidential Guests also do not support Device hotplug. Let's make it clear in the documentation and guard the code on both QEMU and Cloud Hypervisor side to ensure we don't advertise Device hotplug as being supported when running Confidential Guests. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
28c4c044e6
commit
df8ffecde0
@ -24,6 +24,7 @@ image = "@IMAGEPATH@"
|
|||||||
# Known limitations:
|
# Known limitations:
|
||||||
# * Does not work by design:
|
# * Does not work by design:
|
||||||
# - CPU Hotplug
|
# - CPU Hotplug
|
||||||
|
# - Device Hotplug
|
||||||
#
|
#
|
||||||
# Default false
|
# Default false
|
||||||
# confidential_guest = true
|
# confidential_guest = true
|
||||||
|
@ -25,6 +25,7 @@ machine_type = "@MACHINETYPE@"
|
|||||||
# Known limitations:
|
# Known limitations:
|
||||||
# * Does not work by design:
|
# * Does not work by design:
|
||||||
# - CPU Hotplug
|
# - CPU Hotplug
|
||||||
|
# - Device Hotplug
|
||||||
#
|
#
|
||||||
# Default false
|
# Default false
|
||||||
# confidential_guest = true
|
# confidential_guest = true
|
||||||
|
@ -589,6 +589,10 @@ func (clh *cloudHypervisor) HotplugAddDevice(ctx context.Context, devInfo interf
|
|||||||
span, _ := katatrace.Trace(ctx, clh.Logger(), "HotplugAddDevice", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
span, _ := katatrace.Trace(ctx, clh.Logger(), "HotplugAddDevice", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
if clh.config.ConfidentialGuest {
|
||||||
|
return nil, errors.New("Device hotplug addition is not supported in confidential mode")
|
||||||
|
}
|
||||||
|
|
||||||
switch devType {
|
switch devType {
|
||||||
case BlockDev:
|
case BlockDev:
|
||||||
drive := devInfo.(*config.BlockDrive)
|
drive := devInfo.(*config.BlockDrive)
|
||||||
@ -606,6 +610,10 @@ func (clh *cloudHypervisor) HotplugRemoveDevice(ctx context.Context, devInfo int
|
|||||||
span, _ := katatrace.Trace(ctx, clh.Logger(), "HotplugRemoveDevice", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
span, _ := katatrace.Trace(ctx, clh.Logger(), "HotplugRemoveDevice", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
if clh.config.ConfidentialGuest {
|
||||||
|
return nil, errors.New("Device hotplug addition is not supported in confidential mode")
|
||||||
|
}
|
||||||
|
|
||||||
var deviceID string
|
var deviceID string
|
||||||
|
|
||||||
switch devType {
|
switch devType {
|
||||||
@ -860,7 +868,9 @@ func (clh *cloudHypervisor) Capabilities(ctx context.Context) types.Capabilities
|
|||||||
clh.Logger().WithField("function", "Capabilities").Info("get Capabilities")
|
clh.Logger().WithField("function", "Capabilities").Info("get Capabilities")
|
||||||
var caps types.Capabilities
|
var caps types.Capabilities
|
||||||
caps.SetFsSharingSupport()
|
caps.SetFsSharingSupport()
|
||||||
|
if !clh.config.ConfidentialGuest {
|
||||||
caps.SetBlockDeviceHotplugSupport()
|
caps.SetBlockDeviceHotplugSupport()
|
||||||
|
}
|
||||||
return caps
|
return caps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +153,9 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) {
|
|||||||
func (q *qemuAmd64) capabilities() types.Capabilities {
|
func (q *qemuAmd64) capabilities() types.Capabilities {
|
||||||
var caps types.Capabilities
|
var caps types.Capabilities
|
||||||
|
|
||||||
if q.qemuMachine.Type == QemuQ35 ||
|
if (q.qemuMachine.Type == QemuQ35 ||
|
||||||
q.qemuMachine.Type == QemuVirt {
|
q.qemuMachine.Type == QemuVirt) &&
|
||||||
|
q.protection == noneProtection {
|
||||||
caps.SetBlockDeviceHotplugSupport()
|
caps.SetBlockDeviceHotplugSupport()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,9 @@ func (q *qemuArchBase) kernelParameters(debug bool) []Param {
|
|||||||
|
|
||||||
func (q *qemuArchBase) capabilities() types.Capabilities {
|
func (q *qemuArchBase) capabilities() types.Capabilities {
|
||||||
var caps types.Capabilities
|
var caps types.Capabilities
|
||||||
|
if q.protection == noneProtection {
|
||||||
caps.SetBlockDeviceHotplugSupport()
|
caps.SetBlockDeviceHotplugSupport()
|
||||||
|
}
|
||||||
caps.SetMultiQueueSupport()
|
caps.SetMultiQueueSupport()
|
||||||
caps.SetFsSharingSupport()
|
caps.SetFsSharingSupport()
|
||||||
return caps
|
return caps
|
||||||
|
@ -96,7 +96,8 @@ func (q *qemuPPC64le) capabilities() types.Capabilities {
|
|||||||
var caps types.Capabilities
|
var caps types.Capabilities
|
||||||
|
|
||||||
// pseries machine type supports hotplugging drives
|
// pseries machine type supports hotplugging drives
|
||||||
if q.qemuMachine.Type == QemuPseries {
|
if q.qemuMachine.Type == QemuPseries &&
|
||||||
|
q.protection == noneProtection {
|
||||||
caps.SetBlockDeviceHotplugSupport()
|
caps.SetBlockDeviceHotplugSupport()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user