Martin Betak has posted comments on this change.
Change subject: vdsm: Reboot capability for VM
......................................................................
Patch Set 5: (3 inline comments)
....................................................
File vdsm_api/vdsmapi-schema.json
Line 5686: #
Line 5687: # @reboot: #optional True if reboot is desired, False for shutdown
Line 5688: #
Line 5689: # @force: #optional True if shutdown/reboot desired by any means
necessary
Line 5690: # (forceful reboot/shutdown if all graceful
methods fail)
Done
Line 5691: # Since: 4.10.0
Line 5692: ##
Line 5693: {'command': {'class': 'VM', 'name': 'shutdown'},
Line 5694: 'data': {'vmID': 'UUID', '*delay': 'int', '*message': 'str',
....................................................
File vdsm/vm.py
Line 2354: message = 'Failed to {0} VM.'
Line 2355: if not force:
Line 2356: message += 'Try forced {0}'
Line 2357: return {'status': {'code':
errCode['exist']['status']['code'],
Line 2358: 'message': message.format(actionName)}}
Yes. In case the 'Try forced <action>' is part of the format we need to use the
the same argument twice which is impossible using % without creating a
dictionary. This came to me as cleaner solution.
Line 2359: message = 'Machine rebooting' if reboot else 'Machine shut
down'
Line 2360: return {'status': {'code': doneCode['code'], 'message':
message}}
Line 2361:
Line 2362: def _timedAcpiShutdown(self, reboot, force):
Line 2356: message += 'Try forced {0}'
Line 2357: return {'status': {'code':
errCode['exist']['status']['code'],
Line 2358: 'message': message.format(actionName)}}
Line 2359: message = 'Machine rebooting' if reboot else 'Machine shut
down'
Line 2360: return {'status': {'code': doneCode['code'], 'message':
message}}
Done
Line 2361:
Line 2362: def _timedAcpiShutdown(self, reboot, force):
Line 2363: self.log.debug('_timedAcpiShutdown Called')
Line 2364: try:
--
To view, visit http://gerrit.ovirt.org/15829
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I12737e363a80679ffb1db55f14eaee158312d7da
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Michal Skrivanek <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Peter V. Saveliev <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches