On Fri, Feb 10, 2023 at 05:08:16PM +0100, Juan Quintela wrote: > Anton Kuchin <antonkuc...@yandex-team.ru> wrote: > > On 02/02/2023 11:59, Juan Quintela wrote: > >> Anton Kuchin <antonkuc...@yandex-team.ru> wrote: > >>> On 01/02/2023 16:26, Juan Quintela wrote: > >>>> Anton Kuchin <antonkuc...@yandex-team.ru> wrote: > >>>>> On 19/01/2023 18:02, Stefan Hajnoczi wrote: > >>>>>> On Thu, 19 Jan 2023 at 10:29, Anton Kuchin > >>>>>> <antonkuc...@yandex-team.ru> wrote: > >>>>>>> On 19/01/2023 16:30, Stefan Hajnoczi wrote: > >>>>>>>> On Thu, 19 Jan 2023 at 07:43, Anton Kuchin > >>>>>>>> <antonkuc...@yandex-team.ru> wrote: > >>>>>>>>> On 18/01/2023 17:52, Stefan Hajnoczi wrote: > >>>>>>>>>> On Sun, 15 Jan 2023 at 12:21, Anton Kuchin > >>>>>>>>>> <antonkuc...@yandex-team.ru> wrote: > >>>> Once told that, I think that you are making your live harder in the > >>>> future when you add the other migratable devices. > >>>> > >>>> static const VMStateDescription vuf_vmstate = { > >>>> .name = "vhost-user-fs", > >>>> .minimum_version_id = 0, > >>>> .version_id = 0, > >>>> .fields = (VMStateField[]) { > >>>> VMSTATE_INT8(migration_type, struct VHostUserFS), > >>>> VMSTATE_VIRTIO_DEVICE, > >>>> VMSTATE_END_OF_LIST() > >>>> }, > >>>> .pre_save = vhost_user_fs_pre_save, > >>>> .subsections = (const VMStateDescription*[]) { > >>>> &vmstate_vhost_user_fs_internal_sub, > >>>> NULL > >>>> } > >>>> }; > >>>> > >>>> And you are done. > >>>> > >>>> I will propose to use a property to set migration_type, but I didn't > >>>> want to write the code right now. > > > > I have a little problem with implementation here and need an advice: > > > > Can we make this property adjustable at runtime after device was realized? > > There is a statement in qemu wiki [1] that makes me think this is possible > > but I couldn't find any code for it or example in other devices. > >> "Properties are, by default, locked while the device is > > realized. Exceptions > >> can be made by the devices themselves in order to implement a way > > for a user > >> to interact with a device while it is realized." > > > > Or is your idea just to set this property once at construction and keep it > > constant for device lifetime? > > > > [1] https://wiki.qemu.org/Features/QOM > > I have no clue here. Markus? Stefan?
Sorry for the late reply. Yes, QOM properties can be set after realize (e.g. using the qom-set command). The set() callback can return an error, so some properties are implemented to refuse updates when ->realize is true. Stefan
signature.asc
Description: PGP signature