runtime: 0079-kata-runtime-fix-qemu-SCSIBus-info-not-saved-into-pe.patch 0080-kata-runtime-fix-the-block-device-not-removed-in-dev.patch 0081-kata-runtime-cut-too-long-message-in-grpc-log.patch 0082-kata-runtime-change-sandbox-state-to-unhealthy-when-.patch 0083-kata-runtime-add-removeMountBlockDevices-for-contain.patch 0084-kata-runtime-fix-validInterface-func-cause-crash-pro.patch 0085-kata-runtime-fix-kata-netmon-does-not-exit-when-cont.patch 0086-kata-runtime-add-checkCPUSet-before-create-container.patch 0087-kata-runtime-force-delete-the-sandbox-and-container.patch 0088-kata-runtime-check-sandbox-healthy-state-before-call.patch 0089-kata-add-support-for-update-iface.patch 0090-kata-set-sandbox-or-container-status-to-unhealthy.patch 0091-kata-runtime-add-sandbox-file-lock-while-call-GetSan.patch 0092-qemu-add-arm64-to-support-list-of-dimm.patch 0093-kata-runtime-add-timeout-for-grpcWaitProcessRequest.patch 0094-kata-runtime-fix-update-iface-clean-NIC-cause-route-.patch 0095-kata-runtime-fix-qemu-process-resource-resi.patch 0096-kata-containers-Move-from-query-cpus-to-query-cpus-f.patch agent: 0021-kata-agent-fix-sync-clock-not-work-problem.patch 0022-kata-agent-delete-container-id-from-sandbox-struct.patch 0023-kata-agent-modify-log-level.patch 0024-kata-agent-fix-agent.debug_console-not-work-when-bui.patch Signed-off-by: Vanient <xiadanni1@huawei.com> (cherry picked from commit f2d936028666741658157472b8de9d02187c6d55)
54 lines
1.9 KiB
Diff
54 lines
1.9 KiB
Diff
From b0097d60789a6531e07f123e0f297fd4d9f817a6 Mon Sep 17 00:00:00 2001
|
|
From: holyfei <yangfeiyu2@huawei.com>
|
|
Date: Sun, 15 Nov 2020 22:00:43 +0800
|
|
Subject: [PATCH 3/3] kata-runtime: fix the block device not removed in
|
|
devManager
|
|
|
|
reason: In the case of hotpluging the block device number exceed
|
|
the number of max capacity of sandbox, kata-runtime need to rollback
|
|
to remove the device info in the devManager, otherwise the created
|
|
device info will write into persist.json file, which leads to problem.
|
|
|
|
Conflict: NA
|
|
Reference:https://gitee.com/src-openeuler/kata-containers
|
|
Signed-off-by: holyfei <yangfeiyu2@huawei.com>
|
|
---
|
|
virtcontainers/container.go | 11 ++++++++++-
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/virtcontainers/container.go b/virtcontainers/container.go
|
|
index 1b703825..29a7fb52 100644
|
|
--- a/virtcontainers/container.go
|
|
+++ b/virtcontainers/container.go
|
|
@@ -1462,6 +1462,7 @@ func (c *Container) plugDevice(devicePath string) error {
|
|
}
|
|
|
|
if c.checkBlockDeviceSupport() && stat.Mode&unix.S_IFBLK == unix.S_IFBLK {
|
|
+ var err error
|
|
b, err := c.sandbox.devManager.NewDevice(config.DeviceInfo{
|
|
HostPath: devicePath,
|
|
ContainerPath: filepath.Join(kataGuestSharedDir(), c.id),
|
|
@@ -1473,10 +1474,18 @@ func (c *Container) plugDevice(devicePath string) error {
|
|
return fmt.Errorf("device manager failed to create rootfs device for %q: %v", devicePath, err)
|
|
}
|
|
|
|
+ defer func() {
|
|
+ if err != nil {
|
|
+ if newErr := c.sandbox.devManager.RemoveDevice(b.DeviceID()); newErr != nil {
|
|
+ c.Logger().WithError(newErr).Error("fail rollback to remove block device")
|
|
+ }
|
|
+ }
|
|
+ }()
|
|
+
|
|
c.state.BlockDeviceID = b.DeviceID()
|
|
|
|
// attach rootfs device
|
|
- if err := c.sandbox.devManager.AttachDevice(b.DeviceID(), c.sandbox); err != nil {
|
|
+ if err = c.sandbox.devManager.AttachDevice(b.DeviceID(), c.sandbox); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
--
|
|
2.23.0
|
|
|