Martin Polednik has posted comments on this change.
Change subject: virt: devices: move device creation in a submodule ......................................................................
Patch Set 1: Code-Review-1
(3 comments)
Minor questions, great effort.
https://gerrit.ovirt.org/#/c/38077/1/vdsm/virt/vmdevices/hwtree.py File vdsm/virt/vmdevices/hwtree.py:
Line 1: # Line 2: # Copyright 2014 Red Hat, Inc. Something I need to ask for my own patches: don't we want 2015 here? 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 40: (hwclass.RNG, core.Rng), Line 41: (hwclass.SMARTCARD, core.Smartcard), Line 42: (hwclass.TPM, core.Tpm)) Line 43: Line 44: I'm not sure about the name here, wouldn't something like init be nicer? hwtree.init actually tells me, that the tree is ready for use while hwtree.empty isn't something I'd understand. Line 45: def empty(): Line 46: return dict((dev, []) for dev, _ in _DEVICE_MAPPING) Line 47: Line 48:
Line 48: Line 49: def build(dev_conf, vm_conf, log): Line 50: devices = empty() Line 51: Line 52: for devType, devClass in _DEVICE_MAPPING: Since this is new module, I'd go with dev_type and dev_class (possibly future patch). Line 53: for dev in dev_conf[devType]: Line 54: devices[devType].append(devClass(vm_conf, log, **dev)) Line 55: