提交 9049d6a8 编写于 作者: O Osier Yang

qemu: Change values of disk discard

QEMU might support more values for "-drive discard", so using Bi-state
values (on/off) for it doesn't make sense.

"on" maps to "unmap", "off" maps to "ignore":

<...>
@var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and
controls whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
requests are ignored or passed to the filesystem.  Some machine types
may not support discard requests.
</...>
上级 fd74f74f
......@@ -1745,8 +1745,8 @@
The optional <code>discard</code> attribute controls whether
to discard (also known as "trim" or "unmap") requests are
ignored or passed to the filesystem. The value can be either
"on" (allow the discard request to be passed) or "off" (ingore
the discard request).
"unmap" (allow the discard request to be passed) or "ignore"
(ignore the discard request).
<span class='since'>Since 1.0.6 (QEMU and KVM only)</span>
</li>
</ul>
......
......@@ -1418,8 +1418,8 @@
<define name="discard">
<attribute name='discard'>
<choice>
<value>on</value>
<value>off</value>
<value>unmap</value>
<value>ignore</value>
</choice>
</attribute>
</define>
......
......@@ -745,8 +745,8 @@ VIR_ENUM_IMPL(virDomainTPMBackend, VIR_DOMAIN_TPM_TYPE_LAST,
VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST,
"default",
"on",
"off")
"unmap",
"ignore")
#define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE
#define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE
......
......@@ -629,8 +629,8 @@ enum virDomainDeviceSGIO {
enum virDomainDiskDiscard {
VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0,
VIR_DOMAIN_DISK_DISCARD_ON,
VIR_DOMAIN_DISK_DISCARD_OFF,
VIR_DOMAIN_DISK_DISCARD_UNMAP,
VIR_DOMAIN_DISK_DISCARD_IGNORE,
VIR_DOMAIN_DISK_DISCARD_LAST
};
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
/usr/bin/qemu -S -M pc-0.13 -m 1024 -smp 1 -nographic -nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot dc -usb \
-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0,discard=on \
-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0,discard=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,if=none,media=cdrom,id=drive-ide0-1-0,discard=off \
-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,if=none,media=cdrom,id=drive-ide0-1-0,discard=ignore \
-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
......@@ -17,13 +17,13 @@
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' discard='on'/>
<driver name='qemu' type='qcow2' discard='unmap'/>
<source file='/var/lib/libvirt/images/f14.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw' discard='off'/>
<driver name='qemu' type='raw' discard='ignore'/>
<source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册