提交 cc023b33 编写于 作者: J Jiri Denemark

qemu: Add support for setting string migration params

The functions for converting migration typed parameters to QEMU
migration parameters and back were only implemented for integer types.
This patch adds support for string parameters.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
上级 f5259ba4
......@@ -412,6 +412,51 @@ qemuMigrationParamsSetTPULL(qemuMigrationParamsPtr migParams,
}
static int
qemuMigrationParamsGetTPString(qemuMigrationParamsPtr migParams,
qemuMigrationParam param,
virTypedParameterPtr params,
int nparams,
const char *name)
{
const char *value = NULL;
int rc;
if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_STRING) < 0)
return -1;
if (!params)
return 0;
if ((rc = virTypedParamsGetString(params, nparams, name, &value)) < 0)
return -1;
migParams->params[param].value.s = g_strdup(value);
migParams->params[param].set = !!rc;
return 0;
}
static int
qemuMigrationParamsSetTPString(qemuMigrationParamsPtr migParams,
qemuMigrationParam param,
virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name)
{
if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_STRING) < 0)
return -1;
if (!migParams->params[param].set)
return 0;
return virTypedParamsAddString(params, nparams, maxparams, name,
migParams->params[param].value.s);
}
static int
qemuMigrationParamsSetCompression(virTypedParameterPtr params,
int nparams,
......@@ -536,7 +581,12 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
break;
case QEMU_MIGRATION_PARAM_TYPE_BOOL:
break;
case QEMU_MIGRATION_PARAM_TYPE_STRING:
if (qemuMigrationParamsGetTPString(migParams, item->param, params,
nparams, item->typedParam) < 0)
goto error;
break;
}
}
......@@ -612,7 +662,13 @@ qemuMigrationParamsDump(qemuMigrationParamsPtr migParams,
break;
case QEMU_MIGRATION_PARAM_TYPE_BOOL:
break;
case QEMU_MIGRATION_PARAM_TYPE_STRING:
if (qemuMigrationParamsSetTPString(migParams, item->param,
params, nparams, maxparams,
item->typedParam) < 0)
return -1;
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册