Ayal Baron has posted comments on this change. Change subject: vdsm: Reboot capability for VM ......................................................................
Patch Set 28: (8 comments) .................................................... File vdsm/vm.py Line 1734: Line 1735: graceful_timeout = int(timeout) Line 1736: agent_user_delay = int(delay) Line 1737: Line 1738: def checkSuccesfulShutdown(): why are all these methods internal to these method and not at class level? (you've already defined a separate class for this purpose, that sounds like a reason for moving these methods out Line 1739: return vm.lastStatus == 'Down' Line 1740: Line 1741: def checkSuccesfulReboot(): Line 1742: return vm._rebootPerformed Line 1743: Line 1744: # Callbacks for Callback Chain Line 1745: Line 1746: def guestAgentShutdown(delay, message): Line 1747: vm.guestAgent.desktopShutdown(delay, message, False) if desktopShutdown fails immediately there is no point in proceeding Line 1748: time.sleep(graceful_timeout + agent_user_delay) Line 1749: return checkSuccesfulShutdown() Line 1750: Line 1751: def guestAgentReboot(delay, message): Line 1744: # Callbacks for Callback Chain Line 1745: Line 1746: def guestAgentShutdown(delay, message): Line 1747: vm.guestAgent.desktopShutdown(delay, message, False) Line 1748: time.sleep(graceful_timeout + agent_user_delay) s/time.sleep/utils.retry/ if you actually want to wait graceful_timeout then split this into: time.sleep(graceful_timeout) utils.retry(checkSuccessfulShutdown, timeout=agent_user_delay) Line 1749: return checkSuccesfulShutdown() Line 1750: Line 1751: def guestAgentReboot(delay, message): Line 1752: vm.guestAgent.desktopShutdown(delay, message, True) Line 1749: return checkSuccesfulShutdown() Line 1750: Line 1751: def guestAgentReboot(delay, message): Line 1752: vm.guestAgent.desktopShutdown(delay, message, True) Line 1753: time.sleep(graceful_timeout + agent_user_delay) same Line 1754: return checkSuccesfulReboot() Line 1755: Line 1756: def qemuAgentShutdown(): Line 1757: try: Line 1755: Line 1756: def qemuAgentShutdown(): Line 1757: try: Line 1758: vm._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_GUEST_AGENT) Line 1759: time.sleep(graceful_timeout) We should not support shutdown from 2 different guest agents. Choose one and support only it and get rid of the code of the other one. Line 1760: except libvirt.libvirtError: Line 1761: pass Line 1762: return checkSuccesfulShutdown() Line 1763: Line 1763: Line 1764: def qemuAgentReboot(): Line 1765: try: Line 1766: vm._dom.reboot(libvirt.VIR_DOMAIN_REBOOT_GUEST_AGENT) Line 1767: time.sleep(graceful_timeout) same Line 1768: except libvirt.libvirtError: Line 1769: pass Line 1770: return checkSuccesfulReboot() Line 1771: Line 1770: return checkSuccesfulReboot() Line 1771: Line 1772: def acpiShutdown(): Line 1773: vm._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) Line 1774: time.sleep(graceful_timeout) same. also graceful_timeout is wrong here (not applicable) Line 1775: return checkSuccesfulShutdown() Line 1776: Line 1777: def acpiReboot(): Line 1778: vm._dom.reboot(libvirt.VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) Line 1775: return checkSuccesfulShutdown() Line 1776: Line 1777: def acpiReboot(): Line 1778: vm._dom.reboot(libvirt.VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) Line 1779: time.sleep(graceful_timeout) same Line 1780: return checkSuccesfulReboot() Line 1781: Line 1782: # End Callbacks Line 1783: -- 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: 28 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Antoni Segura Puimedon <asegu...@redhat.com> Gerrit-Reviewer: Ayal Baron <aba...@redhat.com> Gerrit-Reviewer: Better Saggi <bettersa...@gmail.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Giuseppe Vallarelli <gvall...@redhat.com> Gerrit-Reviewer: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Martin Polednik <mpole...@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: Saggi Mizrahi <smizr...@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