From 617e5e4e25e6238b04887135e8a6415f9c17c15d Mon Sep 17 00:00:00 2001 From: Hui Zhu Date: Fri, 7 Dec 2018 19:10:29 +0800 Subject: [PATCH] vendor: Update govmm vendoring Shortlog: 97fc343 contributors: add my name c891f5f qmp: Add nvdimm support Fixes #991 Signed-off-by: Hui Zhu --- Gopkg.lock | 4 +-- Gopkg.toml | 2 +- vendor/github.com/intel/govmm/CONTRIBUTORS.md | 1 + vendor/github.com/intel/govmm/qemu/qmp.go | 36 +++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 9827044b23..39f9671e2a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -238,11 +238,11 @@ revision = "3520598351bb3500a49ae9563f5539666ae0a27c" [[projects]] - digest = "1:40227c1b7841f35c5965b955b21cc84f3990b9b972d3224e5e31ba20a3dc1f37" + digest = "1:15f0da05538e2445b354c620555231448849b7ece222c45578668d0dfd6bec93" name = "github.com/intel/govmm" packages = ["qemu"] pruneopts = "NUT" - revision = "32f64a0630c7602d536be2a9c83bc3eee160359b" + revision = "737f03de595e216116264cc74a58e5f2a1df789a" [[projects]] digest = "1:e96806ae1b041a36386249b22ef9eaf5af1788c0f86f686c6296e5a9caf53df8" diff --git a/Gopkg.toml b/Gopkg.toml index 2a91d0c54d..6a0c1f338d 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -52,7 +52,7 @@ [[constraint]] name = "github.com/intel/govmm" - revision = "32f64a0630c7602d536be2a9c83bc3eee160359b" + revision = "737f03de595e216116264cc74a58e5f2a1df789a" [[constraint]] name = "github.com/kata-containers/agent" diff --git a/vendor/github.com/intel/govmm/CONTRIBUTORS.md b/vendor/github.com/intel/govmm/CONTRIBUTORS.md index c159b9a1f0..7a822adbe0 100644 --- a/vendor/github.com/intel/govmm/CONTRIBUTORS.md +++ b/vendor/github.com/intel/govmm/CONTRIBUTORS.md @@ -18,4 +18,5 @@ themselves (or their employer, as appropriate). - robert.bradford@intel.com - sameo@linux.intel.com - sebastien.boeuf@intel.com +- teawater@hyper.sh - xinda.zhao@intel.com diff --git a/vendor/github.com/intel/govmm/qemu/qmp.go b/vendor/github.com/intel/govmm/qemu/qmp.go index 65557b7fa5..6e4d4f3559 100644 --- a/vendor/github.com/intel/govmm/qemu/qmp.go +++ b/vendor/github.com/intel/govmm/qemu/qmp.go @@ -1307,6 +1307,42 @@ func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string return err } +// ExecuteNVDIMMDeviceAdd adds a block device to a QEMU instance using +// a NVDIMM driver with the device_add command. +// id is the id of the device to add. It must be a valid QMP identifier. +// mempath is the path of the device to add, e.g., /dev/rdb0. size is +// the data size of the device. +func (q *QMP) ExecuteNVDIMMDeviceAdd(ctx context.Context, id, mempath string, size int64) error { + args := map[string]interface{}{ + "qom-type": "memory-backend-file", + "id": "nvdimmbackmem" + id, + "props": map[string]interface{}{ + "mem-path": mempath, + "size": size, + "share": true, + }, + } + err := q.executeCommand(ctx, "object-add", args, nil) + if err != nil { + return err + } + + args = map[string]interface{}{ + "driver": "nvdimm", + "id": "nvdimm" + id, + "memdev": "nvdimmbackmem" + id, + } + if err = q.executeCommand(ctx, "device_add", args, nil); err != nil { + q.cfg.Logger.Errorf("Unable to hotplug NVDIMM device: %v", err) + err2 := q.executeCommand(ctx, "object-del", map[string]interface{}{"id": "nvdimmbackmem" + id}, nil) + if err2 != nil { + q.cfg.Logger.Warningf("Unable to clean up memory object: %v", err2) + } + } + + return err +} + // ExecuteBalloon sets the size of the balloon, hence updates the memory // allocated for the VM. func (q *QMP) ExecuteBalloon(ctx context.Context, bytes uint64) error {