Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Drop single use inheritance
......................................................................
Drop single use inheritance
There is only one class inheriting from Device, VmDevice. Device
has no instances, so it is better to drop it altogether in favor
or VmDevice, which is inherited from a sizeable amount of times.
Change-Id: If781ab20110874e71ba16b60d1d5511a54914979
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 16 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/18351/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 4f80b4c..9a24822 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -90,24 +90,6 @@
diskDeviceXmlElements)
-class Device(object):
- def __init__(self, conf, log, **kwargs):
- for attr, value in kwargs.iteritems():
- try:
- setattr(self, attr, value)
- except AttributeError:
- # skip read-only properties
- pass
- self.conf = conf
- self.log = log
- self._deviceXML = None
-
- def __str__(self):
- attrs = [":".join((a, str(getattr(self, a)))) for a in dir(self)
- if not a.startswith('__')]
- return " ".join(attrs)
-
-
class _MigrationError(RuntimeError):
pass
@@ -1149,7 +1131,22 @@
return self.doc.toprettyxml(encoding='utf-8')
-class VmDevice(Device):
+class VmDevice(object):
+ def __init__(self, conf, log, **kwargs):
+ for attr, value in kwargs.iteritems():
+ try:
+ setattr(self, attr, value)
+ except AttributeError: # skip read-only properties
+ pass
+ self.conf = conf
+ self.log = log
+ self._deviceXML = None
+
+ def __str__(self):
+ attrs = [':'.join((a, str(getattr(self, a)))) for a in dir(self)
+ if not a.startswith('__')]
+ return ' '.join(attrs)
+
def createXmlElem(self, elemType, deviceType, attributes=[]):
"""
Create domxml device element according to passed in params
--
To view, visit
http://gerrit.ovirt.org/18351
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If781ab20110874e71ba16b60d1d5511a54914979
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>