Martin Betak has posted comments on this change. Change subject: vdsm: Reboot capability for VM ......................................................................
Patch Set 14: (7 comments) .................................................... File lib/vdsm/utils.py Line 913: os.killpg(0, 9) Line 914: sys.exit(-3) Line 915: Line 916: Line 917: Callback = namedtuple('Callback', ['func', 'timeout', 'args', 'kwargs']) Done Line 918: Line 919: Line 920: class CallbackChain(object): Line 921: """ Line 933: """ Line 934: log = logging.getLogger("utils.CallbackChain") Line 935: Line 936: def __init__(self): Line 937: self.callbacks = [] Done Line 938: self.remaining_callbacks = None Line 939: self._initCallbacks() Line 940: Line 941: def start(self): Line 943: # start with first callback Line 944: self._timerCallback() Line 945: Line 946: def _timerCallback(self): Line 947: if self._checkSuccess() or len(self.remaining_callbacks) == 0: Done Line 948: return Line 949: Line 950: callback = self.remaining_callbacks.pop(0) Line 951: Line 948: return Line 949: Line 950: callback = self.remaining_callbacks.pop(0) Line 951: Line 952: if callback.timeout is not None: Done Line 953: timer = threading.Timer(callback.timeout, self._timerCallback) Line 954: timer.start() Line 955: Line 956: self.log.debug('%s called with args=%s and kwargs=%s', Line 965: def _addCallback(self, func, next_callback_timeout, *args, **kwargs): Line 966: self.callbacks.append(Callback(func, next_callback_timeout, Line 967: args, kwargs)) Line 968: Line 969: ## abstract methods to be overriden by descendants Done Line 970: Line 971: def _checkSuccess(self): Line 972: """ Line 973: Allows to end the callback chain by signaling that the desired action .................................................... File vdsm/vm.py Line 1650: self.vm._guestEventTime = time.time() Line 1651: self.vm._guestEvent = self.info['guestEvent'] Line 1652: Line 1653: def _initCallbacks(self): Line 1654: Done Line 1655: sys_timeout = config.getint('vars', 'sys_shutdown_timeout') Line 1656: agent_timeout = int(self.timeout) + sys_timeout Line 1657: Line 1658: # first try agent Line 1652: Line 1653: def _initCallbacks(self): Line 1654: Line 1655: sys_timeout = config.getint('vars', 'sys_shutdown_timeout') Line 1656: agent_timeout = int(self.timeout) + sys_timeout It is used on line 1661 when we pass the timeout as a string to guestAgent Line 1657: Line 1658: # first try agent Line 1659: if self.vm.guestAgent and self.vm.guestAgent.isResponsive(): Line 1660: self._addCallback(self.info['guestAgent'], agent_timeout, -- 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: 14 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Antoni Segura Puimedon <asegu...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Martin Sivák <msi...@redhat.com> Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Peter V. Saveliev <p...@redhat.com> Gerrit-Reviewer: Vinzenz Feenstra <vfeen...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches