[libvirt] [PATCH 11/23] Replace use of virLockError with virReportError

Jiri Denemark jdenemar at redhat.com
Fri Jul 20 11:30:08 UTC 2012


On Wed, Jul 18, 2012 at 19:40:47 +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Update the lock manager drivers to use virReportError instead
> of the virLockError custom macro
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/locking/lock_driver_sanlock.c |  157 ++++++++++++++++++-------------------
>  src/locking/lock_manager.c        |   30 +++----
>  2 files changed, 89 insertions(+), 98 deletions(-)
> 
> diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
> index 40cd518..67b70ca 100644
> --- a/src/locking/lock_driver_sanlock.c
> +++ b/src/locking/lock_driver_sanlock.c
...
> @@ -862,7 +857,7 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock,
>      virCheckFlags(0, -1);
>  
>      if (!state) {
> -        virLockError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> +        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
>          return -1;
>      }
>  

You'll see a merge conflict with this hunk since __FUNCTION__ was replaced
with "state".

...

ACK

And again, few missing "%s":

diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 67b70ca..2352968 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -291,7 +291,7 @@ static int virLockManagerSanlockInit(unsigned int version,
         goto error;
 
     if (driver->autoDiskLease && !driver->hostID) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Automatic disk lease mode enabled, but no host ID is set"));
         goto error;
     }
@@ -333,7 +333,7 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock,
     virCheckFlags(0, -1);
 
     if (!driver) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Sanlock plugin is not initialized"));
         return -1;
     }
@@ -404,13 +404,13 @@ static int virLockManagerSanlockDiskLeaseName(const char *path,
     int i;
 
     if (strbuflen < ((MD5_DIGEST_SIZE * 2) + 1)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("String length too small to store md5 checksum"));
         return -1;
     }
 
     if (!(md5_buffer(path, strlen(path), buf))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Unable to compute md5 checksum"));
         return -1;
     }
@@ -494,7 +494,7 @@ static int virLockManagerSanlockAddDisk(virLockManagerPtr lock,
     char *path = NULL;
 
     if (nparams) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Unexpected lock parameters for disk resource"));
         return -1;
     }
-- 
1.7.11.1




More information about the libvir-list mailing list