mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: add implementation for virDomainRestoreParams API
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Claudio Fontana <cfontana@suse.de>
This commit is contained in:
parent
26c43c8129
commit
9759639dd4
@ -5806,12 +5806,12 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
const char *path,
|
||||
const char *dxml,
|
||||
unsigned int flags)
|
||||
qemuDomainRestoreInternal(virConnectPtr conn,
|
||||
const char *path,
|
||||
const char *dxml,
|
||||
unsigned int flags,
|
||||
int (*ensureACL)(virConnectPtr, virDomainDef *))
|
||||
{
|
||||
virQEMUDriver *driver = conn->privateData;
|
||||
qemuDomainObjPrivate *priv = NULL;
|
||||
@ -5840,7 +5840,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
if (fd < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainRestoreFlagsEnsureACL(conn, def) < 0)
|
||||
if (ensureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
|
||||
@ -5908,11 +5908,47 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
const char *path,
|
||||
const char *dxml,
|
||||
unsigned int flags)
|
||||
{
|
||||
return qemuDomainRestoreInternal(conn, path, dxml, flags,
|
||||
virDomainRestoreFlagsEnsureACL);
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainRestore(virConnectPtr conn,
|
||||
const char *path)
|
||||
{
|
||||
return qemuDomainRestoreFlags(conn, path, NULL, 0);
|
||||
return qemuDomainRestoreInternal(conn, path, NULL, 0,
|
||||
virDomainRestoreEnsureACL);
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainRestoreParams(virConnectPtr conn,
|
||||
virTypedParameterPtr params, int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *dxml = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (virTypedParamsValidate(params, nparams,
|
||||
VIR_SAVE_PARAM_FILE, VIR_TYPED_PARAM_STRING,
|
||||
VIR_SAVE_PARAM_DXML, VIR_TYPED_PARAM_STRING,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_FILE, &path) < 0)
|
||||
return -1;
|
||||
if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_DXML, &dxml) < 0)
|
||||
return -1;
|
||||
|
||||
ret = qemuDomainRestoreInternal(conn, path, dxml, flags,
|
||||
virDomainRestoreParamsEnsureACL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -20884,6 +20920,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
|
||||
.domainSaveParams = qemuDomainSaveParams, /* 8.4.0 */
|
||||
.domainRestore = qemuDomainRestore, /* 0.2.0 */
|
||||
.domainRestoreFlags = qemuDomainRestoreFlags, /* 0.9.4 */
|
||||
.domainRestoreParams = qemuDomainRestoreParams, /* 8.4.0 */
|
||||
.domainSaveImageGetXMLDesc = qemuDomainSaveImageGetXMLDesc, /* 0.9.4 */
|
||||
.domainSaveImageDefineXML = qemuDomainSaveImageDefineXML, /* 0.9.4 */
|
||||
.domainCoreDump = qemuDomainCoreDump, /* 0.7.0 */
|
||||
|
Loading…
Reference in New Issue
Block a user