From d27256f8635d3fa382d6cbd9f3a60f601773c4dc Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 3 Aug 2021 12:52:26 +1000 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). fixes #193 Signed-off-by: David Gibson --- qemu/qmp.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/qemu/qmp.go b/qemu/qmp.go index 9ebe905b04..229a2e206b 100644 --- a/qemu/qmp.go +++ b/qemu/qmp.go @@ -1366,17 +1366,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, addr, bus 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 { @@ -1426,16 +1425,13 @@ 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 pmem != nil { - props := args["props"].(map[string]interface{}) - props["pmem"] = *pmem + args["pmem"] = *pmem } err := q.executeCommand(ctx, "object-add", args, nil)