Change in vdsm[master]: WIP - do not merge
fromani at redhat.com
fromani at redhat.com
Tue Oct 6 16:15:15 UTC 2015
Francesco Romani has uploaded a new change for review.
Change subject: WIP - do not merge
......................................................................
WIP - do not merge
Change-Id: Iaa24d62663f1a7512995fd10b31c26b4956c5ef1
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/API.py
1 file changed, 28 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/46982/1
diff --git a/vdsm/API.py b/vdsm/API.py
index e3b9241..7a11edc 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -572,24 +572,37 @@
self.log.debug('Migration create')
params['vmId'] = self._UUID
- result = self.create(params)
- if result['status']['code']:
- self.log.debug('Migration create - Failed')
- return result
- v = self._cif.vmContainer.get(self._UUID)
+ def _migration_create_vm(params):
+ result = self.create(params)
+ if response.is_error(result):
+ self.log.debug('Destination VM creation failed')
+ return result
+
+ v = self._cif.vmContainer.get(self._UUID)
+ try:
+ if not v.waitForMigrationDestinationPrepare():
+ return response.error('createErr')
+ except hooks.HookError as e:
+ self.log.debug('Destination VM creation failed due to hook' +
+ ' error:' + str(e))
+ return response.error('hookError',
+ 'Destination hook failed: ' + str(e))
+ else:
+ self.log.debug('Destination VM creation succeeded')
+ return response.success(migrationPort=0,
+ params=result['vmList'])
+
+ accepted_mig = migration.incomingMigrations.acquire(block=False)
+ if not accepted_mig:
+ return response.error('migrationLimit')
try:
- if not v.waitForMigrationDestinationPrepare():
- return errCode['createErr']
- except hooks.HookError as e:
- self.log.debug('Destination VM creation failed due to hook' +
- ' error:' + str(e))
- return response.error('hookError', 'Destination hook failed: ' +
- str(e))
- self.log.debug('Destination VM creation succeeded')
- return {'status': doneCode, 'migrationPort': 0,
- 'params': result['vmList']}
+ return _migration_create_vm(params)
+ except Exception:
+ accepted_mig.release()
+ raise
+ # on success we need to hold the sempahore until VM is ready
def monitorCommand(self, command):
"""
--
To view, visit https://gerrit.ovirt.org/46982
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa24d62663f1a7512995fd10b31c26b4956c5ef1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
More information about the vdsm-patches
mailing list