mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
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 <david@gibson.dropbear.id.au>
This commit is contained in:
parent
d8cdf9aa2a
commit
d27256f863
18
qemu/qmp.go
18
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
|
// 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 {
|
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{}{
|
args := map[string]interface{}{
|
||||||
"qom-type": qomtype,
|
"qom-type": qomtype,
|
||||||
"id": id,
|
"id": id,
|
||||||
"props": props,
|
"size": uint64(size) << 20,
|
||||||
}
|
}
|
||||||
if mempath != "" {
|
if mempath != "" {
|
||||||
props["mem-path"] = mempath
|
args["mem-path"] = mempath
|
||||||
}
|
}
|
||||||
if share {
|
if share {
|
||||||
props["share"] = true
|
args["share"] = true
|
||||||
}
|
}
|
||||||
err := q.executeCommand(ctx, "object-add", args, nil)
|
err := q.executeCommand(ctx, "object-add", args, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1426,16 +1425,13 @@ func (q *QMP) ExecuteNVDIMMDeviceAdd(ctx context.Context, id, mempath string, si
|
|||||||
args := map[string]interface{}{
|
args := map[string]interface{}{
|
||||||
"qom-type": "memory-backend-file",
|
"qom-type": "memory-backend-file",
|
||||||
"id": "nvdimmbackmem" + id,
|
"id": "nvdimmbackmem" + id,
|
||||||
"props": map[string]interface{}{
|
"mem-path": mempath,
|
||||||
"mem-path": mempath,
|
"size": size,
|
||||||
"size": size,
|
"share": true,
|
||||||
"share": true,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if pmem != nil {
|
if pmem != nil {
|
||||||
props := args["props"].(map[string]interface{})
|
args["pmem"] = *pmem
|
||||||
props["pmem"] = *pmem
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := q.executeCommand(ctx, "object-add", args, nil)
|
err := q.executeCommand(ctx, "object-add", args, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user