No real support implemented here. But hey, at least we will not
fail.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/locking/lock_driver_sanlock.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/locking/lock_driver_sanlock.c 
b/src/locking/lock_driver_sanlock.c
index 3e5f0e37b0..c1996fb937 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -791,7 +791,8 @@ static int 
virLockManagerSanlockAddResource(virLockManagerPtr lock,
     virLockManagerSanlockPrivatePtr priv = lock->privateData;
 
     virCheckFlags(VIR_LOCK_MANAGER_RESOURCE_READONLY |
-                  VIR_LOCK_MANAGER_RESOURCE_SHARED, -1);
+                  VIR_LOCK_MANAGER_RESOURCE_SHARED |
+                  VIR_LOCK_MANAGER_RESOURCE_METADATA, -1);
 
     if (priv->res_count == SANLK_MAX_RESOURCES) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -804,6 +805,11 @@ static int 
virLockManagerSanlockAddResource(virLockManagerPtr lock,
     if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY)
         return 0;
 
+    /* No metadata locking support for now.
+     * TODO: implement it. */
+    if (flags & VIR_LOCK_MANAGER_RESOURCE_METADATA)
+        return 0;
+
     switch (type) {
     case VIR_LOCK_MANAGER_RESOURCE_TYPE_DISK:
         if (driver->autoDiskLease) {
@@ -953,12 +959,17 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr 
lock,
     virCheckFlags(VIR_LOCK_MANAGER_ACQUIRE_RESTRICT |
                   VIR_LOCK_MANAGER_ACQUIRE_REGISTER_ONLY, -1);
 
-    if (priv->res_count == 0 &&
-        priv->hasRWDisks &&
-        driver->requireLeaseForDisks) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("Read/write, exclusive access, disks were present, 
but no leases specified"));
-        return -1;
+    if (priv->res_count == 0) {
+        if (priv->hasRWDisks &&
+            driver->requireLeaseForDisks) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Read/write, exclusive access, disks were 
present, but no leases specified"));
+            return -1;
+        }
+
+        /* We are not handling METADATA flag yet. So no resources
+         * case is no-op for now. */
+        return 0;
     }
 
     /* We only initialize 'sock' if we are in the real
-- 
2.16.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to