Skip to content

Commit e75a08a

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 e75a08a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-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:
1129+
driverAttrs['discard_no_unref'] = drive['discard_no_unref']
11281130

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

lib/vdsm/virt/vmdevices/storagexml.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ def _get_driver_params(driver):
221221
'format': 'cow' if driver.attrib.get('type') == 'qcow2' else 'raw',
222222
}
223223

224+
discard_no_unref = driver.attrib.get('discard_no_unref', None)
225+
if discard_no_unref:
226+
params['discard_no_unref'] = discard_no_unref
227+
224228
error_policy = driver.attrib.get('error_policy', 'stop')
225229
if error_policy == 'report':
226230
params['propagateErrors'] = 'report'

0 commit comments

Comments
 (0)