Package: libvirt0 Version: 0.9.12-1.1 Severity: wishlist File: libvirt Hi,
please apply the attached patch to enable sanlock in libvirt Thanks! Cheers, David
commit 778f9c0232b916f99174ce4a2a6139090a1495e1 Author: David Weber <w...@munzinger.de> Date: Mon Jun 4 17:18:39 2012 +0200 Enable sanlock diff --git a/debian/changelog b/debian/changelog index 7d3c5bb..9bbea9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libvirt (0.9.12-1.1) UNRELEASED; urgency=low + + * Non-maintainer upload. + * Enable Sanlock + + -- David Weber <w...@munzinger.de> Mon, 04 Jun 2012 16:12:04 +0200 + libvirt (0.9.12-1) experimental; urgency=low * [75e280b] New upstream version 0.9.12 diff --git a/debian/control b/debian/control index 6092f86..5d5997a 100644 --- a/debian/control +++ b/debian/control @@ -33,6 +33,8 @@ Build-Depends: cdbs (>= 0.4.90~), libnuma-dev [amd64 i386 ia64 mips mipsel powerpc], radvd [linux-any], libnetcf-dev [linux-any], + libsanlock-dev, + libsanlock-client1, # For "make check" dwarves, libxml2-utils, @@ -95,6 +97,18 @@ Description: library for interfacing with different virtualization systems . This package contains the debugging symbols. +Package: libvirt-sanlock +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libvirt0 (= ${binary:Version}), augeas-tools +Priority: extra +Description: library for interfacing with different virtualization systems + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, XEN, OpenVZ, LXC, and VirtualBox. + . + This package contains the sanlock plugin. + Package: libvirt-doc Architecture: all Section: doc diff --git a/debian/libvirt-bin.install b/debian/libvirt-bin.install index dd9b344..72f23a4 100644 --- a/debian/libvirt-bin.install +++ b/debian/libvirt-bin.install @@ -3,7 +3,8 @@ usr/sbin/* etc/libvirt/* etc/sasl2/* usr/share/polkit-1 -usr/lib/libvirt/* +usr/lib/libvirt/libvirt* +usr/lib/libvirt/connection-driver usr/share/augeas/* usr/share/libvirt/* usr/share/man/man8/* diff --git a/debian/libvirt-sanlock.cron.weekly b/debian/libvirt-sanlock.cron.weekly new file mode 100644 index 0000000..170d91b --- /dev/null +++ b/debian/libvirt-sanlock.cron.weekly @@ -0,0 +1,10 @@ +#!/bin/sh + +#Disabled by default, uncomment to enable +exit 0 + + +/usr/sbin/virt-sanlock-cleanup -q 2>/dev/null +exit 0 + + diff --git a/debian/libvirt-sanlock.install b/debian/libvirt-sanlock.install new file mode 100644 index 0000000..d8a7348 --- /dev/null +++ b/debian/libvirt-sanlock.install @@ -0,0 +1 @@ +usr/lib/libvirt/lock-driver/sanlock.so diff --git a/debian/patches/add_ignore_param_to_sanlock.patch b/debian/patches/add_ignore_param_to_sanlock.patch new file mode 100644 index 0000000..159129e --- /dev/null +++ b/debian/patches/add_ignore_param_to_sanlock.patch @@ -0,0 +1,106 @@ +From b8012ce9312f00947c5ca7250a7a96534c85835f Mon Sep 17 00:00:00 2001 +From: David Weber <w...@munzinger.de> +Date: Mon, 14 May 2012 09:53:02 +0000 +Subject: [PATCH 1/1] sanlock: fix locking for readonly devices + +Add ignore param for readonly and shared disk in sanlock +--- + AUTHORS | 1 + + src/locking/libvirt_sanlock.aug | 1 + + src/locking/lock_driver_sanlock.c | 13 ++++++++++++- + src/locking/sanlock.conf | 7 +++++++ + src/locking/test_libvirt_sanlock.aug | 2 ++ + 5 files changed, 23 insertions(+), 1 deletions(-) + +diff --git a/src/locking/libvirt_sanlock.aug b/src/locking/libvirt_sanlock.aug +index 5f5f8a1..d65b002 100644 +--- a/src/locking/libvirt_sanlock.aug ++++ b/src/locking/libvirt_sanlock.aug +@@ -21,6 +21,7 @@ module Libvirt_sanlock = + | bool_entry "auto_disk_leases" + | int_entry "host_id" + | bool_entry "require_lease_for_disks" ++ | bool_entry "ignore_readonly_and_shared_disks" + let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ] + let empty = [ label "#empty" . eol ] + +diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c +index d344d6a..146aefd 100644 +--- a/src/locking/lock_driver_sanlock.c ++++ b/src/locking/lock_driver_sanlock.c +@@ -1,7 +1,7 @@ + /* + * lock_driver_sanlock.c: A lock driver for Sanlock + * +- * Copyright (C) 2010-2011 Red Hat, Inc. ++ * Copyright (C) 2010-2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -65,6 +65,7 @@ struct _virLockManagerSanlockDriver { + bool requireLeaseForDisks; + int hostID; + bool autoDiskLease; ++ bool ignoreReadonlyShared; + char *autoDiskLeasePath; + }; + +@@ -114,6 +115,10 @@ static int virLockManagerSanlockLoadConfig(const char *configFile) + CHECK_TYPE("auto_disk_leases", VIR_CONF_LONG); + if (p) driver->autoDiskLease = p->l; + ++ p = virConfGetValue(conf, "ignore_readonly_and_shared_disks"); ++ CHECK_TYPE("ignore_readonly_and_shared_disks", VIR_CONF_LONG); ++ if (p) driver->ignoreReadonlyShared = p->l; ++ + p = virConfGetValue(conf, "disk_lease_dir"); + CHECK_TYPE("disk_lease_dir", VIR_CONF_STRING); + if (p && p->str) { +@@ -625,6 +630,12 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock, + return -1; + } + ++ if ((flags & (VIR_LOCK_MANAGER_RESOURCE_READONLY | ++ VIR_LOCK_MANAGER_RESOURCE_SHARED)) && ++ driver->ignoreReadonlyShared) { ++ return 0; ++ } ++ + if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY) { + virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Readonly leases are not supported")); +diff --git a/src/locking/sanlock.conf b/src/locking/sanlock.conf +index efc35ee..19ab2b3 100644 +--- a/src/locking/sanlock.conf ++++ b/src/locking/sanlock.conf +@@ -52,3 +52,10 @@ + # to enabled, otherwise it defaults to disabled. + # + #require_lease_for_disks = 1 ++ ++# ++# Enable this flag to have sanlock ignore readonly and shared disks. ++# If disabled, then this rejects attempts to share resources until ++# sanlock gains support for shared locks. ++# ++#ignore_readonly_and_shared_disks = 1 +diff --git a/src/locking/test_libvirt_sanlock.aug b/src/locking/test_libvirt_sanlock.aug +index b5169e1..90ab59f 100644 +--- a/src/locking/test_libvirt_sanlock.aug ++++ b/src/locking/test_libvirt_sanlock.aug +@@ -4,6 +4,7 @@ module Test_libvirt_sanlock = + disk_lease_dir = \"/var/lib/libvirt/sanlock\" + host_id = 1 + require_lease_for_disks = 1 ++ignore_readonly_and_shared_disks = 1 + " + + test Libvirt_sanlock.lns get conf = +@@ -11,3 +12,4 @@ require_lease_for_disks = 1 + { "disk_lease_dir" = "/var/lib/libvirt/sanlock" } + { "host_id" = "1" } + { "require_lease_for_disks" = "1" } ++{ "ignore_readonly_and_shared_disks" = "1" } +-- +1.7.1 + diff --git a/debian/patches/series b/debian/patches/series index 2081602..cafcc03 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,3 +9,4 @@ virsh-Initialize-library-before-calling-virResetLast.patch Disable-gnulib-s-test-nonplocking-pipe.sh.patch Disable-failing-virnetsockettest.patch Don-t-fail-if-we-can-t-setup-avahi.patch +add_ignore_param_to_sanlock.patch