]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainRestoreFlags: Require VIR_DOMAIN_SAVE_PARAM_FILE for now
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 13 May 2022 07:33:36 +0000 (09:33 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 13 May 2022 15:10:10 +0000 (17:10 +0200)
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>
src/libvirt-domain.c
src/qemu/qemu_driver.c

index 208c2438feaee3951555d956f13a6924fb866414..a32630a6e9be812fe32f32b6edc89252c85d7ea4 100644 (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.
  *
index 0b31c73bb9a3668d4c20a900b6cd6b9e468e1d60..702fd0239c842ca6af7f7538a07a559400983fa3 100644 (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;