Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
64f0e145
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看板
提交
64f0e145
编写于
12月 11, 2012
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for locking based on SCSI volume ID
上级
565d040f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
0 deletion
+49
-0
src/locking/libvirt_lockd.aug
src/locking/libvirt_lockd.aug
+1
-0
src/locking/lock_driver_lockd.c
src/locking/lock_driver_lockd.c
+33
-0
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
浏览文件 @
64f0e145
...
@@ -21,6 +21,7 @@ module Libvirt_lockd =
...
@@ -21,6 +21,7 @@ module Libvirt_lockd =
|
bool_entry
"require_lease_for_disks"
|
bool_entry
"require_lease_for_disks"
|
str_entry
"file_lockspace_dir"
|
str_entry
"file_lockspace_dir"
|
str_entry
"lvm_lockspace_dir"
|
str_entry
"lvm_lockspace_dir"
|
str_entry
"scsi_lockspace_dir"
let
comment
=
[
label
"#comment"
.
del
/
#[ \t]*/
"# "
.
store
/
([^ \t\n][^\n]*)?/
.
del
/
\n/
"
\n
"
]
let
comment
=
[
label
"#comment"
.
del
/
#[ \t]*/
"# "
.
store
/
([^ \t\n][^\n]*)?/
.
del
/
\n/
"
\n
"
]
let
empty
=
[
label
"#empty"
.
eol
]
let
empty
=
[
label
"#empty"
.
eol
]
...
...
src/locking/lock_driver_lockd.c
浏览文件 @
64f0e145
...
@@ -74,6 +74,7 @@ struct _virLockManagerLockDaemonDriver {
...
@@ -74,6 +74,7 @@ struct _virLockManagerLockDaemonDriver {
char
*
fileLockSpaceDir
;
char
*
fileLockSpaceDir
;
char
*
lvmLockSpaceDir
;
char
*
lvmLockSpaceDir
;
char
*
scsiLockSpaceDir
;
};
};
static
virLockManagerLockDaemonDriverPtr
driver
=
NULL
;
static
virLockManagerLockDaemonDriverPtr
driver
=
NULL
;
...
@@ -146,6 +147,17 @@ static int virLockManagerLockDaemonLoadConfig(const char *configFile)
...
@@ -146,6 +147,17 @@ static int virLockManagerLockDaemonLoadConfig(const char *configFile)
}
}
}
}
p
=
virConfGetValue
(
conf
,
"scsi_lockspace_dir"
);
CHECK_TYPE
(
"scsi_lockspace_dir"
,
VIR_CONF_STRING
);
if
(
p
&&
p
->
str
)
{
VIR_FREE
(
driver
->
scsiLockSpaceDir
);
if
(
!
(
driver
->
scsiLockSpaceDir
=
strdup
(
p
->
str
)))
{
virReportOOMError
();
virConfFree
(
conf
);
return
-
1
;
}
}
p
=
virConfGetValue
(
conf
,
"require_lease_for_disks"
);
p
=
virConfGetValue
(
conf
,
"require_lease_for_disks"
);
CHECK_TYPE
(
"require_lease_for_disks"
,
VIR_CONF_LONG
);
CHECK_TYPE
(
"require_lease_for_disks"
,
VIR_CONF_LONG
);
if
(
p
)
if
(
p
)
...
@@ -387,6 +399,10 @@ static int virLockManagerLockDaemonInit(unsigned int version,
...
@@ -387,6 +399,10 @@ static int virLockManagerLockDaemonInit(unsigned int version,
if
(
driver
->
lvmLockSpaceDir
&&
if
(
driver
->
lvmLockSpaceDir
&&
virLockManagerLockDaemonSetupLockspace
(
driver
->
lvmLockSpaceDir
)
<
0
)
virLockManagerLockDaemonSetupLockspace
(
driver
->
lvmLockSpaceDir
)
<
0
)
goto
error
;
goto
error
;
if
(
driver
->
scsiLockSpaceDir
&&
virLockManagerLockDaemonSetupLockspace
(
driver
->
scsiLockSpaceDir
)
<
0
)
goto
error
;
}
}
return
0
;
return
0
;
...
@@ -581,6 +597,23 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock,
...
@@ -581,6 +597,23 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock,
/* Fallback to generic non-block code */
/* Fallback to generic non-block code */
}
}
if
(
STRPREFIX
(
name
,
"/dev"
)
&&
driver
->
scsiLockSpaceDir
)
{
VIR_DEBUG
(
"Trying to find an SCSI ID for %s"
,
name
);
if
(
virStorageFileGetSCSIKey
(
name
,
&
newName
)
<
0
)
goto
error
;
if
(
newName
)
{
VIR_DEBUG
(
"Got an SCSI ID %s for %s"
,
newName
,
name
);
if
(
!
(
newLockspace
=
strdup
(
driver
->
scsiLockSpaceDir
)))
goto
no_memory
;
autoCreate
=
true
;
break
;
}
virResetLastError
();
/* Fallback to generic non-block code */
}
if
(
driver
->
fileLockSpaceDir
)
{
if
(
driver
->
fileLockSpaceDir
)
{
if
(
!
(
newLockspace
=
strdup
(
driver
->
fileLockSpaceDir
)))
if
(
!
(
newLockspace
=
strdup
(
driver
->
fileLockSpaceDir
)))
goto
no_memory
;
goto
no_memory
;
...
...
src/locking/lockd.conf
浏览文件 @
64f0e145
...
@@ -52,3 +52,17 @@
...
@@ -52,3 +52,17 @@
# storage.
# storage.
#
#
#lvm_lockspace_dir = "/var/lib/libvirt/lockd/lvmvolumes"
#lvm_lockspace_dir = "/var/lib/libvirt/lockd/lvmvolumes"
#
# When using SCSI 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 SCSI.
#
# Typically this directory would be located on a shared
# filesystem visible to all hosts accessing the same
# storage.
#
#scsi_lockspace_dir = "/var/lib/libvirt/lockd/scsivolumes"
src/locking/test_libvirt_lockd.aug.in
浏览文件 @
64f0e145
...
@@ -6,3 +6,4 @@ module Test_libvirt_lockd =
...
@@ -6,3 +6,4 @@ module Test_libvirt_lockd =
{ "require_lease_for_disks" = "1" }
{ "require_lease_for_disks" = "1" }
{ "file_lockspace_dir" = "/var/lib/libvirt/lockd/files" }
{ "file_lockspace_dir" = "/var/lib/libvirt/lockd/files" }
{ "lvm_lockspace_dir" = "/var/lib/libvirt/lockd/lvmvolumes" }
{ "lvm_lockspace_dir" = "/var/lib/libvirt/lockd/lvmvolumes" }
{ "scsi_lockspace_dir" = "/var/lib/libvirt/lockd/scsivolumes" }
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录