@@ -39,6 +39,7 @@ interval=0
3939rflag=0
4040cflag=0
4141UUIDList=
42+ skeyPath=" /var/lib/libvirt/images/"
4243
4344while getopts ' p:n:s:h:i:t:u:r:c' OPTION
4445do
@@ -81,38 +82,38 @@ if [ -z "$PoolName" ]; then
8182fi
8283
8384# rados object touch action for vol list
84- res=$( rbd -p $PoolName ls --id $PoolAuthUserName | grep MOLD-AC)
85+ res=$( rbd -p $PoolName ls --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret | grep MOLD-AC)
8586if [ $? -gt 0 ]; then
86- rbd -p $PoolName create --size 1 --id $PoolAuthUserName MOLD-AC
87+ rbd -p $PoolName create --size 1 --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret MOLD-AC
8788fi
8889
8990timestamp=$( date +%s)
9091
9192if [ -n " $UUIDList " ]; then
9293 for uuid in $( echo $UUIDList | sed ' s/,/ /g' ) ; do
93- objId=$( rbd -p $PoolName info $uuid --id $PoolAuthUserName | grep ' id:' )
94+ objId=$( rbd -p $PoolName info $uuid --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret | grep ' id:' )
9495 objId=${objId#* id: }
9596 res=$( timeout 3s bash -c " rados -p $PoolName touch rbd_object_map.$objId " )
9697 if [ $? -eq 0 ]; then
9798 # 정상적인 touch 상태면 image meta에 key: uuid / value : timestamp 입력
98- rbd -p $PoolName --id $PoolAuthUserName image-meta set MOLD-AC $uuid $HostIP :$timestamp
99+ rbd -p $PoolName --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret image-meta set MOLD-AC $uuid $HostIP :$timestamp
99100 else
100101 # 정상적으로 touch 상태가 아니면 image meta에 key : uuid 삭제
101- rbd -p $PoolName --id $PoolAuthUserName image-meta rm MOLD-AC $uuid
102+ rbd -p $PoolName --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret image-meta rm MOLD-AC $uuid
102103 fi
103104 done
104105fi
105106
106107# write the heart beat log
107108write_hbLog () {
108109 Timestamp=$( date +%s)
109- obj=$( rbd -p $PoolName ls --id $PoolAuthUserName | grep MOLD-HB)
110+ obj=$( rbd -p $PoolName ls --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret | grep MOLD-HB)
110111
111112 if [ $? -gt 0 ]; then
112- rbd -p $PoolName create --size 1 --id $PoolAuthUserName MOLD-HB
113+ rbd -p $PoolName create --size 1 --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret MOLD-HB
113114 fi
114115
115- obj=$( rbd -p $PoolName --id $PoolAuthUserName image-meta set MOLD-HB $HostIP $Timestamp )
116+ obj=$( rbd -p $PoolName --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret image-meta set MOLD-HB $HostIP $Timestamp )
116117 if [ $? -gt 0 ]; then
117118 printf " Failed to create rbd file and set image-meta"
118119 return 2
@@ -123,7 +124,7 @@ write_hbLog() {
123124# check the heart beat log
124125check_hbLog () {
125126 now=$( date +%s)
126- getHbTime=$( rbd -p $PoolName --id $PoolAuthUserName image-meta get MOLD-HB $HostIP )
127+ getHbTime=$( rbd -p $PoolName --id $PoolAuthUserName -m $SourceHostIP -K $skeyPath$PoolAuthSecret image-meta get MOLD-HB $HostIP )
127128 if [ $? -gt 0 ] || [ -z " $getHbTime " ]; then
128129 return 1
129130 fi
0 commit comments