Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1f49b05a
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看板
提交
1f49b05a
编写于
7月 18, 2013
作者:
J
John Ferlan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conf: Introduce virDomainDiskSourceIsBlockType
Introduce a new helper to check if the disk source is of block type
上级
c00b2f0d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
21 deletion
+43
-21
src/conf/domain_conf.c
src/conf/domain_conf.c
+32
-0
src/conf/domain_conf.h
src/conf/domain_conf.h
+3
-0
src/libvirt_private.syms
src/libvirt_private.syms
+1
-0
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+2
-3
src/qemu/qemu_conf.c
src/qemu/qemu_conf.c
+5
-18
未找到文件。
src/conf/domain_conf.c
浏览文件 @
1f49b05a
...
...
@@ -41,6 +41,7 @@
#include "virbuffer.h"
#include "virlog.h"
#include "nwfilter_conf.h"
#include "storage_conf.h"
#include "virstoragefile.h"
#include "virfile.h"
#include "virbitmap.h"
...
...
@@ -18380,3 +18381,34 @@ virDomainDefFindDevice(virDomainDefPtr def,
return 0;
}
/**
* virDomainDiskSourceIsBlockType:
*
* Check if the disk *source* is of block type. This just tries
* to check from the type of disk def, not to probe the underlying
* storage.
*
* Return true if its source is block type, or false otherwise.
*/
bool
virDomainDiskSourceIsBlockType(virDomainDiskDefPtr def)
{
/* No reason to think the disk source is block type if
* the source is empty
*/
if (!def->src)
return false;
if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK)
return true;
/* For volume types, check the srcpool.
* If it's a block type source pool, then it's possible
*/
if (def->type == VIR_DOMAIN_DISK_TYPE_VOLUME && def->srcpool &&
def->srcpool->voltype == VIR_STORAGE_VOL_BLOCK) {
return true;
}
return false;
}
src/conf/domain_conf.h
浏览文件 @
1f49b05a
...
...
@@ -2715,4 +2715,7 @@ int virDomainDefFindDevice(virDomainDefPtr def,
virDomainDeviceDefPtr
dev
,
bool
reportError
);
bool
virDomainDiskSourceIsBlockType
(
virDomainDiskDefPtr
def
)
ATTRIBUTE_NONNULL
(
1
);
#endif
/* __DOMAIN_CONF_H */
src/libvirt_private.syms
浏览文件 @
1f49b05a
...
...
@@ -206,6 +206,7 @@ virDomainDiskProtocolTransportTypeToString;
virDomainDiskProtocolTypeToString;
virDomainDiskRemove;
virDomainDiskRemoveByName;
virDomainDiskSourceIsBlockType;
virDomainDiskTypeFromString;
virDomainDiskTypeToString;
virDomainEmulatorPinAdd;
...
...
src/qemu/qemu_command.c
浏览文件 @
1f49b05a
...
...
@@ -42,6 +42,7 @@
#include "domain_audit.h"
#include "domain_conf.h"
#include "snapshot_conf.h"
#include "storage_conf.h"
#include "network/bridge_driver.h"
#include "virnetdevtap.h"
#include "base64.h"
...
...
@@ -3492,9 +3493,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
virDomainDiskProtocolTypeToString
(
disk
->
protocol
));
goto
error
;
}
}
else
if
(
disk
->
type
!=
VIR_DOMAIN_DISK_TYPE_BLOCK
&&
!
(
disk
->
type
==
VIR_DOMAIN_DISK_TYPE_VOLUME
&&
disk
->
srcpool
->
voltype
==
VIR_STORAGE_VOL_BLOCK
))
{
}
else
if
(
!
virDomainDiskSourceIsBlockType
(
disk
))
{
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
"%s"
,
_
(
"disk device='lun' is only valid for block type disk source"
));
goto
error
;
...
...
src/qemu/qemu_conf.c
浏览文件 @
1f49b05a
...
...
@@ -52,6 +52,7 @@
#include "virfile.h"
#include "virstring.h"
#include "viratomic.h"
#include "storage_conf.h"
#include "configmake.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
...
...
@@ -867,12 +868,7 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
if
(
dev
->
type
==
VIR_DOMAIN_DEVICE_DISK
)
{
disk
=
dev
->
data
.
disk
;
if
(
!
disk
->
shared
||
!
disk
->
src
||
(
disk
->
type
!=
VIR_DOMAIN_DISK_TYPE_BLOCK
&&
!
(
disk
->
type
==
VIR_DOMAIN_DISK_TYPE_VOLUME
&&
disk
->
srcpool
&&
disk
->
srcpool
->
voltype
==
VIR_STORAGE_VOL_BLOCK
)))
if
(
!
disk
->
shared
||
!
virDomainDiskSourceIsBlockType
(
disk
))
return
0
;
}
else
if
(
dev
->
type
==
VIR_DOMAIN_DEVICE_HOSTDEV
)
{
hostdev
=
dev
->
data
.
hostdev
;
...
...
@@ -978,12 +974,7 @@ qemuRemoveSharedDevice(virQEMUDriverPtr driver,
if
(
dev
->
type
==
VIR_DOMAIN_DEVICE_DISK
)
{
disk
=
dev
->
data
.
disk
;
if
(
!
disk
->
shared
||
!
disk
->
src
||
(
disk
->
type
!=
VIR_DOMAIN_DISK_TYPE_BLOCK
&&
!
(
disk
->
type
==
VIR_DOMAIN_DISK_TYPE_VOLUME
&&
disk
->
srcpool
&&
disk
->
srcpool
->
voltype
==
VIR_STORAGE_VOL_BLOCK
)))
if
(
!
disk
->
shared
||
!
virDomainDiskSourceIsBlockType
(
disk
))
return
0
;
}
else
if
(
dev
->
type
==
VIR_DOMAIN_DEVICE_HOSTDEV
)
{
hostdev
=
dev
->
data
.
hostdev
;
...
...
@@ -1073,12 +1064,8 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
if
(
dev
->
type
==
VIR_DOMAIN_DEVICE_DISK
)
{
disk
=
dev
->
data
.
disk
;
if
(
!
disk
->
src
||
disk
->
device
!=
VIR_DOMAIN_DISK_DEVICE_LUN
||
(
disk
->
type
!=
VIR_DOMAIN_DISK_TYPE_BLOCK
&&
!
(
disk
->
type
==
VIR_DOMAIN_DISK_TYPE_VOLUME
&&
disk
->
srcpool
&&
disk
->
srcpool
->
voltype
==
VIR_STORAGE_VOL_BLOCK
)))
if
(
disk
->
device
!=
VIR_DOMAIN_DISK_DEVICE_LUN
||
virDomainDiskSourceIsBlockType
(
disk
))
return
0
;
path
=
disk
->
src
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录