Bug 1091516 - RFE: enable underlying QEMU discard support in virt-install
Summary: RFE: enable underlying QEMU discard support in virt-install
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: virt-manager
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Cole Robinson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-25 19:21 UTC by Jim Minter
Modified: 2014-04-29 14:38 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-04-29 14:38:48 UTC
Embargoed:


Attachments (Terms of Use)
example patch to implement requested functionality (2.93 KB, patch)
2014-04-27 07:12 UTC, Jim Minter
no flags Details | Diff

Description Jim Minter 2014-04-25 19:21:00 UTC
It'd be handy if virt-install made it easy to enable QEMU's underlying discard capability (-drive discard=unmap).  The rationale for this is that at the end of installation of a VM, the kickstart script could then call fstrim, which would then minimise the size of the resulting VM image on disk.

Comment 1 Jim Minter 2014-04-27 07:12:54 UTC
Created attachment 890154 [details]
example patch to implement requested functionality

Comment 2 Cole Robinson 2014-04-29 14:38:48 UTC
Thanks for the patch Jim!

@@ -830,6 +835,8 @@ class VirtualDisk(VirtualDevice):
         # be nice if qemu did this for us but that time has long passed.
         if not self.driver_cache:
             self.driver_cache = self.CACHE_MODE_NONE
+        if not self.driver_discard:
+            self.driver_discard = self.DRIVER_MODE_IGNORE
         if not self.driver_io:
             self.driver_io = self.IO_MODE_NATIVE

This bit is unnecessary, we should just differ to the qemu default here (which is ignore AFAIK).

I dropped that bit and added some test cases, and push the patch:

commit 764063dfe92111d93a0bbd17cf3d1f26312c01c9
Author: Jim Minter <jminter>
Date:   Tue Apr 29 10:29:33 2014 -0400

    virt-install --disk discard= support


Note You need to log in before you can comment on or make changes to this bug.