[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] monitor: Fix find_device_state() for IDs containing slashes
From: |
Markus Armbruster |
Subject: |
Re: [PATCH] monitor: Fix find_device_state() for IDs containing slashes |
Date: |
Wed, 10 Nov 2021 06:49:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Markus Armbruster <armbru@redhat.com> writes:
> Recent commit 6952026120 "monitor: Tidy up find_device_state()"
> assumed the function's argument is "the device's ID or QOM path" (as
> documented for device_del). It's actually either an absolute QOM
> path, or a QOM path relative to /machine/peripheral/. Such a relative
> path is a device ID when it doesn't contain a slash. When it does,
> the function now always fails. Broke iotest 200, which uses relative
> path "vda/virtio-backend".
>
> It fails because object_resolve_path_component() resolves just one
> component, not a relative path.
>
> The obvious function to resolve relative paths is
> object_resolve_path(). It picks a parent automatically. Too much
> magic, we want to specify the parent. Create new
> object_resolve_path_at() for that, and use it in find_device_state().
>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Queued for 6.2 & PR sent.