From f1b55090d278763ad20df9c9e7879fd0827e483d Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 10 Jul 2013 20:46:56 -0400 Subject: [PATCH] VirtualDisk: Drop cache and io from __init__ They are barely used and can be specified separately. --- tests/xmlconfig.py | 19 +++++++++++-------- virtManager/addhardware.py | 2 +- virtinst/VirtualDisk.py | 9 ++------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py index 92a007ae2..c0b2c96c6 100644 --- a/tests/xmlconfig.py +++ b/tests/xmlconfig.py @@ -552,14 +552,17 @@ class TestXMLConfig(unittest.TestCase): bus="scsi")) g.add_device(VirtualDisk(g.conn, path=None, device=VirtualDisk.DEVICE_FLOPPY)) - g.add_device(VirtualDisk(g.conn, path="/dev/loop0", - device=VirtualDisk.DEVICE_FLOPPY, - driverName="phy", driverCache="none")) - disk = VirtualDisk(g.conn, path="/dev/loop0", - bus="virtio", driverName="qemu", - driverType="qcow2", driverCache="none") - disk.driver_io = "threads" - g.add_device(disk) + d1 = VirtualDisk(g.conn, path="/dev/loop0", + device=VirtualDisk.DEVICE_FLOPPY, + driverName="phy") + d1.driver_cache = "none" + g.add_device(d1) + d2 = VirtualDisk(g.conn, path="/dev/loop0", + bus="virtio", driverName="qemu", + driverType="qcow2") + d2.driver_cache = "none" + d2.driver_io = "threads" + g.add_device(d2) self._compare(g, "boot-many-disks2", False) diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index dd7b022ef..9287e16c4 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -1311,8 +1311,8 @@ class vmmAddHardware(vmmGObjectUI): readOnly=readonly, device=device, bus=bus, - driverCache=cache, format=fmt) + disk.driver_cache = cache if not fmt: fmt = self.config.get_storage_format() diff --git a/virtinst/VirtualDisk.py b/virtinst/VirtualDisk.py index e4abd5cdf..0a261d4a2 100644 --- a/virtinst/VirtualDisk.py +++ b/virtinst/VirtualDisk.py @@ -516,9 +516,8 @@ class VirtualDisk(VirtualDevice): device=None, driverName=None, driverType=None, readOnly=False, sparse=True, volObject=None, volInstall=None, bus=None, shareable=False, - driverCache=None, format=None, - validate=True, parsexml=None, parsexmlnode=None, - driverIO=None, sizebytes=None, nomanaged=False): + format=None, validate=True, parsexml=None, parsexmlnode=None, + sizebytes=None, nomanaged=False): """ @param path: filesystem path to the disk image. @type path: C{str} @@ -548,8 +547,6 @@ class VirtualDisk(VirtualDevice): @type bus: C{str} @param shareable: If disk can be shared among VMs @type shareable: C{bool} - @param driverCache: Disk cache mode (none, writethrough, writeback) - @type driverCache: member of cache_types @param format: Storage volume format to use when creating storage @type format: C{str} @param validate: Whether to validate passed parameters against the @@ -612,9 +609,7 @@ class VirtualDisk(VirtualDevice): self._set_vol_install(volInstall, validate=False) self._set_bus(bus, validate=False) self._set_shareable(shareable, validate=False) - self._set_driver_cache(driverCache, validate=False) self._set_format(format, validate=False) - self._set_driver_io(driverIO, validate=False) self.__change_storage(self.path, self.vol_object,