[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [Patch] Libvirt - Fix locking for readonly devices



Hi,

I'm currently working on getting sanlock into Debian/Ubuntu.
While testing, I noticed that I wasn't able to add a readonly
or shared device: "internal error unsupported
configuration: Readonly leases are not supported".

After looking into the source, it seems to be the following
situation:
- Libvirt passes every device to the sanlock plugin, even if
it is readonly
- The sanlock plugin rejects to add a lease for the readonly
device, returning an error so the machine starts to fail

The attached patch rejects passing readonly and shared devices
to the lock-plugin so they shouldn't be a problem anymore.

Would this be an appropriated way to fix this problem? (I'm
neither experienced in libvirt nor C)

What seems odd to me is that Fedora either doesn't hit this
or nobody has ever reported it.

I'm not member of this list so please CC me.

Thanks!

Cheers,
David

-----------------------------------------
diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index de1937c..45617e6 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -79,9 +79,9 @@ static int virDomainLockManagerAddDisk(virLockManagerPtr lock,
         return 0;

     if (disk->readonly)
-        diskFlags |= VIR_LOCK_MANAGER_RESOURCE_READONLY;
+        return 0;
     if (disk->shared)
-        diskFlags |= VIR_LOCK_MANAGER_RESOURCE_SHARED;
+        return 0;

     VIR_DEBUG("Add disk %s", disk->src);
     if (virLockManagerAddResource(lock,


diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index de1937c..45617e6 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -79,9 +79,9 @@ static int virDomainLockManagerAddDisk(virLockManagerPtr lock,
         return 0;
 
     if (disk->readonly)
-        diskFlags |= VIR_LOCK_MANAGER_RESOURCE_READONLY;
+        return 0;
     if (disk->shared)
-        diskFlags |= VIR_LOCK_MANAGER_RESOURCE_SHARED;
+        return 0;
 
     VIR_DEBUG("Add disk %s", disk->src);
     if (virLockManagerAddResource(lock,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]