machine: also acquire Image object from cache when a dbus method in the main interfac...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 17 May 2024 20:33:48 +0000 (05:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 19 May 2024 16:03:14 +0000 (01:03 +0900)
commitc6aeb9b596749b263145346c7fa2c6bf7fbd3867
treea8040ce29074c461b5a54e1b7a46d45ec7ed03e3
parent6d917da1409eae3b6988ed56cc4812252058ecdb
machine: also acquire Image object from cache when a dbus method in the main interface is called

Previously, Image objects were only cached when reading properties or
methods in the org.freedesktop.machine1.Image interface are called.

This makes that, when a method in the main interface (org.freedesktop.machine1)
for an image is called, also acquire the Image object from the cache,
and if not cached, create Image object and put into the cache, like we
do for org.freedesktop.machine1.Image.

Otherwise, if some properties of an image are updated by methods in the main
interface, e.g. MarkImageReadOnly(), the changes do not applied to the cached
Image object, and subsequent read of proerties through the interface for the
image, e.g. ReadOnly property, may provide outdated values.

Follow-up for 1ddb263d21099ae42195c2bc382bdf72a7f24f82.

Fixes #32888.
src/machine/machined-dbus.c