lockdriver_LTLIBRARIES = sanlock.la
sanlock_la_SOURCES = $(LOCK_DRIVER_SANLOCK_SOURCES)
-sanlock_la_CFLAGS = $(AM_CFLAGS)
+sanlock_la_CFLAGS = -I$(top_srcdir)/src/conf $(AM_CFLAGS)
sanlock_la_LDFLAGS = -module -avoid-version
sanlock_la_LIBADD = -lsanlock_client \
../gnulib/lib/libgnu.la
if (paused)
flags |= VIR_LOCK_MANAGER_ACQUIRE_REGISTER_ONLY;
- ret = virLockManagerAcquire(lock, NULL, flags, fd);
+ ret = virLockManagerAcquire(lock, NULL, flags,
+ dom->def->onLockFailure, fd);
virLockManagerFree(lock);
if (!(lock = virDomainLockManagerNew(plugin, uri, dom, true)))
return -1;
- ret = virLockManagerAcquire(lock, state, 0, NULL);
+ ret = virLockManagerAcquire(lock, state, 0, dom->def->onLockFailure, NULL);
virLockManagerFree(lock);
return ret;
if (virDomainLockManagerAddDisk(lock, disk) < 0)
goto cleanup;
- if (virLockManagerAcquire(lock, NULL, 0, NULL) < 0)
+ if (virLockManagerAcquire(lock, NULL, 0,
+ dom->def->onLockFailure, NULL) < 0)
goto cleanup;
ret = 0;
if (virDomainLockManagerAddLease(lock, lease) < 0)
goto cleanup;
- if (virLockManagerAcquire(lock, NULL, 0, NULL) < 0)
+ if (virLockManagerAcquire(lock, NULL, 0,
+ dom->def->onLockFailure, NULL) < 0)
goto cleanup;
ret = 0;
# define __VIR_PLUGINS_LOCK_DRIVER_H__
# include "internal.h"
+# include "domain_conf.h"
typedef struct _virLockManager virLockManager;
typedef virLockManager *virLockManagerPtr;
* @manager: the lock manager context
* @state: the current lock state
* @flags: optional flags, currently unused
+ * @action: action to take when lock is lost
* @fd: optional return the leaked FD
*
* Start managing resources for the object. This
* must be called from the PID that represents the
* object to be managed. If the lock is lost at any
- * time, the PID will be killed off by the lock manager.
+ * time, the specified action will be taken.
* The optional state contains information about the
* locks previously held for the object.
*
typedef int (*virLockDriverAcquire)(virLockManagerPtr man,
const char *state,
unsigned int flags,
+ virDomainLockFailureAction action,
int *fd);
/**
static int virLockManagerNopAcquire(virLockManagerPtr lock ATTRIBUTE_UNUSED,
const char *state ATTRIBUTE_UNUSED,
unsigned int flags_unused ATTRIBUTE_UNUSED,
+ virDomainLockFailureAction action ATTRIBUTE_UNUSED,
int *fd ATTRIBUTE_UNUSED)
{
return 0;
static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
const char *state,
unsigned int flags,
+ virDomainLockFailureAction action ATTRIBUTE_UNUSED,
int *fd)
{
virLockManagerSanlockPrivatePtr priv = lock->privateData;
int virLockManagerAcquire(virLockManagerPtr lock,
const char *state,
unsigned int flags,
+ virDomainLockFailureAction action,
int *fd)
{
- VIR_DEBUG("lock=%p state='%s' flags=%x fd=%p",
- lock, NULLSTR(state), flags, fd);
+ VIR_DEBUG("lock=%p state='%s' flags=%x action=%d fd=%p",
+ lock, NULLSTR(state), flags, action, fd);
CHECK_MANAGER(drvAcquire, -1);
if (fd)
*fd = -1;
- return lock->driver->drvAcquire(lock, state, flags, fd);
+ return lock->driver->drvAcquire(lock, state, flags, action, fd);
}
int virLockManagerAcquire(virLockManagerPtr manager,
const char *state,
unsigned int flags,
+ virDomainLockFailureAction action,
int *fd);
int virLockManagerRelease(virLockManagerPtr manager,
char **state,