[PATCH] lib: Rename VIR_SAVE_PARAM_* to VIR_DOMAIN_SAVE_PARAM_*

Michal Privoznik posted 1 patch 1 year, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3959ecf2ef41679b7821eaed44b8f05a29ab3b89.1652343984.git.mprivozn@redhat.com
include/libvirt/libvirt-domain.h |  8 ++++----
src/qemu/qemu_driver.c           | 22 ++++++++++++++--------
2 files changed, 18 insertions(+), 12 deletions(-)
[PATCH] lib: Rename VIR_SAVE_PARAM_* to VIR_DOMAIN_SAVE_PARAM_*
Posted by Michal Privoznik 1 year, 11 months ago
A few commits ago new APIs were introduced (virDomainSaveParams()
and virDomainRestoreParams()) and with them new typed parameters:
VIR_SAVE_PARAM_FILE and VIR_SAVE_PARAM_DXML. But their name does
not suggest they apply to either of the APIs nor that they are
intended for domain related APIs. Switch to
VIR_DOMAIN_SAVE_PARAM prefix to make it obvious.

It's true we already have VIR_DOMAIN_SAVE_* symbols which are
part of virDomainSaveRestoreFlags enum, therefore stick also with
'_PARAM_ ' part of the name to differentiate the two.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 include/libvirt/libvirt-domain.h |  8 ++++----
 src/qemu/qemu_driver.c           | 22 ++++++++++++++--------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index cf9d9efd51..24846046aa 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1579,16 +1579,16 @@ int                     virDomainRestoreParams  (virConnectPtr conn,
                                                  unsigned int flags);
 
 /**
- * VIR_SAVE_PARAM_FILE:
+ * VIR_DOMAIN_SAVE_PARAM_FILE:
  *
  * the parameter used to specify the savestate file to save to or restore from.
  *
  * Since: 8.4.0
  */
-# define VIR_SAVE_PARAM_FILE                     "file"
+# define VIR_DOMAIN_SAVE_PARAM_FILE             "file"
 
 /**
- * VIR_SAVE_PARAM_DXML:
+ * VIR_DOMAIN_SAVE_PARAM_DXML:
  *
  * an optional parameter used to adjust guest xml on restore.
  * If the hypervisor supports it, it can be used to alter
@@ -1598,7 +1598,7 @@ int                     virDomainRestoreParams  (virConnectPtr conn,
  *
  * Since: 8.4.0
  */
-# define VIR_SAVE_PARAM_DXML                     "dxml"
+# define VIR_DOMAIN_SAVE_PARAM_DXML             "dxml"
 
 /* See below for virDomainSaveImageXMLFlags */
 char *          virDomainSaveImageGetXMLDesc    (virConnectPtr conn,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e3582f62a7..41c6836390 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2823,14 +2823,18 @@ qemuDomainSaveParams(virDomainPtr dom,
                   VIR_DOMAIN_SAVE_PAUSED, -1);
 
     if (virTypedParamsValidate(params, nparams,
-                               VIR_SAVE_PARAM_FILE, VIR_TYPED_PARAM_STRING,
-                               VIR_SAVE_PARAM_DXML, VIR_TYPED_PARAM_STRING,
+                               VIR_DOMAIN_SAVE_PARAM_FILE,
+                               VIR_TYPED_PARAM_STRING,
+                               VIR_DOMAIN_SAVE_PARAM_DXML,
+                               VIR_TYPED_PARAM_STRING,
                                NULL) < 0)
         return -1;
 
-    if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_FILE, &to) < 0)
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_DOMAIN_SAVE_PARAM_FILE, &to) < 0)
         return -1;
-    if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_DXML, &dxml) < 0)
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_DOMAIN_SAVE_PARAM_DXML, &dxml) < 0)
         return -1;
 
     cfg = virQEMUDriverGetConfig(driver);
@@ -5936,14 +5940,16 @@ qemuDomainRestoreParams(virConnectPtr conn,
     int ret = -1;
 
     if (virTypedParamsValidate(params, nparams,
-                               VIR_SAVE_PARAM_FILE, VIR_TYPED_PARAM_STRING,
-                               VIR_SAVE_PARAM_DXML, VIR_TYPED_PARAM_STRING,
+                               VIR_DOMAIN_SAVE_PARAM_FILE, VIR_TYPED_PARAM_STRING,
+                               VIR_DOMAIN_SAVE_PARAM_DXML, VIR_TYPED_PARAM_STRING,
                                NULL) < 0)
         return -1;
 
-    if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_FILE, &path) < 0)
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_DOMAIN_SAVE_PARAM_FILE, &path) < 0)
         return -1;
-    if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_DXML, &dxml) < 0)
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_DOMAIN_SAVE_PARAM_DXML, &dxml) < 0)
         return -1;
 
     ret = qemuDomainRestoreInternal(conn, path, dxml, flags,
-- 
2.35.1
Re: [PATCH] lib: Rename VIR_SAVE_PARAM_* to VIR_DOMAIN_SAVE_PARAM_*
Posted by Daniel P. Berrangé 1 year, 11 months ago
On Thu, May 12, 2022 at 10:31:10AM +0200, Michal Privoznik wrote:
> A few commits ago new APIs were introduced (virDomainSaveParams()
> and virDomainRestoreParams()) and with them new typed parameters:
> VIR_SAVE_PARAM_FILE and VIR_SAVE_PARAM_DXML. But their name does
> not suggest they apply to either of the APIs nor that they are
> intended for domain related APIs. Switch to
> VIR_DOMAIN_SAVE_PARAM prefix to make it obvious.
> 
> It's true we already have VIR_DOMAIN_SAVE_* symbols which are
> part of virDomainSaveRestoreFlags enum, therefore stick also with
> '_PARAM_ ' part of the name to differentiate the two.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  include/libvirt/libvirt-domain.h |  8 ++++----
>  src/qemu/qemu_driver.c           | 22 ++++++++++++++--------
>  2 files changed, 18 insertions(+), 12 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|