Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
6445ad48
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看板
提交
6445ad48
编写于
12月 14, 2015
作者:
M
Martin Kletzander
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Add support for zero-detection writes
Signed-off-by:
N
Martin Kletzander
<
mkletzan@redhat.com
>
上级
d3c78499
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
65 addition
and
1 deletion
+65
-1
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.c
+2
-0
src/qemu/qemu_capabilities.h
src/qemu/qemu_capabilities.h
+1
-0
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+24
-0
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
+1
-0
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+1
-0
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+1
-0
tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
+1
-0
tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
+1
-0
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
+1
-0
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+1
-0
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-detect-zeroes.args
...muxml2argvdata/qemuxml2argv-disk-drive-detect-zeroes.args
+27
-0
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-detect-zeroes.xml
...emuxml2argvdata/qemuxml2argv-disk-drive-detect-zeroes.xml
+1
-1
tests/qemuxml2argvtest.c
tests/qemuxml2argvtest.c
+3
-0
未找到文件。
src/qemu/qemu_capabilities.c
浏览文件 @
6445ad48
...
...
@@ -333,6 +333,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"qxl.max_outputs"
,
/* 225 */
"qxl-vga.max_outputs"
,
"spice-unix"
,
"drive-detect-zeroes"
,
);
...
...
@@ -2650,6 +2651,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
{
"machine"
,
"mem-merge"
,
QEMU_CAPS_MEM_MERGE
},
{
"machine"
,
"vmport"
,
QEMU_CAPS_MACHINE_VMPORT_OPT
},
{
"drive"
,
"discard"
,
QEMU_CAPS_DRIVE_DISCARD
},
{
"drive"
,
"detect-zeroes"
,
QEMU_CAPS_DRIVE_DETECT_ZEROES
},
{
"realtime"
,
"mlock"
,
QEMU_CAPS_MLOCK
},
{
"boot-opts"
,
"strict"
,
QEMU_CAPS_BOOT_STRICT
},
{
"boot-opts"
,
"reboot-timeout"
,
QEMU_CAPS_REBOOT_TIMEOUT
},
...
...
src/qemu/qemu_capabilities.h
浏览文件 @
6445ad48
...
...
@@ -366,6 +366,7 @@ typedef enum {
QEMU_CAPS_QXL_MAX_OUTPUTS
,
/* -device qxl,max-outputs= */
QEMU_CAPS_QXL_VGA_MAX_OUTPUTS
,
/* -device qxl-vga,max-outputs= */
QEMU_CAPS_SPICE_UNIX
,
/* -spice unix */
QEMU_CAPS_DRIVE_DETECT_ZEROES
,
/* -drive detect-zeroes= */
QEMU_CAPS_LAST
/* this must always be the last item */
}
virQEMUCapsFlags
;
...
...
src/qemu/qemu_command.c
浏览文件 @
6445ad48
...
...
@@ -1391,6 +1391,30 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
}
}
if
(
disk
->
detect_zeroes
)
{
if
(
virQEMUCapsGet
(
qemuCaps
,
QEMU_CAPS_DRIVE_DETECT_ZEROES
))
{
int
detect_zeroes
=
disk
->
detect_zeroes
;
/*
* As a convenience syntax, if discards are ignored and
* zero detection is set to 'unmap', then simply behave
* like zero detection is set to 'on'. But don't change
* it in the XML for easier adjustments. This behaviour
* is documented.
*/
if
(
disk
->
discard
!=
VIR_DOMAIN_DISK_DISCARD_UNMAP
&&
detect_zeroes
==
VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP
)
detect_zeroes
=
VIR_DOMAIN_DISK_DETECT_ZEROES_ON
;
virBufferAsprintf
(
&
opt
,
",detect-zeroes=%s"
,
virDomainDiskDetectZeroesTypeToString
(
detect_zeroes
));
}
else
{
virReportError
(
VIR_ERR_CONFIG_UNSUPPORTED
,
"%s"
,
_
(
"detect_zeroes is not supported by this QEMU binary"
));
goto
error
;
}
}
if
(
virQEMUCapsGet
(
qemuCaps
,
QEMU_CAPS_MONITOR_JSON
))
{
const
char
*
wpolicy
=
NULL
,
*
rpolicy
=
NULL
;
...
...
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
浏览文件 @
6445ad48
...
...
@@ -164,6 +164,7 @@
<flag
name=
'device-tray-moved-event'
/>
<flag
name=
'nec-usb-xhci-ports'
/>
<flag
name=
'name-guest'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2001001
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
浏览文件 @
6445ad48
...
...
@@ -181,6 +181,7 @@
<flag
name=
'qxl.max_outputs'
/>
<flag
name=
'qxl-vga.max_outputs'
/>
<flag
name=
'spice-unix'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2004000
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
浏览文件 @
6445ad48
...
...
@@ -185,6 +185,7 @@
<flag
name=
'qxl.max_outputs'
/>
<flag
name=
'qxl-vga.max_outputs'
/>
<flag
name=
'spice-unix'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2005000
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
浏览文件 @
6445ad48
...
...
@@ -155,6 +155,7 @@
<flag
name=
'nec-usb-xhci-ports'
/>
<flag
name=
'virtio-scsi-pci.iothread'
/>
<flag
name=
'name-guest'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2005094
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
浏览文件 @
6445ad48
...
...
@@ -155,6 +155,7 @@
<flag
name=
'nec-usb-xhci-ports'
/>
<flag
name=
'virtio-scsi-pci.iothread'
/>
<flag
name=
'name-guest'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2005094
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
浏览文件 @
6445ad48
...
...
@@ -149,6 +149,7 @@
<flag
name=
'nec-usb-xhci-ports'
/>
<flag
name=
'virtio-scsi-pci.iothread'
/>
<flag
name=
'name-guest'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2005094
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
浏览文件 @
6445ad48
...
...
@@ -191,6 +191,7 @@
<flag
name=
'qxl.max_outputs'
/>
<flag
name=
'qxl-vga.max_outputs'
/>
<flag
name=
'spice-unix'
/>
<flag
name=
'drive-detect-zeroes'
/>
<version>
2006000
</version>
<kvmVersion>
0
</kvmVersion>
<package></package>
...
...
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-detect-zeroes.args
0 → 100644
浏览文件 @
6445ad48
LC_ALL=C \
PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu \
-name test \
-S \
-M pc-0.13 \
-m 1024 \
-smp 1 \
-uuid 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e \
-nographic \
-nodefaults \
-monitor unix:/tmp/lib/domain--1-test/monitor.sock,server,nowait \
-no-acpi \
-boot dc \
-usb \
-drive file=/var/lib/libvirt/images/f14.img,format=qcow2,if=none,\
id=drive-virtio-disk0,discard=unmap,detect-zeroes=unmap \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
id=virtio-disk0 \
-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,format=raw,if=none,\
media=cdrom,id=drive-ide0-1-0,readonly=on,discard=ignore,detect-zeroes=on \
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-detect-zeroes.xml
浏览文件 @
6445ad48
...
...
@@ -23,7 +23,7 @@
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x04'
function=
'0x0'
/>
</disk>
<disk
type=
'file'
device=
'cdrom'
>
<driver
discard=
'ignore'
detect_zeroes=
'
off
'
/>
<driver
discard=
'ignore'
detect_zeroes=
'
unmap
'
/>
<source
file=
'/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'
/>
<target
dev=
'hdc'
bus=
'ide'
/>
<readonly/>
...
...
tests/qemuxml2argvtest.c
浏览文件 @
6445ad48
...
...
@@ -875,6 +875,9 @@ mymain(void)
QEMU_CAPS_VIRTIO_BLK_SCSI
);
DO_TEST
(
"disk-drive-discard"
,
QEMU_CAPS_DRIVE_DISCARD
);
DO_TEST
(
"disk-drive-detect-zeroes"
,
QEMU_CAPS_DRIVE_DISCARD
,
QEMU_CAPS_DRIVE_DETECT_ZEROES
);
DO_TEST
(
"disk-snapshot"
,
NONE
);
DO_TEST_PARSE_ERROR
(
"disk-same-targets"
,
QEMU_CAPS_SCSI_LSI
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录