mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-10-28 14:04:39 +08:00
migration: update capability conflict test for postcopy-ram+mapped-ram
Remove the test test_validate_caps_pair, which asserted postcopy-ram and mapped-ram capabilities cannot be active together. The new fast snapshot load feature is exactly this pair of capabilities active together, with the following patches in this series, this combination will now supported and be functional. Remove the capability check that rejected mapped-ram and postcopy-ram being set simultaneously, as this combination now corresponds to fast snapshot load. Add a capability check against setting multifd when configured for fast snapshot load as it is not supported yet. Also add capability check against setting postcopy-preempt as it is incompatible. Add infrastructure to check postcopy_notifier_list being empty in capaility checking to block vhost-user with fast snapshot load as it is not supported. Add a check to bail in migrate_prepare to prevent unexpected usage when fast snapshot load is enabled. A smoke test exercising this feature has been added further in this series. Signed-off-by: Aadeshveer Singh <aadeshveer07@gmail.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
1 parent
fc1ea4b513
commit
ef1f718450
7 files changed
+37
-54
No files matched your search
@@ -75,4 +75,6 @@ void notifier_with_return_remove(NotifierWithReturn *notifier);
|
||||
int notifier_with_return_list_notify(NotifierWithReturnList *list,
|
||||
void *data, Error **errp);
|
||||
|
||||
bool notifier_with_return_list_empty(NotifierWithReturnList *list);
|
||||
|
||||
#endif
|
||||
@@ -2048,6 +2048,12 @@ static bool migrate_prepare(MigrationState *s, bool resume, Error **errp)
|
||||
error_setg(errp, "Cannot use compression with mapped-ram");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (migrate_postcopy_ram()) {
|
||||
error_setg(errp, "Cannot migrate with fast snapshot load "
|
||||
"enabled(mapped-ram + postcopy-ram)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (migrate_mode_is_cpr()) {
|
||||
|
||||
+18
-2
@@ -736,10 +736,26 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
|
||||
"Mapped-ram migration is incompatible with xbzrle");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
|
||||
if (new_caps[MIGRATION_CAPABILITY_MAPPED_RAM] &&
|
||||
new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
|
||||
if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) {
|
||||
error_setg(errp,
|
||||
"Mapped-ram migration is incompatible with postcopy");
|
||||
"Multifd is not supported with fast snapshot load");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) {
|
||||
error_setg(
|
||||
errp,
|
||||
"Postcopy Preempt is incompatible with fast snapshot load");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!postcopy_notifier_list_empty()) {
|
||||
error_setg(errp,
|
||||
"vhost-user is not supported with fast snapshot load");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,11 @@ int postcopy_notify(enum PostcopyNotifyReason reason, Error **errp)
|
||||
&pnd, errp);
|
||||
}
|
||||
|
||||
bool postcopy_notifier_list_empty(void)
|
||||
{
|
||||
return notifier_with_return_list_empty(&postcopy_notifier_list);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: this routine is not thread safe, we can't call it concurrently. But it
|
||||
* should be good enough for migration's purposes.
|
||||
|
||||
@@ -136,6 +136,7 @@ void postcopy_add_notifier(NotifierWithReturn *nn);
|
||||
void postcopy_remove_notifier(NotifierWithReturn *n);
|
||||
/* Call the notifier list set by postcopy_add_start_notifier */
|
||||
int postcopy_notify(enum PostcopyNotifyReason reason, Error **errp);
|
||||
bool postcopy_notifier_list_empty(void);
|
||||
|
||||
void postcopy_thread_create(MigrationIncomingState *mis,
|
||||
QemuThread *thread, const char *name,
|
||||
|
||||
@@ -201,55 +201,6 @@ static void do_test_validate_uri_channel(MigrateCommon *args)
|
||||
migrate_end(from, to, false);
|
||||
}
|
||||
|
||||
static void validate_caps_pair(QTestState *from,
|
||||
const char *first_capability,
|
||||
const char *second_capability,
|
||||
const char *expected_error)
|
||||
{
|
||||
QDict *rsp;
|
||||
const char *error_desc;
|
||||
|
||||
migrate_set_capability(from, first_capability, true);
|
||||
|
||||
rsp = qtest_qmp_assert_failure_ref(
|
||||
from,
|
||||
"{ 'execute': 'migrate-set-capabilities',"
|
||||
" 'arguments': { 'capabilities': [ { "
|
||||
" 'capability': %s, 'state': true } ] } }",
|
||||
second_capability);
|
||||
|
||||
error_desc = qdict_get_str(rsp, "desc");
|
||||
g_assert_cmpstr(error_desc, ==, expected_error);
|
||||
qobject_unref(rsp);
|
||||
|
||||
migrate_set_capability(from, first_capability, false);
|
||||
}
|
||||
|
||||
static void test_validate_caps_pair(char *test_path, MigrateCommon *args)
|
||||
{
|
||||
g_autofree char *serial_path = g_strconcat(tmpfs, "/src_serial", NULL);
|
||||
g_autofree char *cap_pair = g_path_get_basename(test_path);
|
||||
QTestState *from, *to;
|
||||
|
||||
args->start.hide_stderr = true;
|
||||
args->start.only_source = true;
|
||||
|
||||
if (migrate_start(&from, &to, &args->start)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_str_equal(cap_pair, "mapped_ram_postcopy")) {
|
||||
const char *error =
|
||||
"Mapped-ram migration is incompatible with postcopy";
|
||||
|
||||
validate_caps_pair(from, "mapped-ram", "postcopy-ram", error);
|
||||
validate_caps_pair(from, "postcopy-ram", "mapped-ram", error);
|
||||
}
|
||||
|
||||
qtest_quit(from);
|
||||
unlink(serial_path);
|
||||
}
|
||||
|
||||
static void test_validate_uri_channels_both_set(char *name, MigrateCommon *args)
|
||||
{
|
||||
args->uri = "tcp:127.0.0.1:0",
|
||||
@@ -309,7 +260,4 @@ void migration_test_add_misc(MigrationTestEnv *env)
|
||||
test_validate_uri_channels_both_set);
|
||||
migration_test_add("/migration/validate_uri/channels/none_set",
|
||||
test_validate_uri_channels_none_set);
|
||||
migration_test_add_suffix("/migration/validate_caps/",
|
||||
"mapped_ram_postcopy",
|
||||
test_validate_caps_pair);
|
||||
}
|
||||
@@ -75,3 +75,8 @@ int notifier_with_return_list_notify(NotifierWithReturnList *list, void *data,
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool notifier_with_return_list_empty(NotifierWithReturnList *list)
|
||||
{
|
||||
return QLIST_EMPTY(&list->notifiers);
|
||||
}
|
||||
Reference in new issue
Block a user