[PATCH] qemu: Change values of disk discard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
</...>
---
 docs/formatdomain.html.in                                   | 4 ++--
 docs/schemas/domaincommon.rng                               | 4 ++--
 src/conf/domain_conf.c                                      | 4 ++--
 src/conf/domain_conf.h                                      | 4 ++--
 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.args | 4 ++--
 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml  | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a71c484..26a3d0d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -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"
+            (gnore the discard request).
             <span class='since'>Since 1.0.6 (QEMU and KVM only)</span>
           </li>
         </ul>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 018ca0b..b53099b 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -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>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b5e5d4d..e7a0381 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a10b2ab..e74da1c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -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
 };
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.args
index 02e2ddb..3c4687e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.args
@@ -1,8 +1,8 @@
 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
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml
index a6a8135..f01312f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml
@@ -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/>
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]