qmp: fix mem-path properties for hotplug memory.

The QMP command 'object-add' only has three arguments: 'qom-type'
'id' and 'props', thus 'mem-path' has to be saved in 'props'.
https://github.com/qemu/qemu/blob/stable-2.0/qapi-schema.json#L2958
https://github.com/qemu/qemu/blob/stable-2.12/qapi/misc.json#L1846

Signed-off-by: NingBo <ning.bo9@zte.com.cn>
This commit is contained in:
NingBo 2018-11-27 15:38:57 +08:00
parent 99e0358ba9
commit 7da6a4c7c6

View File

@ -1170,13 +1170,14 @@ func (q *QMP) ExecQueryCpusFast(ctx context.Context) ([]CPUInfoFast, error) {
// ExecHotplugMemory adds size of MiB memory to the guest
func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string, size int) error {
props := map[string]interface{}{"size": uint64(size) << 20}
args := map[string]interface{}{
"qom-type": qomtype,
"id": id,
"props": map[string]interface{}{"size": uint64(size) << 20},
"props": props,
}
if mempath != "" {
args["mem-path"] = mempath
props["mem-path"] = mempath
}
err := q.executeCommand(ctx, "object-add", args, nil)
if err != nil {