Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
6cf9a5bb
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,发现更多精彩内容 >>
提交
6cf9a5bb
编写于
3月 26, 2013
作者:
O
Osier Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
storage: Move virStorageBackendSCSIGetHostNumber into iscsi backend
It's only used by iscsi backend.
上级
c1f63a9b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
43 deletion
+38
-43
src/storage/storage_backend_iscsi.c
src/storage/storage_backend_iscsi.c
+38
-1
src/storage/storage_backend_scsi.c
src/storage/storage_backend_scsi.c
+0
-39
src/storage/storage_backend_scsi.h
src/storage/storage_backend_scsi.h
+0
-3
未找到文件。
src/storage/storage_backend_iscsi.c
浏览文件 @
6cf9a5bb
...
...
@@ -23,6 +23,7 @@
#include <config.h>
#include <dirent.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/types.h>
...
...
@@ -401,6 +402,42 @@ cleanup:
return
ret
;
}
static
int
virStorageBackendISCSIGetHostNumber
(
const
char
*
sysfs_path
,
uint32_t
*
host
)
{
int
retval
=
0
;
DIR
*
sysdir
=
NULL
;
struct
dirent
*
dirent
=
NULL
;
VIR_DEBUG
(
"Finding host number from '%s'"
,
sysfs_path
);
virFileWaitForDevices
();
sysdir
=
opendir
(
sysfs_path
);
if
(
sysdir
==
NULL
)
{
virReportSystemError
(
errno
,
_
(
"Failed to opendir path '%s'"
),
sysfs_path
);
retval
=
-
1
;
goto
out
;
}
while
((
dirent
=
readdir
(
sysdir
)))
{
if
(
STREQLEN
(
dirent
->
d_name
,
"target"
,
strlen
(
"target"
)))
{
if
(
sscanf
(
dirent
->
d_name
,
"target%u:"
,
host
)
!=
1
)
{
VIR_DEBUG
(
"Failed to parse target '%s'"
,
dirent
->
d_name
);
retval
=
-
1
;
break
;
}
}
}
closedir
(
sysdir
);
out:
return
retval
;
}
static
int
virStorageBackendISCSIFindLUs
(
virStoragePoolObjPtr
pool
,
...
...
@@ -416,7 +453,7 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
return
-
1
;
}
if
(
virStorageBackendSCSIGetHostNumber
(
sysfs_path
,
&
host
)
<
0
)
{
if
(
virStorageBackend
I
SCSIGetHostNumber
(
sysfs_path
,
&
host
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Failed to get host number for iSCSI session "
"with path '%s'"
),
...
...
src/storage/storage_backend_scsi.c
浏览文件 @
6cf9a5bb
...
...
@@ -547,45 +547,6 @@ out:
return
retval
;
}
int
virStorageBackendSCSIGetHostNumber
(
const
char
*
sysfs_path
,
uint32_t
*
host
)
{
int
retval
=
0
;
DIR
*
sysdir
=
NULL
;
struct
dirent
*
dirent
=
NULL
;
VIR_DEBUG
(
"Finding host number from '%s'"
,
sysfs_path
);
virFileWaitForDevices
();
sysdir
=
opendir
(
sysfs_path
);
if
(
sysdir
==
NULL
)
{
virReportSystemError
(
errno
,
_
(
"Failed to opendir path '%s'"
),
sysfs_path
);
retval
=
-
1
;
goto
out
;
}
while
((
dirent
=
readdir
(
sysdir
)))
{
if
(
STREQLEN
(
dirent
->
d_name
,
"target"
,
strlen
(
"target"
)))
{
if
(
sscanf
(
dirent
->
d_name
,
"target%u:"
,
host
)
!=
1
)
{
VIR_DEBUG
(
"Failed to parse target '%s'"
,
dirent
->
d_name
);
retval
=
-
1
;
break
;
}
}
}
closedir
(
sysdir
);
out:
return
retval
;
}
static
int
virStorageBackendSCSITriggerRescan
(
uint32_t
host
)
{
...
...
src/storage/storage_backend_scsi.h
浏览文件 @
6cf9a5bb
...
...
@@ -32,9 +32,6 @@
extern
virStorageBackend
virStorageBackendSCSI
;
int
virStorageBackendSCSIGetHostNumber
(
const
char
*
sysfs_path
,
uint32_t
*
host
);
int
virStorageBackendSCSIFindLUs
(
virStoragePoolObjPtr
pool
,
uint32_t
scanhost
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录