From 89c389e45afe11719b8fa06f749a9908953281cd Mon Sep 17 00:00:00 2001 From: Anya Harter Date: Thu, 7 Jun 2018 10:45:46 -0400 Subject: [PATCH] cli: Add --disk driver.copy_on_read=on option This maps to disk XML like: Signed-off-by: Anya Harter --- 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 @@ + 1 5 diff --git a/tests/clitest.py b/tests/clitest.py index ee13b037..466e96f5 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..679ac51d 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")