mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
libvirt: introduce virDomainRestoreParams public API
add new API in order to be able to extend parameters to the domain restore operation. We will use it to fit the existing arguments of VirDomainRestoreFlags for now. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
6392cb1f1f
commit
f9a8e25b15
@ -1572,6 +1572,10 @@ int virDomainRestoreFlags (virConnectPtr conn,
|
|||||||
const char *from,
|
const char *from,
|
||||||
const char *dxml,
|
const char *dxml,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
int virDomainRestoreParams (virConnectPtr conn,
|
||||||
|
virTypedParameterPtr params,
|
||||||
|
int nparams,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VIR_SAVE_PARAM_FILE:
|
* VIR_SAVE_PARAM_FILE:
|
||||||
|
@ -256,6 +256,12 @@ typedef int
|
|||||||
const char *dxml,
|
const char *dxml,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(*virDrvDomainRestoreParams)(virConnectPtr conn,
|
||||||
|
virTypedParameterPtr params,
|
||||||
|
int nparams,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef char *
|
typedef char *
|
||||||
(*virDrvDomainSaveImageGetXMLDesc)(virConnectPtr conn,
|
(*virDrvDomainSaveImageGetXMLDesc)(virConnectPtr conn,
|
||||||
const char *file,
|
const char *file,
|
||||||
@ -1498,6 +1504,7 @@ struct _virHypervisorDriver {
|
|||||||
virDrvDomainSaveParams domainSaveParams;
|
virDrvDomainSaveParams domainSaveParams;
|
||||||
virDrvDomainRestore domainRestore;
|
virDrvDomainRestore domainRestore;
|
||||||
virDrvDomainRestoreFlags domainRestoreFlags;
|
virDrvDomainRestoreFlags domainRestoreFlags;
|
||||||
|
virDrvDomainRestoreParams domainRestoreParams;
|
||||||
virDrvDomainSaveImageGetXMLDesc domainSaveImageGetXMLDesc;
|
virDrvDomainSaveImageGetXMLDesc domainSaveImageGetXMLDesc;
|
||||||
virDrvDomainSaveImageDefineXML domainSaveImageDefineXML;
|
virDrvDomainSaveImageDefineXML domainSaveImageDefineXML;
|
||||||
virDrvDomainCoreDump domainCoreDump;
|
virDrvDomainCoreDump domainCoreDump;
|
||||||
|
@ -1181,6 +1181,51 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virDomainRestoreParams:
|
||||||
|
* @conn: pointer to the hypervisor connection
|
||||||
|
* @params: restore parameters
|
||||||
|
* @nparams: number of restore parameters
|
||||||
|
* @flags: bitwise-OR of virDomainSaveRestoreFlags
|
||||||
|
*
|
||||||
|
* This method extends virDomainRestoreFlags by adding parameters.
|
||||||
|
*
|
||||||
|
* Returns 0 in case of success and -1 in case of failure.
|
||||||
|
*
|
||||||
|
* Since: 8.4.0
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virDomainRestoreParams(virConnectPtr conn,
|
||||||
|
virTypedParameterPtr params, int nparams,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("conn=%p, params=%p, nparams=%d, flags=0x%x",
|
||||||
|
conn, params, nparams, flags);
|
||||||
|
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
|
||||||
|
virCheckConnectReturn(conn, -1);
|
||||||
|
virCheckReadOnlyGoto(conn->flags, error);
|
||||||
|
|
||||||
|
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING,
|
||||||
|
VIR_DOMAIN_SAVE_PAUSED,
|
||||||
|
error);
|
||||||
|
|
||||||
|
if (conn->driver->domainRestoreParams) {
|
||||||
|
if (conn->driver->domainRestoreParams(conn, params, nparams, flags) < 0)
|
||||||
|
goto error;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virReportUnsupportedError();
|
||||||
|
|
||||||
|
error:
|
||||||
|
virDispatchError(conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainSaveImageGetXMLDesc:
|
* virDomainSaveImageGetXMLDesc:
|
||||||
* @conn: pointer to the hypervisor connection
|
* @conn: pointer to the hypervisor connection
|
||||||
|
@ -919,6 +919,7 @@ LIBVIRT_8.0.0 {
|
|||||||
LIBVIRT_8.4.0 {
|
LIBVIRT_8.4.0 {
|
||||||
global:
|
global:
|
||||||
virDomainSaveParams;
|
virDomainSaveParams;
|
||||||
|
virDomainRestoreParams;
|
||||||
} LIBVIRT_8.0.0;
|
} LIBVIRT_8.0.0;
|
||||||
|
|
||||||
# .... define new API here using predicted next version number ....
|
# .... define new API here using predicted next version number ....
|
||||||
|
Loading…
Reference in New Issue
Block a user