Message ID | 20190424004700.12766-3-richardw.yang@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | cleanup savevm | expand |
On 4/23/19 9:46 PM, Wei Yang wrote: > migration_is_blocked() is used in migrate_prepare() and > save_snapshot(), this is more proper to use this instead of > qemu_savevm_state_blocked() in qemu_loadvm_state(). migration_is_blocked() does an additional verification: "if (migration_blockers)" comparing to what was previously done in qemu_loadvm_state. I've checked what migration_blockers does and it is a GList used for callers to block the migration process. This is used via 'migration_add_blocker', from migration.c. 'migration_add_blocker' is called all over the place, most notably in _realize() functions and _open() functions from block. Thus, I am not sure if this change will impact the use of qemu_loadvm_state() from load_snapshot() (i.e. can load_snapshot be called with migration_blockers?). It's better to someone with a better understanding of this code to comment on that. DHB > Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> > --- > migration/savevm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/migration/savevm.c b/migration/savevm.c > index 2eea604624..6c61056cde 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -2406,7 +2406,7 @@ int qemu_loadvm_state(QEMUFile *f) > unsigned int v; > int ret; > > - if (qemu_savevm_state_blocked(&local_err)) { > + if (migration_is_blocked(&local_err)) { > error_report_err(local_err); > return -EINVAL; > }
On Thu, Apr 25, 2019 at 05:55:15PM -0300, Daniel Henrique Barboza wrote: > > >On 4/23/19 9:46 PM, Wei Yang wrote: >> migration_is_blocked() is used in migrate_prepare() and >> save_snapshot(), this is more proper to use this instead of >> qemu_savevm_state_blocked() in qemu_loadvm_state(). > > >migration_is_blocked() does an additional verification: > >"if (migration_blockers)" > >comparing to what was previously done in qemu_loadvm_state. > >I've checked what migration_blockers does and it is a GList used >for callers to block the migration process. This is used via >'migration_add_blocker', from migration.c. > >'migration_add_blocker' is called all over the place, most notably >in _realize() functions and _open() functions from block. > >Thus, I am not sure if this change will impact the use of >qemu_loadvm_state() from load_snapshot() (i.e. can load_snapshot >be called with migration_blockers?). It's better to someone >with a better understanding of this code to comment on that. > Well, when you look into the source side of migration: qmp_migrate migrate_prepare migration_is_blocked This means if migration_is_blocked fails, the source will not start migration. And it is the same as save_snapshot. From my understanding, when we load a vm, it should check the same requirement.
* Wei Yang (richardw.yang@linux.intel.com) wrote: > On Thu, Apr 25, 2019 at 05:55:15PM -0300, Daniel Henrique Barboza wrote: > > > > > >On 4/23/19 9:46 PM, Wei Yang wrote: > >> migration_is_blocked() is used in migrate_prepare() and > >> save_snapshot(), this is more proper to use this instead of > >> qemu_savevm_state_blocked() in qemu_loadvm_state(). > > > > > >migration_is_blocked() does an additional verification: > > > >"if (migration_blockers)" > > > >comparing to what was previously done in qemu_loadvm_state. > > > >I've checked what migration_blockers does and it is a GList used > >for callers to block the migration process. This is used via > >'migration_add_blocker', from migration.c. > > > >'migration_add_blocker' is called all over the place, most notably > >in _realize() functions and _open() functions from block. > > > >Thus, I am not sure if this change will impact the use of > >qemu_loadvm_state() from load_snapshot() (i.e. can load_snapshot > >be called with migration_blockers?). It's better to someone > >with a better understanding of this code to comment on that. > > > > Well, when you look into the source side of migration: > > qmp_migrate > migrate_prepare > migration_is_blocked > > This means if migration_is_blocked fails, the source will not start migration. > And it is the same as save_snapshot. > > From my understanding, when we load a vm, it should check the same > requirement. I've been thinking about this, and I think I agree with Daniel on this. The 'migration_blockers' list tells you that something about the *current* state of a device means that it can't be migrated - e.g. a 9pfs with a mounted filesystem can't be migrated. If we're about to reload the state from a snapshot, then the saved snapshot's state must have been migratable, so that's OK. (Whether all the device code is actually OK about being reset in that state is a different question; but I think it should be). Dave > -- > Wei Yang > Help you, Help me -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On Tue, May 14, 2019 at 04:18:14PM +0100, Dr. David Alan Gilbert wrote: >* Wei Yang (richardw.yang@linux.intel.com) wrote: >> >> Well, when you look into the source side of migration: >> >> qmp_migrate >> migrate_prepare >> migration_is_blocked >> >> This means if migration_is_blocked fails, the source will not start migration. >> And it is the same as save_snapshot. >> >> From my understanding, when we load a vm, it should check the same >> requirement. > >I've been thinking about this, and I think I agree with Daniel on this. >The 'migration_blockers' list tells you that something about the >*current* state of a device means that it can't be migrated - e.g. >a 9pfs with a mounted filesystem can't be migrated. > >If we're about to reload the state from a snapshot, then the saved >snapshot's state must have been migratable, so that's OK. > The situation is on a vm with 'migration_blockers' still could reload from a snapshot. This sounds reasonable. Thanks :-) >(Whether all the device code is actually OK about being reset in >that state is a different question; but I think it should be). > >Dave > >> -- >> Wei Yang >> Help you, Help me >-- >Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On Wed, May 15, 2019 at 02:38:27PM +0800, Wei Yang wrote: >On Tue, May 14, 2019 at 04:18:14PM +0100, Dr. David Alan Gilbert wrote: >>* Wei Yang (richardw.yang@linux.intel.com) wrote: >>> >>> Well, when you look into the source side of migration: >>> >>> qmp_migrate >>> migrate_prepare >>> migration_is_blocked >>> >>> This means if migration_is_blocked fails, the source will not start migration. >>> And it is the same as save_snapshot. >>> >>> From my understanding, when we load a vm, it should check the same >>> requirement. >> >>I've been thinking about this, and I think I agree with Daniel on this. >>The 'migration_blockers' list tells you that something about the >>*current* state of a device means that it can't be migrated - e.g. >>a 9pfs with a mounted filesystem can't be migrated. >> >>If we're about to reload the state from a snapshot, then the saved >>snapshot's state must have been migratable, so that's OK. >> > >The situation is on a vm with 'migration_blockers' still could reload from a >snapshot. > >This sounds reasonable. Thanks :-) > Well, this is still a little strange. The means source vm and destination vm could have different configuration. Is this common?
* Wei Yang (richardw.yang@linux.intel.com) wrote: > On Wed, May 15, 2019 at 02:38:27PM +0800, Wei Yang wrote: > >On Tue, May 14, 2019 at 04:18:14PM +0100, Dr. David Alan Gilbert wrote: > >>* Wei Yang (richardw.yang@linux.intel.com) wrote: > >>> > >>> Well, when you look into the source side of migration: > >>> > >>> qmp_migrate > >>> migrate_prepare > >>> migration_is_blocked > >>> > >>> This means if migration_is_blocked fails, the source will not start migration. > >>> And it is the same as save_snapshot. > >>> > >>> From my understanding, when we load a vm, it should check the same > >>> requirement. > >> > >>I've been thinking about this, and I think I agree with Daniel on this. > >>The 'migration_blockers' list tells you that something about the > >>*current* state of a device means that it can't be migrated - e.g. > >>a 9pfs with a mounted filesystem can't be migrated. > >> > >>If we're about to reload the state from a snapshot, then the saved > >>snapshot's state must have been migratable, so that's OK. > >> > > > >The situation is on a vm with 'migration_blockers' still could reload from a > >snapshot. > > > >This sounds reasonable. Thanks :-) > > > > Well, this is still a little strange. The means source vm and destination vm > could have different configuration. Is this common? It's not different configuration that I'm worried about here; but it's different runtime state. Items can get added/removed from migration_blockers dynamically depending on the behaviour of the guest; e.g. a device might only migratable in certain states. Dave > -- > Wei Yang > Help you, Help me -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
On Wed, May 15, 2019 at 10:38:37AM +0100, Dr. David Alan Gilbert wrote: >* Wei Yang (richardw.yang@linux.intel.com) wrote: >> On Wed, May 15, 2019 at 02:38:27PM +0800, Wei Yang wrote: >> >On Tue, May 14, 2019 at 04:18:14PM +0100, Dr. David Alan Gilbert wrote: >> >>* Wei Yang (richardw.yang@linux.intel.com) wrote: >> >>> >> >>> Well, when you look into the source side of migration: >> >>> >> >>> qmp_migrate >> >>> migrate_prepare >> >>> migration_is_blocked >> >>> >> >>> This means if migration_is_blocked fails, the source will not start migration. >> >>> And it is the same as save_snapshot. >> >>> >> >>> From my understanding, when we load a vm, it should check the same >> >>> requirement. >> >> >> >>I've been thinking about this, and I think I agree with Daniel on this. >> >>The 'migration_blockers' list tells you that something about the >> >>*current* state of a device means that it can't be migrated - e.g. >> >>a 9pfs with a mounted filesystem can't be migrated. >> >> >> >>If we're about to reload the state from a snapshot, then the saved >> >>snapshot's state must have been migratable, so that's OK. >> >> >> > >> >The situation is on a vm with 'migration_blockers' still could reload from a >> >snapshot. >> > >> >This sounds reasonable. Thanks :-) >> > >> >> Well, this is still a little strange. The means source vm and destination vm >> could have different configuration. Is this common? > >It's not different configuration that I'm worried about here; but it's different runtime state. >Items can get added/removed from migration_blockers dynamically >depending on the behaviour of the guest; e.g. a device might only >migratable in certain states. > I am not familiar with the usage of migration_blockers, just found one case when we add a reason to it. -- vhost_dev_init(). Per my understanding, this is a device. We specify it in command line or use hot-plug to add it. To me, guest may not alter the add/remove? Looks even we have one such device, we still could load vm. This looks not bad, but we have the different devices from source. BTW, migration works if source and destination have different devices? As you mentioned, these is some case where guest could add/remove a reason to migration_blockers. This is what you concerned right? Do we need to limit the usage of migration_blockers? Just use this in the case you concerned? >Dave > > >> -- >> Wei Yang >> Help you, Help me >-- >Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff --git a/migration/savevm.c b/migration/savevm.c index 2eea604624..6c61056cde 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2406,7 +2406,7 @@ int qemu_loadvm_state(QEMUFile *f) unsigned int v; int ret; - if (qemu_savevm_state_blocked(&local_err)) { + if (migration_is_blocked(&local_err)) { error_report_err(local_err); return -EINVAL; }
migration_is_blocked() is used in migrate_prepare() and save_snapshot(), this is more proper to use this instead of qemu_savevm_state_blocked() in qemu_loadvm_state(). Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> --- migration/savevm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)