Change in vdsm[master]: vdsm: introduce hostdev module

fromani at redhat.com fromani at redhat.com
Tue Sep 2 16:04:21 UTC 2014


Francesco Romani has posted comments on this change.

Change subject: vdsm: introduce hostdev module
......................................................................


Patch Set 4:

(4 comments)

http://gerrit.ovirt.org/#/c/32313/4/vdsm/hostdev.py
File vdsm/hostdev.py:

Line 1: #
Line 2: # Copyright 2014 Red Hat, Inc.
since this is new code, we want to be (finally!) pep8 friendly: 

http://webcache.googleusercontent.com/search?q=cache:N35llBwzhFcJ:https://www.ovirt.org/Vdsm_Coding_Guidelines+&cd=1&hl=it&ct=clnk&gl=it

(linking google cache only because ovirt wiki seems down at the moment :( )
Line 3: #
Line 4: # This program is free software; you can redistribute it and/or modify
Line 5: # it under the terms of the GNU General Public License as published by
Line 6: # the Free Software Foundation; either version 2 of the License, or


Line 18: # Refer to the README and COPYING files for full details of the license
Line 19: #
Line 20: 
Line 21: import logging
Line 22: import xml.etree.ElementTree as etree
Good move. I'm all to use etree for new code.
Line 23: 
Line 24: from vdsm import libvirtconnection
Line 25: 
Line 26: 


Line 59:     hostDevices = [(dev.name(), dev) for dev
Line 60:                    in libvirtconnection.get().listAllDevices(0)]
Line 61: 
Line 62:     for (device_name, device) in hostDevices:
Line 63:         devices[device_name] = [device, '']
a namedtuple would probably help readability here (also looking at line 71)
Line 64: 
Line 65:     # loop through VMs and find their host devices
Line 66:     for vmId, params in vmContainer.items():
Line 67:         try:


Line 62:     for (device_name, device) in hostDevices:
Line 63:         devices[device_name] = [device, '']
Line 64: 
Line 65:     # loop through VMs and find their host devices
Line 66:     for vmId, params in vmContainer.items():
do we need vmContainerLock here?
Line 67:         try:
Line 68:             for device in params.conf['devices']:
Line 69:                 if device['device'] == 'hostdev':
Line 70:                     try:


-- 
To view, visit http://gerrit.ovirt.org/32313
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2bba96db5be180d00cb74fb89b10c5b09e5bd180
Gerrit-PatchSet: 4
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: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list