migration: Move qmp_migrate_set_capabilities() to options.c
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
This commit is contained in:
parent
4d0c6b695b
commit
45c1de13f0
@ -1222,32 +1222,6 @@ MigrationInfo *qmp_query_migrate(Error **errp)
|
||||
return info;
|
||||
}
|
||||
|
||||
void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
|
||||
Error **errp)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
MigrationCapabilityStatusList *cap;
|
||||
bool new_caps[MIGRATION_CAPABILITY__MAX];
|
||||
|
||||
if (migration_is_running(s->state)) {
|
||||
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(new_caps, s->capabilities, sizeof(new_caps));
|
||||
for (cap = params; cap; cap = cap->next) {
|
||||
new_caps[cap->value->capability] = cap->value->state;
|
||||
}
|
||||
|
||||
if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (cap = params; cap; cap = cap->next) {
|
||||
s->capabilities[cap->value->capability] = cap->value->state;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the parameters are valid. Error will be put into errp
|
||||
* (if provided). Return true if valid, otherwise false.
|
||||
|
@ -413,3 +413,29 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
|
||||
Error **errp)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
MigrationCapabilityStatusList *cap;
|
||||
bool new_caps[MIGRATION_CAPABILITY__MAX];
|
||||
|
||||
if (migration_is_running(s->state)) {
|
||||
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(new_caps, s->capabilities, sizeof(new_caps));
|
||||
for (cap = params; cap; cap = cap->next) {
|
||||
new_caps[cap->value->capability] = cap->value->state;
|
||||
}
|
||||
|
||||
if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (cap = params; cap; cap = cap->next) {
|
||||
s->capabilities[cap->value->capability] = cap->value->state;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user