From 2002ee2c30eb52e1f3de3c500507838d452072e6 Mon Sep 17 00:00:00 2001 From: nanliu Date: Wed, 28 Aug 2019 15:38:00 +0800 Subject: [PATCH] virtio_port_hotplug:hotplug_various_chardevs Add ringbuf chardev parameters to hotplug Signed-off-by: nanliu --- virttest/qemu_devices/qcontainer.py | 3 +++ virttest/qemu_devices/qdevices.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/virttest/qemu_devices/qcontainer.py b/virttest/qemu_devices/qcontainer.py index d1bdfcd5a8..c1cd0c203a 100644 --- a/virttest/qemu_devices/qcontainer.py +++ b/virttest/qemu_devices/qcontainer.py @@ -1965,6 +1965,9 @@ def chardev_define_by_params(self, chardev_id, params, file_name=None): chardev_param.update( {'debug': params.get('chardev_debug'), 'name': params.get('chardev_name')}) + elif 'ringbuf' in backend: + chardev_param.update( + {'ringbuf_write_size': int(params.get('ringbuf_write_size'))}) return qdevices.CharDevice(chardev_param, chardev_id) def cdroms_define_by_params(self, name, image_params, media=None, diff --git a/virttest/qemu_devices/qdevices.py b/virttest/qemu_devices/qdevices.py index b442754bdd..3fa294160f 100644 --- a/virttest/qemu_devices/qdevices.py +++ b/virttest/qemu_devices/qdevices.py @@ -1294,6 +1294,9 @@ def get_supported_options(self, backend): special_opts = ["host", "port", "localaddr", "localport", "ipv4", "ipv6"] + elif backend == 'ringbuf': + special_opts = ["ringbuf_write_size"] + return set(common_opts + special_opts) def format_params(self, params): @@ -1364,6 +1367,11 @@ def get_qmp_args(self): args["backend"]["data"] = {"device": self.get_param("path")} return args + if self.params.get("backend") in "ringbuf": + args["backend"]["data"] = { + "size": self.get_param("ringbuf_write_size")} + return args + raise DeviceError("chardev '%s' not support hotplug" % self.params.get("backend"))