Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
297c704a
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
297c704a
编写于
9月 18, 2012
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
locking: Add support for lock failure action
上级
d236f3fc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
19 addition
and
9 deletion
+19
-9
src/Makefile.am
src/Makefile.am
+1
-1
src/locking/domain_lock.c
src/locking/domain_lock.c
+7
-4
src/locking/lock_driver.h
src/locking/lock_driver.h
+4
-1
src/locking/lock_driver_nop.c
src/locking/lock_driver_nop.c
+1
-0
src/locking/lock_driver_sanlock.c
src/locking/lock_driver_sanlock.c
+1
-0
src/locking/lock_manager.c
src/locking/lock_manager.c
+4
-3
src/locking/lock_manager.h
src/locking/lock_manager.h
+1
-0
未找到文件。
src/Makefile.am
浏览文件 @
297c704a
...
...
@@ -1502,7 +1502,7 @@ lockdriverdir = $(libdir)/libvirt/lock-driver
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
...
...
src/locking/domain_lock.c
浏览文件 @
297c704a
...
...
@@ -175,7 +175,8 @@ int virDomainLockProcessStart(virLockManagerPluginPtr plugin,
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
);
...
...
@@ -215,7 +216,7 @@ int virDomainLockProcessResume(virLockManagerPluginPtr plugin,
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
;
...
...
@@ -258,7 +259,8 @@ int virDomainLockDiskAttach(virLockManagerPluginPtr plugin,
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
;
...
...
@@ -314,7 +316,8 @@ int virDomainLockLeaseAttach(virLockManagerPluginPtr plugin,
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
;
...
...
src/locking/lock_driver.h
浏览文件 @
297c704a
...
...
@@ -23,6 +23,7 @@
# define __VIR_PLUGINS_LOCK_DRIVER_H__
# include "internal.h"
# include "domain_conf.h"
typedef
struct
_virLockManager
virLockManager
;
typedef
virLockManager
*
virLockManagerPtr
;
...
...
@@ -218,12 +219,13 @@ typedef int (*virLockDriverAddResource)(virLockManagerPtr man,
* @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.
*
...
...
@@ -237,6 +239,7 @@ typedef int (*virLockDriverAddResource)(virLockManagerPtr man,
typedef
int
(
*
virLockDriverAcquire
)(
virLockManagerPtr
man
,
const
char
*
state
,
unsigned
int
flags
,
virDomainLockFailureAction
action
,
int
*
fd
);
/**
...
...
src/locking/lock_driver_nop.c
浏览文件 @
297c704a
...
...
@@ -69,6 +69,7 @@ static int virLockManagerNopAddResource(virLockManagerPtr lock ATTRIBUTE_UNUSED,
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
;
...
...
src/locking/lock_driver_sanlock.c
浏览文件 @
297c704a
...
...
@@ -686,6 +686,7 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
static
int
virLockManagerSanlockAcquire
(
virLockManagerPtr
lock
,
const
char
*
state
,
unsigned
int
flags
,
virDomainLockFailureAction
action
ATTRIBUTE_UNUSED
,
int
*
fd
)
{
virLockManagerSanlockPrivatePtr
priv
=
lock
->
privateData
;
...
...
src/locking/lock_manager.c
浏览文件 @
297c704a
...
...
@@ -347,17 +347,18 @@ int virLockManagerAddResource(virLockManagerPtr lock,
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
);
}
...
...
src/locking/lock_manager.h
浏览文件 @
297c704a
...
...
@@ -56,6 +56,7 @@ int virLockManagerAddResource(virLockManagerPtr manager,
int
virLockManagerAcquire
(
virLockManagerPtr
manager
,
const
char
*
state
,
unsigned
int
flags
,
virDomainLockFailureAction
action
,
int
*
fd
);
int
virLockManagerRelease
(
virLockManagerPtr
manager
,
char
**
state
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录