[virt-tools-list] [PATCH virt-manager] cli: Add --disk driver.copy_on_read=on option

Anya Harter aharter at redhat.com
Thu Jun 7 14:45:46 UTC 2018


This maps to disk XML like:

    <disk>
      <driver copy_on_read='on'/>
    </disk>

Signed-off-by: Anya Harter <aharter at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-many-devices.xml | 1 +
 tests/clitest.py                                         | 2 +-
 virtinst/cli.py                                          | 1 +
 virtinst/devices/disk.py                                 | 2 ++
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index 8ffb6948..0028bc08 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -42,6 +42,7 @@
     </disk>
     <disk type="file" device="cdrom">
       <target dev="sda" bus="sata"/>
+      <driver copy_on_read="on"/>
       <iotune>
         <read_bytes_sec>1</read_bytes_sec>
         <write_bytes_sec>5</write_bytes_sec>
diff --git a/tests/clitest.py b/tests/clitest.py
index b5777e9c..909d5e7d 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -462,7 +462,7 @@ c.add_compare(""" \
 \
 --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,discard=unmap,detect_zeroes=yes \
---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 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,driver.copy_on_read=on \
 --disk size=1 \
 --disk %(BLOCKVOL)s \
 --disk /dev/default-pool/iso-vol,seclabel.model=dac,seclabel1.model=selinux,seclabel1.relabel=no,seclabel0.label=foo,bar,baz \
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 84e93b5a..28e414da 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2117,6 +2117,7 @@ ParserDisk.add_arg("driver_discard", "discard")
 ParserDisk.add_arg("driver_detect_zeroes", "detect_zeroes")
 ParserDisk.add_arg("driver_name", "driver_name")
 ParserDisk.add_arg("driver_type", "driver_type")
+ParserDisk.add_arg("driver_copy_on_read","driver.copy_on_read", is_onoff=True)
 ParserDisk.add_arg("driver_io", "io")
 ParserDisk.add_arg("error_policy", "error_policy")
 ParserDisk.add_arg("serial", "serial")
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index 9fec6606..f69e8739 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -745,6 +745,8 @@ class DeviceDisk(Device):
     driver_type = XMLProperty("./driver/@type",
                               default_cb=_get_default_driver_type)
 
+    driver_copy_on_read = XMLProperty("./driver/@copy_on_read", is_onoff=True)
+
     sgio = XMLProperty("./@sgio")
 
     bus = XMLProperty("./target/@bus")
-- 
2.17.1




More information about the virt-tools-list mailing list