Saggi Mizrahi has uploaded a new change for review.
Change subject: [WIP] Move vm logic to it's own module
..
[WIP] Move vm logic to it's own module
Change-Id: Icc54c1d0ab7ad535d825dcd72fd2f4583b690f44
Signed-off-by: Saggi Mizrahi smizr...@redhat.com
---
M vdsm/API.py
M vdsm/Makefile.am
M vdsm/clientIF.py
A vdsm/vmContainer.py
4 files changed, 134 insertions(+), 79 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/7423/1
diff --git a/vdsm/API.py b/vdsm/API.py
index e132fb9..818e00c 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -167,34 +167,36 @@
self.log.error(Error restoring VM parameters,
exc_info=True)
-requiredParams = ['vmId', 'memSize', 'display']
-for param in requiredParams:
+for param in ['vmId', 'memSize', 'display']:
if param not in vmParams:
-self.log.error('Missing required parameter %s' % (param))
-return {'status': {'code': errCode['MissParam']
- ['status']['code'],
- 'message': 'Missing required' + \
- 'parameter %s' % (param)}}
+return {'status': {
+'code': errCode['MissParam']['status']['code'],
+'message': 'Missing required parameter %s' % (param,)}
+}
try:
storage.misc.validateUUID(vmParams['vmId'])
except:
-return {'status': {'code': errCode['MissParam']
- ['status']['code'],
- 'message': 'vmId must be a valid UUID'}}
+return {'status': {
+'code': errCode['MissParam']['status']['code'],
+'message': 'vmId must be a valid UUID'}
+}
if vmParams['memSize'] == 0:
-return {'status': {'code': errCode['MissParam']
- ['status']['code'],
- 'message': 'Must specify nonzero memSize'}}
+return {'status': {
+'code': errCode['MissParam']['status']['code'],
+'message': 'Must specify nonzero memSize'}
+}
if vmParams.get('boot') == 'c' and not 'hda' in vmParams \
and not vmParams.get('drives'):
-return {'status': {'code': errCode['MissParam']
- ['status']['code'],
- 'message': 'missing boot disk'}}
+return {'status': {
+'code': errCode['MissParam']['status']['code'],
+'message': 'missing boot disk'}
+}
if 'vmType' not in vmParams:
vmParams['vmType'] = 'kvm'
-elif vmParams['vmType'] == 'kvm':
+
+if vmParams['vmType'] == 'kvm':
if 'kvmEnable' not in vmParams:
vmParams['kvmEnable'] = 'true'
@@ -205,25 +207,27 @@
vmParams['volatileFloppy'] = True
if caps.osversion()['name'] == caps.OSName.UNKNOWN:
-return {'status': {'code': errCode['createErr']
- ['status']['code'],
- 'message': 'Unknown host operating system'}}
+return {'status': {
+'code': errCode['createErr']['status']['code'],
+'message': 'Unknown host operating system'}
+}
if 'sysprepInf' in vmParams:
if not self._createSysprepFloppyFromInf(vmParams['sysprepInf'],
vmParams['floppy']):
-return {'status': {'code': errCode['createErr']
- ['status']['code'],
- 'message': 'Failed to create '
- 'sysprep floppy image. '
- 'No space on /tmp?'}}
-return errCode['createErr']
+return {'status': {
+'code': errCode['createErr']['status']['code'],
+'message': 'Failed to create sysprep floppy image. '
+ 'No space on /tmp?'}
+}
if vmParams.get('display') not in ('vnc', 'qxl', 'qxlnc', 'local'):
-return {'status': {'code': errCode['createErr']
- ['status']['code'],
-