Try using VDSM hooks 
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.4/html/administration_guide/vdsm_hooks_environment
I am using vdsm-hook-diskunmap as model.
dnf install vdsm-hook-diskunmap
cp /usr/libexec/vdsm/hooks/before_vm_start/50_diskunmap 
/usr/libexec/vdsm/hooks/before_vm_start/99_max_sectors
After editing the file, the result is bellow
 
# on host
egrep -v \^$ /usr/libexec/vdsm/hooks/before_vm_start/99_max_sectors
#!/usr/bin/python3
from __future__ import absolute_import
from __future__ import print_function
'''
Hook to set max_sectors on SCSI controller, virtio-scsi model
Syntax:
   max_sectors=(256|128|64)
Example:
   max_sectors=256
'''
import os
import sys
import traceback
from xml.dom import minidom
import hooking
def addmax_sectors(domxml):
    max_sectorsConfig = os.environ['max_sectors']
    for controller in domxml.getElementsByTagName('controller'):
        model = controller.getAttribute('model')
        if (model == 'virtio-scsi'):
            driver = controller.getElementsByTagName('driver')[0]
            driver.setAttribute('max_sectors', max_sectorsConfig)
def main():
    if 'max_sectors' in os.environ:
        max_sectorsConfig = os.environ['max_sectors']
        domxml = hooking.read_domxml()
        if (max_sectorsConfig == '256' or max_sectorsConfig == '128' or 
max_sectorsConfig == '64'):
            addmax_sectors(domxml)
            hooking.write_domxml(domxml)
def test():
    text = '''<controller type='scsi' index='0' model='virtio-scsi'>
<driver queues='2' iothread='1'/>
<alias name='ua-c410327a-e4af-482a-966b-12cff96fea06'/>
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
</controller>'''
    xmldom = minidom.parseString(text)
    controller = xmldom.getElementsByTagName('controller')[0]
    print("\nController device definition before execution: \n%s"
          % controller.toxml(encoding='UTF-8'))
    addmax_sectors(xmldom)
    print("\nController device after setting max_sectors attribute: \n%s"
          % controller.toxml(encoding='UTF-8'))
if __name__ == '__main__':
    try:
        if '--test' in sys.argv:
            test()
        else:
            main()
    except:
        hooking.exit_hook(' max_sectors hook: [unexpected error]: %s\n' %
                          traceback.format_exc())
 
# on oVirt hosted engine
# list current VM custom properties
engine-config -l
# add VM custom properties
engine-config -s UserDefinedVMProperties='max_sectors=^(256|128|64)$' --cver=4.6
# check VM custom properties
engine-config -g UserDefinedVMProperties
 
systemctl restart ovirt-engine.service
 
For me it's working with
max_sectors 256
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/STURUVA533A3FPJKVD5DAWADATZTM6U5/

Reply via email to