Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
565d040f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
565d040f
编写于
12月 11, 2012
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for locking based on LVM volume uuid
上级
f14fdae3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
1 deletion
+53
-1
src/locking/libvirt_lockd.aug
src/locking/libvirt_lockd.aug
+1
-0
src/locking/lock_driver_lockd.c
src/locking/lock_driver_lockd.c
+37
-1
src/locking/lockd.conf
src/locking/lockd.conf
+14
-0
src/locking/test_libvirt_lockd.aug.in
src/locking/test_libvirt_lockd.aug.in
+1
-0
未找到文件。
src/locking/libvirt_lockd.aug
浏览文件 @
565d040f
...
...
@@ -20,6 +20,7 @@ module Libvirt_lockd =
let
entry
=
bool_entry
"auto_disk_leases"
|
bool_entry
"require_lease_for_disks"
|
str_entry
"file_lockspace_dir"
|
str_entry
"lvm_lockspace_dir"
let
comment
=
[
label
"#comment"
.
del
/
#[ \t]*/
"# "
.
store
/
([^ \t\n][^\n]*)?/
.
del
/
\n/
"
\n
"
]
let
empty
=
[
label
"#empty"
.
eol
]
...
...
src/locking/lock_driver_lockd.c
浏览文件 @
565d040f
...
...
@@ -73,6 +73,7 @@ struct _virLockManagerLockDaemonDriver {
bool
requireLeaseForDisks
;
char
*
fileLockSpaceDir
;
char
*
lvmLockSpaceDir
;
};
static
virLockManagerLockDaemonDriverPtr
driver
=
NULL
;
...
...
@@ -134,6 +135,17 @@ static int virLockManagerLockDaemonLoadConfig(const char *configFile)
}
}
p
=
virConfGetValue
(
conf
,
"lvm_lockspace_dir"
);
CHECK_TYPE
(
"lvm_lockspace_dir"
,
VIR_CONF_STRING
);
if
(
p
&&
p
->
str
)
{
VIR_FREE
(
driver
->
lvmLockSpaceDir
);
if
(
!
(
driver
->
lvmLockSpaceDir
=
strdup
(
p
->
str
)))
{
virReportOOMError
();
virConfFree
(
conf
);
return
-
1
;
}
}
p
=
virConfGetValue
(
conf
,
"require_lease_for_disks"
);
CHECK_TYPE
(
"require_lease_for_disks"
,
VIR_CONF_LONG
);
if
(
p
)
...
...
@@ -371,8 +383,11 @@ static int virLockManagerLockDaemonInit(unsigned int version,
if
(
driver
->
fileLockSpaceDir
&&
virLockManagerLockDaemonSetupLockspace
(
driver
->
fileLockSpaceDir
)
<
0
)
goto
error
;
}
if
(
driver
->
lvmLockSpaceDir
&&
virLockManagerLockDaemonSetupLockspace
(
driver
->
lvmLockSpaceDir
)
<
0
)
goto
error
;
}
return
0
;
...
...
@@ -546,6 +561,26 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock,
return
0
;
}
/* XXX we should somehow pass in TYPE=BLOCK info
* from the domain_lock code, instead of assuming /dev
*/
if
(
STRPREFIX
(
name
,
"/dev"
)
&&
driver
->
lvmLockSpaceDir
)
{
VIR_DEBUG
(
"Trying to find an LVM UUID for %s"
,
name
);
if
(
virStorageFileGetLVMKey
(
name
,
&
newName
)
<
0
)
goto
error
;
if
(
newName
)
{
VIR_DEBUG
(
"Got an LVM UUID %s for %s"
,
newName
,
name
);
if
(
!
(
newLockspace
=
strdup
(
driver
->
lvmLockSpaceDir
)))
goto
no_memory
;
autoCreate
=
true
;
break
;
}
virResetLastError
();
/* Fallback to generic non-block code */
}
if
(
driver
->
fileLockSpaceDir
)
{
if
(
!
(
newLockspace
=
strdup
(
driver
->
fileLockSpaceDir
)))
goto
no_memory
;
...
...
@@ -623,6 +658,7 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock,
no_memory:
virReportOOMError
();
error:
VIR_FREE
(
newLockspace
);
VIR_FREE
(
newName
);
return
-
1
;
...
...
src/locking/lockd.conf
浏览文件 @
565d040f
...
...
@@ -38,3 +38,17 @@
# storage.
#
#file_lockspace_dir = "/var/lib/libvirt/lockd/files"
#
# When using LVM volumes that can be visible across
# multiple, it is desirable to do locking based on
# the unique UUID associated with each volume, instead
# of their paths. Setting this path causes libvirt to
# do UUID based locking for LVM.
#
# Typically this directory would be located on a shared
# filesystem visible to all hosts accessing the same
# storage.
#
#lvm_lockspace_dir = "/var/lib/libvirt/lockd/lvmvolumes"
src/locking/test_libvirt_lockd.aug.in
浏览文件 @
565d040f
...
...
@@ -5,3 +5,4 @@ module Test_libvirt_lockd =
{ "auto_disk_leases" = "0" }
{ "require_lease_for_disks" = "1" }
{ "file_lockspace_dir" = "/var/lib/libvirt/lockd/files" }
{ "lvm_lockspace_dir" = "/var/lib/libvirt/lockd/lvmvolumes" }
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录