VirtualDisk: Drop cache and io from __init__

They are barely used and can be specified separately.
This commit is contained in:
Cole Robinson 2013-07-10 20:46:56 -04:00
parent 57d4fcab33
commit f1b55090d2
3 changed files with 14 additions and 16 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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,