Change in vdsm[master]: api: introducing short parameter for getVMList verb
piotr.kliczewski at gmail.com
piotr.kliczewski at gmail.com
Fri Mar 6 12:57:41 UTC 2015
Piotr Kliczewski has posted comments on this change.
Change subject: api: introducing short parameter for getVMList verb
......................................................................
Patch Set 2:
(10 comments)
https://gerrit.ovirt.org/#/c/38449/2//COMMIT_MSG
Commit Message:
Line 9: Due to vdsm sending only an array of vmids in a response to getVMList
Line 10: the engine asks separately using VM.getStats which creates unnecessery
Line 11: load. In order to fix this issue we introduce new parameter 'short'
Line 12: which is set to True by default. Older engines still want to get an
Line 13: array of vmids. For xmlrpc and newer engines which provides 'short' set
> Please use a less ambiguous wording:
Done
Line 14: as False map of vmids and statuses is returned.
Line 15:
Line 16:
Line 17: Change-Id: I2d9eb359f6995c09d61a3159e733498fa3b55780
https://gerrit.ovirt.org/#/c/38449/2/vdsm/API.py
File vdsm/API.py:
Line 1378:
Line 1379: return dict(status=doneCode)
Line 1380:
Line 1381: # VM-related functions
Line 1382: def getVMList(self, fullStatus=False, vmList=(), short=True):
> You may consider this tedious, but I wish to reconsider the name. "short" i
Done
Line 1383: """ return a list of known VMs with full (or partial) config each """
Line 1384: # To improve complexity, convert 'vms' to set(vms)
Line 1385: vmSet = set(vmList)
Line 1386: ret = {'status': doneCode,
Line 1382: def getVMList(self, fullStatus=False, vmList=(), short=True):
Line 1383: """ return a list of known VMs with full (or partial) config each """
Line 1384: # To improve complexity, convert 'vms' to set(vms)
Line 1385: vmSet = set(vmList)
Line 1386: ret = {'status': doneCode,
> the code would be slightly nicer with another temp var:
Done
Line 1387: 'vmList': [v.status(fullStatus)
Line 1388: for v in self._cif.vmContainer.values()
Line 1389: if not vmSet or v.id in vmSet]}
Line 1390: if short:
Line 1386: ret = {'status': doneCode,
Line 1387: 'vmList': [v.status(fullStatus)
Line 1388: for v in self._cif.vmContainer.values()
Line 1389: if not vmSet or v.id in vmSet]}
Line 1390: if short:
> Please add a
Done
Line 1391: return {'status': doneCode,
Line 1392: 'vmList': [v['vmId'] for v in ret['vmList']]}
Line 1393: return ret
Line 1394:
Line 1386: ret = {'status': doneCode,
Line 1387: 'vmList': [v.status(fullStatus)
Line 1388: for v in self._cif.vmContainer.values()
Line 1389: if not vmSet or v.id in vmSet]}
Line 1390: if short:
> # REQUIRED_FOR: engine-3.5.0 only
Done
Line 1391: return {'status': doneCode,
Line 1392: 'vmList': [v['vmId'] for v in ret['vmList']]}
Line 1393: return ret
Line 1394:
Line 1388: for v in self._cif.vmContainer.values()
Line 1389: if not vmSet or v.id in vmSet]}
Line 1390: if short:
Line 1391: return {'status': doneCode,
Line 1392: 'vmList': [v['vmId'] for v in ret['vmList']]}
> I believe I see why you do that here and why you do it this way - we are e
Done
Line 1393: return ret
Line 1394:
Line 1395: def getExternalVMs(self, uri, username, password):
Line 1396: """
https://gerrit.ovirt.org/#/c/38449/2/vdsm/rpc/vdsmapi-schema.json
File vdsm/rpc/vdsmapi-schema.json:
Line 3605: # @fullStatus: #optional When set to False return limited info
Line 3606: #
Line 3607: # @vmList: #optional Filter the results by a list of UUIDs
Line 3608: #
Line 3609: # @short: #optional determines whether we need short of full status
> It would be more noble to define VmInfo as
Done
Line 3610: #
Line 3611: # Returns:
Line 3612: # A list of VmInfos
Line 3613: #
Line 3605: # @fullStatus: #optional When set to False return limited info
Line 3606: #
Line 3607: # @vmList: #optional Filter the results by a list of UUIDs
Line 3608: #
Line 3609: # @short: #optional determines whether we need short of full status
> this documentation could be improved, because we need to reduce the future
Done
Line 3610: #
Line 3611: # Returns:
Line 3612: # A list of VmInfos
Line 3613: #
Line 3605: # @fullStatus: #optional When set to False return limited info
Line 3606: #
Line 3607: # @vmList: #optional Filter the results by a list of UUIDs
Line 3608: #
Line 3609: # @short: #optional determines whether we need short of full status
> +1 Dan's suggestion here also address my comment below
Done
Line 3610: #
Line 3611: # Returns:
Line 3612: # A list of VmInfos
Line 3613: #
Line 3614: # Since: 4.10.0
Line 3615: ##
Line 3616: {'command': {'class': 'Host', 'name': 'getVMList'},
Line 3617: 'data': {'*fullStatus': 'bool','*vmList': ['UUID'], '*short': 'bool'},
Line 3618: 'returns': ['VmInfo']}
> please note that this is now a lie, because if
Done
Line 3619:
Line 3620: ##
Line 3621: # @GuestDiskMappingInfo:
Line 3622: #
--
To view, visit https://gerrit.ovirt.org/38449
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2d9eb359f6995c09d61a3159e733498fa3b55780
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan at redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list