diff --git a/virtcontainers/mock_hypervisor.go b/virtcontainers/mock_hypervisor.go index c94096b12e..5952fb7f95 100644 --- a/virtcontainers/mock_hypervisor.go +++ b/virtcontainers/mock_hypervisor.go @@ -64,6 +64,9 @@ func (m *mockHypervisor) hotplugAddDevice(devInfo interface{}, devType deviceTyp switch devType { case cpuDev: return m.vCPUs, nil + case memoryDev: + memdev := devInfo.(*memoryDevice) + return memdev.sizeMB, nil } return nil, nil } diff --git a/virtcontainers/qemu_test.go b/virtcontainers/qemu_test.go index f4b96ee722..e0b7159b4e 100644 --- a/virtcontainers/qemu_test.go +++ b/virtcontainers/qemu_test.go @@ -348,8 +348,10 @@ func TestHotplugRemoveMemory(t *testing.T) { assert := assert.New(t) qemuConfig := newQemuConfig() + fs := &filesystem{} q := &qemu{ - config: qemuConfig, + config: qemuConfig, + storage: fs, } _, err := q.hotplugRemoveDevice(&memoryDevice{0, 128}, memoryDev) @@ -360,8 +362,10 @@ func TestHotplugUnsupportedDeviceType(t *testing.T) { assert := assert.New(t) qemuConfig := newQemuConfig() + fs := &filesystem{} q := &qemu{ - config: qemuConfig, + config: qemuConfig, + storage: fs, } _, err := q.hotplugAddDevice(&memoryDevice{0, 128}, fsDev)