virt-install --disk discard= support
(crobinso: Remove default overriding, add test cases)
This commit is contained in:
parent
02f49be9e2
commit
764063dfe9
|
@ -573,6 +573,13 @@ The cache value can be 'none', 'writethrough', or 'writeback'.
|
|||
'writethrough' provides read caching. 'writeback' provides
|
||||
read and write caching.
|
||||
|
||||
=item B<discard>
|
||||
|
||||
Whether discard (also known as "trim" or "unmap") requests are ignored
|
||||
or passed to the filesystem. The value can be either "unmap" (allow
|
||||
the discard request to be passed) or "ignore" (ignore the discard
|
||||
request). Since 1.0.6 (QEMU and KVM only)
|
||||
|
||||
=item B<format>
|
||||
|
||||
Disk image format. For file volumes, this can be 'raw', 'qcow2', 'vmdk', etc. See format types in L<http://libvirt.org/storage.html> for possible values. This is often mapped to the B<driver_type> value as well.
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<boot order="2"/>
|
||||
</disk>
|
||||
<disk type="file" device="disk">
|
||||
<driver error_policy="enospace"/>
|
||||
<driver discard="unmap" error_policy="enospace"/>
|
||||
<source file="/dev/default-pool/new1.img"/>
|
||||
<target dev="hdb" bus="ide"/>
|
||||
<readonly/>
|
||||
|
@ -196,7 +196,7 @@
|
|||
<boot order="2"/>
|
||||
</disk>
|
||||
<disk type="file" device="disk">
|
||||
<driver error_policy="enospace"/>
|
||||
<driver discard="unmap" error_policy="enospace"/>
|
||||
<source file="/dev/default-pool/new1.img"/>
|
||||
<target dev="hdb" bus="ide"/>
|
||||
<readonly/>
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
- <disk type="block" device="floppy">
|
||||
- <source dev="/dev/null"/>
|
||||
+ <disk device="floppy">
|
||||
+ <source file="/foo/bar"/>
|
||||
<target dev="fda" bus="fdc"/>
|
||||
- <boot order="5"/>
|
||||
- <address type="drive" controller="0" bus="0" target="0" unit="0"/>
|
||||
+ <source file="/foo/bar"/>
|
||||
</disk>
|
||||
<disk type="dir" device="floppy">
|
||||
<source dir="/tmp"/>
|
||||
|
|
|
@ -554,7 +554,7 @@ c.add_compare("""--hvm --pxe \
|
|||
--controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 \
|
||||
--controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 \
|
||||
--disk %(EXISTUPPER)s,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149,boot_order=2 \
|
||||
--disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace \
|
||||
--disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace,discard=unmap \
|
||||
--disk device=cdrom,bus=sata,read_bytes_sec=1,read_iops_sec=2,total_bytes_sec=10,total_iops_sec=20,write_bytes_sec=5,write_iops_sec=6 \
|
||||
--disk size=1 \
|
||||
--serial tcp,host=:2222,mode=bind,protocol=telnet \
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<total_iops_sec>5</total_iops_sec>
|
||||
<total_bytes_sec>6</total_bytes_sec>
|
||||
</iotune>
|
||||
<driver cache="writeback" io="native"/>
|
||||
<driver cache="writeback" discard="unmap" io="native"/>
|
||||
<source file="/dev/default-pool/default-vol" startupPolicy="optional"/>
|
||||
<shareable/>
|
||||
</disk>
|
||||
|
|
|
@ -331,6 +331,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
check("driver_cache", None, "writeback")
|
||||
check("driver_io", None, "threads")
|
||||
check("driver_io", "threads", "native")
|
||||
check("driver_discard", None, "unmap")
|
||||
check("iotune_ris", 1, 0)
|
||||
check("iotune_rbs", 2, 0)
|
||||
check("iotune_wis", 3, 0)
|
||||
|
|
|
@ -1638,6 +1638,7 @@ class ParserDisk(VirtCLIParser):
|
|||
self.set_param("bus", "bus")
|
||||
self.set_param("removable", "removable", is_onoff=True)
|
||||
self.set_param("driver_cache", "cache")
|
||||
self.set_param("driver_discard", "discard")
|
||||
self.set_param("driver_name", "driver_name")
|
||||
self.set_param("driver_type", "driver_type")
|
||||
self.set_param("driver_io", "io")
|
||||
|
|
|
@ -169,6 +169,10 @@ class VirtualDisk(VirtualDevice):
|
|||
cache_types = [CACHE_MODE_NONE, CACHE_MODE_WRITETHROUGH,
|
||||
CACHE_MODE_WRITEBACK, CACHE_MODE_DIRECTSYNC, CACHE_MODE_UNSAFE]
|
||||
|
||||
DISCARD_MODE_IGNORE = "ignore"
|
||||
DISCARD_MODE_UNMAP = "unmap"
|
||||
discard_types = [DISCARD_MODE_IGNORE, DISCARD_MODE_UNMAP]
|
||||
|
||||
DEVICE_DISK = "disk"
|
||||
DEVICE_LUN = "lun"
|
||||
DEVICE_CDROM = "cdrom"
|
||||
|
@ -494,7 +498,7 @@ class VirtualDisk(VirtualDevice):
|
|||
_XML_PROP_ORDER = [
|
||||
"type", "device",
|
||||
"driver_name", "driver_type",
|
||||
"driver_cache", "driver_io", "error_policy",
|
||||
"driver_cache", "driver_discard", "driver_io", "error_policy",
|
||||
"_xmlpath", "target", "bus",
|
||||
]
|
||||
|
||||
|
@ -607,6 +611,7 @@ class VirtualDisk(VirtualDevice):
|
|||
read_only = XMLProperty("./readonly", is_bool=True)
|
||||
shareable = XMLProperty("./shareable", is_bool=True)
|
||||
driver_cache = XMLProperty("./driver/@cache")
|
||||
driver_discard = XMLProperty("./driver/@discard")
|
||||
driver_io = XMLProperty("./driver/@io")
|
||||
|
||||
error_policy = XMLProperty("./driver/@error_policy")
|
||||
|
|
Loading…
Reference in New Issue