From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: "Anton Kuchin" <antonkuchin@yandex-team.ru>,
qemu-devel@nongnu.org, yc-core@yandex-team.ru,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Juan Quintela" <quintela@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
virtio-fs@redhat.com, "Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH v3 1/1] vhost-user-fs: add migration type property
Date: Wed, 22 Feb 2023 07:43:43 -0500 [thread overview]
Message-ID: <20230222074214-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <59165bde-bfd4-a073-c618-205be3951e4a@yandex-team.ru>
On Wed, Feb 22, 2023 at 03:20:00PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 17.02.23 20:00, Anton Kuchin wrote:
> > Migration of vhost-user-fs device requires transfer of FUSE internal state
> > from backend. There is no standard way to do it now so by default migration
> > must be blocked. But if this state can be externally transferred by
> > orchestrator give it an option to explicitly allow migration.
> >
> > Signed-off-by: Anton Kuchin <antonkuchin@yandex-team.ru>
> > ---
> > hw/core/qdev-properties-system.c | 10 +++++++++
> > hw/virtio/vhost-user-fs.c | 32 ++++++++++++++++++++++++++++-
> > include/hw/qdev-properties-system.h | 1 +
> > include/hw/virtio/vhost-user-fs.h | 2 ++
> > qapi/migration.json | 16 +++++++++++++++
> > 5 files changed, 60 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
> > index d42493f630..d9b1aa2a5d 100644
> > --- a/hw/core/qdev-properties-system.c
> > +++ b/hw/core/qdev-properties-system.c
> > @@ -1143,3 +1143,13 @@ const PropertyInfo qdev_prop_uuid = {
> > .set = set_uuid,
> > .set_default_value = set_default_uuid_auto,
> > };
> > +
> > +const PropertyInfo qdev_prop_vhost_user_migration_type = {
> > + .name = "VhostUserMigrationType",
> > + .description = "none/external",
> > + .enum_table = &VhostUserMigrationType_lookup,
> > + .get = qdev_propinfo_get_enum,
> > + .set = qdev_propinfo_set_enum,
> > + .set_default_value = qdev_propinfo_set_default_value_enum,
> > + .realized_set_allowed = true,
> > +};
> > diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
> > index 83fc20e49e..7deb9df5ec 100644
> > --- a/hw/virtio/vhost-user-fs.c
> > +++ b/hw/virtio/vhost-user-fs.c
> > @@ -298,9 +298,35 @@ static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev)
> > return &fs->vhost_dev;
> > }
> > +static int vhost_user_fs_pre_save(void *opaque)
> > +{
> > + VHostUserFS *fs = opaque;
> > + g_autofree char *path = object_get_canonical_path(OBJECT(fs));
> > +
> > + switch (fs->migration_type) {
> > + case VHOST_USER_MIGRATION_TYPE_NONE:
> > + error_report("Migration is blocked by device %s", path);
> > + break;
> > + case VHOST_USER_MIGRATION_TYPE_EXTERNAL:
> > + return 0;
> > + default:
> > + error_report("Migration type '%s' is not supported by device %s",
> > + VhostUserMigrationType_str(fs->migration_type), path);
> > + break;
> > + }
> > +
> > + return -1;
> > +}
>
> Should we also add this as .pre_load, to force user select correct migration_type on target too?
In fact, I would claim we only want pre_load.
When qemu is started on destination we know where it's migrated
from so this flag can be set.
When qemu is started on source we generally do not yet know so
we don't know whether it's safe to set this flag.
> > +
> > static const VMStateDescription vuf_vmstate = {
> > .name = "vhost-user-fs",
> > - .unmigratable = 1,
> > + .minimum_version_id = 0,
> > + .version_id = 0,
> > + .fields = (VMStateField[]) {
> > + VMSTATE_VIRTIO_DEVICE,
> > + VMSTATE_END_OF_LIST()
> > + },
> > + .pre_save = vhost_user_fs_pre_save,
> > };
> > static Property vuf_properties[] = {
> > @@ -309,6 +335,10 @@ static Property vuf_properties[] = {
> > DEFINE_PROP_UINT16("num-request-queues", VHostUserFS,
> > conf.num_request_queues, 1),
> > DEFINE_PROP_UINT16("queue-size", VHostUserFS, conf.queue_size, 128),
> > + DEFINE_PROP_UNSIGNED("migration", VHostUserFS, migration_type,
> > + VHOST_USER_MIGRATION_TYPE_NONE,
> > + qdev_prop_vhost_user_migration_type,
> > + VhostUserMigrationType),
>
> 1. I see, other similar qdev_prop_* use DEFINE_PROP_SIGNED
> 2. All of them except only qdev_prop_fdc_drive_type, define also a convenient macro in include/hw/qdev-properties-system.h
>
> should we follow these patterns?
>
>
> --
> Best regards,
> Vladimir
next prev parent reply other threads:[~2023-02-22 12:44 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 17:00 [PATCH v3 0/1] virtio-fs: implement option for stateless migration Anton Kuchin
2023-02-17 17:00 ` [PATCH v3 1/1] vhost-user-fs: add migration type property Anton Kuchin
2023-02-21 20:45 ` Stefan Hajnoczi
2023-02-22 12:20 ` Vladimir Sementsov-Ogievskiy
2023-02-22 12:43 ` Michael S. Tsirkin [this message]
2023-02-22 14:25 ` Anton Kuchin
2023-02-22 15:14 ` Vladimir Sementsov-Ogievskiy
2023-02-22 16:43 ` Michael S. Tsirkin
2023-02-22 17:15 ` Anton Kuchin
2023-02-22 17:30 ` Michael S. Tsirkin
2023-02-22 16:49 ` Anton Kuchin
2023-02-22 16:51 ` Michael S. Tsirkin
2023-02-22 17:05 ` Anton Kuchin
2023-02-22 17:12 ` Michael S. Tsirkin
2023-02-22 18:25 ` Anton Kuchin
2023-02-22 20:21 ` Michael S. Tsirkin
2023-02-22 20:50 ` Anton Kuchin
2023-03-01 15:40 ` Michael S. Tsirkin
2023-02-23 7:36 ` Michael S. Tsirkin
2023-02-23 21:24 ` Stefan Hajnoczi
2023-02-24 4:14 ` Anton Kuchin
2023-02-27 10:19 ` Anton Kuchin
2023-02-24 8:47 ` Michael S. Tsirkin
2023-02-28 14:30 ` Anton Kuchin
2023-02-28 14:57 ` Michael S. Tsirkin
2023-02-28 17:59 ` Anton Kuchin
2023-02-28 21:24 ` Michael S. Tsirkin
2023-03-01 14:03 ` Vladimir Sementsov-Ogievskiy
2023-03-01 14:46 ` Michael S. Tsirkin
2023-03-01 15:40 ` Anton Kuchin
2023-03-01 15:52 ` Michael S. Tsirkin
2023-03-01 16:29 ` Anton Kuchin
2023-03-01 17:19 ` Michael S. Tsirkin
2023-03-01 19:42 ` Anton Kuchin
2023-03-01 15:07 ` Anton Kuchin
2023-03-01 15:24 ` Michael S. Tsirkin
2023-03-01 16:04 ` Anton Kuchin
2023-03-01 17:17 ` Michael S. Tsirkin
2023-03-01 19:35 ` Anton Kuchin
2023-03-01 20:22 ` Michael S. Tsirkin
2023-03-06 20:55 ` Anton Kuchin
2023-03-06 21:53 ` Michael S. Tsirkin
2023-03-17 18:04 ` Anton Kuchin
2023-03-01 15:33 ` Michael S. Tsirkin
2023-03-17 19:02 ` Anton Kuchin
2023-02-28 19:18 ` Stefan Hajnoczi
2023-02-28 21:29 ` Michael S. Tsirkin
2023-02-28 21:54 ` Michael S. Tsirkin
2023-02-22 14:21 ` Anton Kuchin
2023-02-22 15:15 ` Vladimir Sementsov-Ogievskiy
2023-02-22 15:20 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230222074214-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=antonkuchin@yandex-team.ru \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtio-fs@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).