Change in vdsm[master]: hostdev: add tests for guest addressing

fromani at redhat.com fromani at redhat.com
Wed Jul 1 11:14:00 UTC 2015


Francesco Romani has posted comments on this change.

Change subject: hostdev: add tests for guest addressing
......................................................................


Patch Set 1:

(1 comment)

fine with the concept, not sure about the current implementation. Suggestions/discussion inside, -1 only for visibility.

https://gerrit.ovirt.org/#/c/43093/1/tests/hostdevTests.py
File tests/hostdevTests.py:

Line 46:             <source>
Line 47:                     <address bus="0" domain="0" function="0" slot="2"
Line 48:                     type="pci"/>
Line 49:             </source>
Line 50:             %s
I don't really like this brutal string substitution.
It works, but we can try something better
A first improvement could be use new format string and pass the address dict:

  <hostdev managed="no" mode="subsystem" type="pci">
            <source>
                    <address bus="0" domain="0" function="0" slot="2"
                    type="pci"/>
            </source>
            <address bus="{bus}" domain="{domain}" function="{function}" slot="{slot}" \
             type="pci"/>
  </hostdev>

(please check the specifier to have integers in hex)

later

        dev_spec = {'type': 'hostdev', 'device': device_name, 'address':
                    {'slot': '0x02', 'bus': '0x01', 'domain': '0x0000',
                     'function': '0x0', 'type': 'pci'}}
        device = hostdevice.HostDevice(self.conf, self.log, **dev_spec)
        self.assertXMLEqual(
            device.getXML().toxml(),
            _DEVICE_XML[device_name].format(**dev_spec['address'])
)

sounds a bit safer and easier to change this way. What you think?
Line 51:     </hostdev>
Line 52:     ''',
Line 53:     'pci_0000_00_19_0':
Line 54:     '''


-- 
To view, visit https://gerrit.ovirt.org/43093
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7bd20e1a2cb9846b5dc6d35315a89855b63a6ff4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <mskrivan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list