From 8138a16b8b7a6cab74bcc0a2c6f5fde1fb16820d Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Fri, 18 Jun 2021 09:02:03 -0500 Subject: [PATCH] runtime: do not hot-remove PMEM devices PMEM devices cannot be hot-removed from a running VM. fixes #2018 Signed-off-by: Julio Montes --- src/runtime/virtcontainers/sandbox.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/virtcontainers/sandbox.go b/src/runtime/virtcontainers/sandbox.go index 95f68bfeb8..dc4d3bf731 100644 --- a/src/runtime/virtcontainers/sandbox.go +++ b/src/runtime/virtcontainers/sandbox.go @@ -1711,6 +1711,11 @@ func (s *Sandbox) HotplugRemoveDevice(ctx context.Context, device api.Device, de if !ok { return fmt.Errorf("device type mismatch, expect device type to be %s", devType) } + // PMEM devices cannot be hot removed + if blockDrive.Pmem { + s.Logger().WithField("path", blockDrive.File).Infof("Skip device: cannot hot remove PMEM devices") + return nil + } _, err := s.hypervisor.hotplugRemoveDevice(ctx, blockDrive, blockDev) return err case config.VhostUserBlk: