Skip to content

Commit

Permalink
virtio_port_hotplug:hotplug_various_chardevs
Browse files Browse the repository at this point in the history
Add ringbuf chardev parameters to hotplug

Signed-off-by: nanliu <[email protected]>
  • Loading branch information
nanliu-r committed Sep 19, 2019
1 parent 635afb4 commit 2002ee2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions virttest/qemu_devices/qcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions virttest/qemu_devices/qdevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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"))

Expand Down

0 comments on commit 2002ee2

Please sign in to comment.