virDomainRestoreFlags: Require VIR_DOMAIN_SAVE_PARAM_FILE for now

Calling virDomainRestoreFlags() with no typed params results in
an error in open() because it tries to open a NULL path.
Obviously, this is wrong and path to restore from must be
provided, at least for now until other sources of restore are
introduced. Then this limitation can be relaxed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2022-05-13 09:33:36 +02:00
parent f4e2910552
commit af1933713b
2 changed files with 9 additions and 1 deletions

View File

@ -1190,7 +1190,9 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
* @nparams: number of restore parameters
* @flags: bitwise-OR of virDomainSaveRestoreFlags
*
* This method extends virDomainRestoreFlags by adding parameters.
* This method extends virDomainRestoreFlags by adding parameters. For
* now, VIR_DOMAIN_SAVE_PARAM_FILE is required but this requirement may
* be lifted in the future.
*
* Returns 0 in case of success and -1 in case of failure.
*

View File

@ -5967,6 +5967,12 @@ qemuDomainRestoreParams(virConnectPtr conn,
VIR_DOMAIN_SAVE_PARAM_DXML, &dxml) < 0)
return -1;
if (!path) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("missing path to restore from"));
return -1;
}
ret = qemuDomainRestoreInternal(conn, path, dxml, flags,
virDomainRestoreParamsEnsureACL);
return ret;