From e3296a68f7fa270d72605dfd4eb40b1081a79969 Mon Sep 17 00:00:00 2001
From: chengzrz <czrzrichard@gmail.com>
Date: Fri, 2 Sep 2022 15:10:26 +0800
Subject: [PATCH] qmp: Don't use deprecated 'props' field for object-add

Use of the 'props' argument to 'object-add' has been deprecated since QEMU
5.0 (commit 5f07c4d60d09) in favor of flattening the properties directly
into the 'object-add' arguments.  Support for 'props' is removed entirely
in qemu 6.0 (commit 50243407457a).

reference:https://github.com/kata-containers/kata-containers/commit/d27256f8635d3fa382d6cbd9f3a60f601773c4dc

Signed-off-by: chengzrz <czrzrichard@gmail.com>
---
 .../kata-containers/govmm/qemu/qmp.go          | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qmp.go b/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qmp.go
index 97e9245..91dd732 100644
--- a/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qmp.go
+++ b/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qmp.go
@@ -1387,17 +1387,16 @@ func (q *QMP) ExecQueryCpusFast(ctx context.Context) ([]CPUInfoFast, error) {
 
 // ExecMemdevAdd adds size of MiB memory device to the guest
 func (q *QMP) ExecMemdevAdd(ctx context.Context, qomtype, id, mempath string, size int, share bool, driver, driverID string) error {
-	props := map[string]interface{}{"size": uint64(size) << 20}
 	args := map[string]interface{}{
 		"qom-type": qomtype,
 		"id":       id,
-		"props":    props,
+		"size":     uint64(size) << 20,
 	}
 	if mempath != "" {
-		props["mem-path"] = mempath
+		args["mem-path"] = mempath
 	}
 	if share {
-		props["share"] = true
+		args["share"] = true
 	}
 	err := q.executeCommand(ctx, "object-add", args, nil)
 	if err != nil {
@@ -1439,17 +1438,14 @@ func (q *QMP) ExecuteNVDIMMDeviceAdd(ctx context.Context, id, mempath string, si
 	args := map[string]interface{}{
 		"qom-type": "memory-backend-file",
 		"id":       "nvdimmbackmem" + id,
-		"props": map[string]interface{}{
-			"mem-path": mempath,
-			"size":     size,
-			"share":    true,
-		},
+		"mem-path": mempath,
+		"size":     size,
+		"share":    true,
 	}
 
 	if q.version.Major > 4 || (q.version.Major == 4 && q.version.Minor >= 1) {
 		if pmem != nil {
-			props := args["props"].(map[string]interface{})
-			props["pmem"] = *pmem
+			args["pmem"] = *pmem
 		}
 	}
 
-- 
2.25.1

