Change in vdsm[master]: api: introducing short parameter for getVMList verb

danken at redhat.com danken at redhat.com
Fri Mar 6 12:27:15 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: api: introducing short parameter for getVMList verb
......................................................................


Patch Set 2: Code-Review-1

(5 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:

 For xmlrpc, and for newer engines which provides ...

current text made me think "but xmlrpc does not send 'short'!".
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" is very generic, and does suggest to the reader what's the expected behaviour. "short" is also easily confused with VmShortStatus.

How about having onlyUUID=False as default?
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:

 vmlist = [v.status(fullStatus) ... ]
 if onlyUUID:
    vmlist = [v['vmId'] for v in vmlist]
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 

 # REQUIRED_FOR: engine-3.5.0

so future developers would know when this is not longer needed.
Line 1391:             return {'status': doneCode,
Line 1392:                     'vmList': [v['vmId'] for v in ret['vmList']]}
Line 1393:         return ret
Line 1394: 


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
> this documentation could be improved, because we need to reduce the future 
It would be more noble to define VmInfo as

  'union': ['VmDefinition', 'UUID', 'VmShortStatus']}

And mention that UUID is sad legacy for engine-3.5.0.
Line 3610: #
Line 3611: # Returns:
Line 3612: # A list of VmInfos
Line 3613: #


-- 
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 <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