Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Merge _base_init and __init__
......................................................................
vdsm: Merge _base_init and __init__
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Change-Id: Ic4426942852c8c2c0c950f744e6bae5bfe3aaa2f
---
M vdsm/vm/vm.py
1 file changed, 17 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/11746/1
diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 388d8bc..0d053ff 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -108,7 +108,7 @@
_ongoingCreations = threading.BoundedSemaphore(4)
MigrationSourceThreadClass = MigrationSourceThread
- def _base_init(self, cif, params):
+ def __init__(self, cif, params):
"""
Initialize a new VM instance.
@@ -117,6 +117,7 @@
:param params: The VM parameters.
:type params: dict
"""
+ self._dom = None
self.conf = {'pid': '0'}
self.conf.update(params)
self.id = self.conf['vmId']
@@ -156,6 +157,21 @@
self._vmCreationEvent = threading.Event()
self._pathsPreparedEvent = threading.Event()
self._devices = initDeviceMap()
+
+ self._connection = libvirtconnection.get(cif)
+ if 'vmName' not in self.conf:
+ self.conf['vmName'] = 'n%s' % self.id
+ self._guestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
+ self.conf['vmName'].encode('utf-8') +
+ '.' + _VMCHANNEL_DEVICE_NAME)
+ self._qemuguestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
+ self.conf['vmName'].encode('utf-8')
+
+ '.' + _QEMU_GA_DEVICE_NAME)
+ self._lastXMLDesc =
'<domain><uuid>%s</uuid></domain>' % self.id
+ self._devXmlHash = '0'
+ self._released = False
+ self._releaseLock = threading.Lock()
+ self.saveState()
def _get_lastStatus(self):
PAUSED_STATES = ('Powering down', 'RebootInProgress',
'Up')
@@ -841,25 +857,6 @@
raise
finally:
self._guestCpuLock.release()
-
- def __init__(self, cif, params):
- self._dom = None
- self._base_init(self, cif, params)
-
- self._connection = libvirtconnection.get(cif)
- if 'vmName' not in self.conf:
- self.conf['vmName'] = 'n%s' % self.id
- self._guestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
- self.conf['vmName'].encode('utf-8') +
- '.' + _VMCHANNEL_DEVICE_NAME)
- self._qemuguestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
- self.conf['vmName'].encode('utf-8')
+
- '.' + _QEMU_GA_DEVICE_NAME)
- self._lastXMLDesc =
'<domain><uuid>%s</uuid></domain>' % self.id
- self._devXmlHash = '0'
- self._released = False
- self._releaseLock = threading.Lock()
- self.saveState()
def _buildLease(self, domainID, volumeID, leasePath, leaseOffset):
"""
--
To view, visit
http://gerrit.ovirt.org/11746
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4426942852c8c2c0c950f744e6bae5bfe3aaa2f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>