Skip to content

Commit b4d409c

Browse files
storage: add logic for discard_no_unref
discard-no-unref support was added in ovirt-engine: oVirt/ovirt-engine@142d791. Update vdsm to recognize and remember this parameter. Signed-off-by: Jasper Berton <jasper.berton@team.blue>
1 parent 8f2b163 commit b4d409c

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

lib/vdsm/virt/vmdevices/storage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Drive(core.Base):
113113
'vm_custom', '_block_info', '_threshold_state', '_lock',
114114
'_monitor_lock', '_monitorable', 'guestName', '_iotune',
115115
'RBD', 'managed', 'scratch_disk', 'exceeded_time',
116-
'extend_time', 'managed_reservation')
116+
'extend_time', 'managed_reservation', 'discard_no_unref')
117117
# pylint: disable=used-before-assignment
118118
VOLWM_CHUNK_SIZE = (
119119
config.getint('irs', 'volume_utilization_chunk_mb') * MiB)
@@ -1125,6 +1125,8 @@ def _getDriverXML(drive):
11251125

11261126
if 'discard' in drive and drive['discard']:
11271127
driverAttrs['discard'] = 'unmap'
1128+
if 'discard_no_unref' in drive and drive['discard_no_unref']:
1129+
driverAttrs['discard_no_unref'] = 'on'
11281130

11291131
try:
11301132
driverAttrs['iothread'] = str(drive['specParams']['pinToIoThread'])

lib/vdsm/virt/vmdevices/storagexml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def _update_serial_params(params, dev):
218218
def _get_driver_params(driver):
219219
params = {
220220
'discard': driver.attrib.get('discard') == 'unmap',
221+
'discard_no_unref': driver.attrib.get("discard_no_unref") == "on",
221222
'format': 'cow' if driver.attrib.get('type') == 'qcow2' else 'raw',
222223
}
223224

tests/virt/device_compat_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def test_drive(self):
9999
'cache': 'none',
100100
'device': 'disk',
101101
'discard': 'False',
102+
'discard_no_unref': 'False',
102103
'diskType': 'block',
103104
'format': 'cow',
104105
'iface': 'scsi',

0 commit comments

Comments
 (0)