diff --git a/virttest/qemu_devices/qdevices.py b/virttest/qemu_devices/qdevices.py index 1df7b963fa..b511b74c42 100644 --- a/virttest/qemu_devices/qdevices.py +++ b/virttest/qemu_devices/qdevices.py @@ -1150,9 +1150,23 @@ def hotplug_hmp(self): out = "device_add %s" % _convert_args(self.params) return out + def _refresh_hotplug_props(self, params): + """ + Refresh hotplug optional props as per params. + + :return: A dict containing hotplug optional props. + """ + return params + def hotplug_qmp(self): """:return: the hotplug monitor command""" - return "device_add", self.params + params = self.params.copy() + params = self._refresh_hotplug_props(params) + for option in ["node", "requested-size"]: + value = params.get_param(option) + if value: + params[option] = int(value) + return "device_add", params def hotplug_hmp_nd(self): """:return: the hotplug monitor command without dynamic parameters""" @@ -1827,6 +1841,11 @@ def __init__(self, params=None, dimm_type="pc-dimm"): super(Dimm, self).__init__(**kwargs) self.set_param("driver", dimm_type) + def _refresh_hotplug_props(self, params): + if params.get("node"): + params["node"] = int(params.get("node")) + return params + def verify_hotplug(self, out, monitor): out = monitor.info("memory-devices", debug=False) if "unknown command" in out: # Old qemu don't have info qtree