Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 955543 - [RFE]Rewrite "the reboot implementation" in ovirt_boot_setup(self, reboot="N") of install.py
[RFE]Rewrite "the reboot implementation" in ovirt_boot_setup(self, reboot="N"...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ovirt-node (Show other bugs)
6.4
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Joey Boggs
Virtualization Bugs
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-23 05:18 EDT by haiyang,dong
Modified: 2014-08-04 19:24 EDT (History)
13 users (show)

See Also:
Fixed In Version: ovirt-node-3.0.0-6.el6
Doc Type: Enhancement
Doc Text:
The Reboot of the hypervisor is now performed async. This is to eliminate any processes from killing themselves and aborting the reboot. A single process daemon is created to handle the restart instead of using cron. There is now a consistent reboot process which no longer relies on cron.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-21 14:31:55 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:0033 normal SHIPPED_LIVE ovirt-node bug fix and enhancement update 2014-01-21 19:14:30 EST

  None (edit)
Description haiyang,dong 2013-04-23 05:18:59 EDT
Description of problem:
According to comment14 &&15 BZ#849315, so it's better that rewrite "the reboot implementation" 
instead of using crond for the async reboot.
But actually, in rhev-h 6.4, it still used old method about "the reboot implementation"

          if reboot is not None and reboot == "Y":
                f = open('/var/spool/cron/root', 'w')
                f.write('* * * * * sleep 10 && /sbin/reboot\n')
                f.close()
                #ensure crond is started
                _functions.subprocess_closefds("crond", shell=True,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT)

it's better to using this method of Alon Bar-Lev mentioned:
http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=blob;f=vdsm_reg/deployUtil.py.in;hb=HEAD#l202

Seem that this new "reboot implementation" is more considerate and may avoid potential issues
caused by the crude reboot.


#!/usr/bin/env python
import os
import sys
import time

def simpleDaemon(main, args=(), kwargs={}):
        # Default maximum for the number of available file descriptors.
        MAXFD = 1024

        import resource  # Resource usage information.
        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
        if (maxfd == resource.RLIM_INFINITY):
            maxfd = MAXFD

        pid = os.fork()
        if pid == 0:
            try:
                os.setsid()
                for fd in range(0, maxfd):
                    try:
                        os.close(fd)
                    except OSError:
                        # ERROR, fd wasn't open to begin with (ignored)
                        pass

                os.open(os.devnull, os.O_RDWR)  # standard input (0)
                os.dup2(0, 1)  # standard output (1)
                os.dup2(0, 2)  # standard error (2)

                if os.fork() != 0:
                    os._exit(0)

                try:
                    main(*args, **kwargs)
                except:
                    import traceback
                    traceback.print_exc()
            finally:
                os._exit(1)

        pid, status = os.waitpid(pid, 0)

        if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0:
            raise RuntimeError('Daemon not exited properly')

def delayedReboot(reboot, sleepTime): 
        time.sleep(sleepTime)
        os.execl(reboot, reboot)

def reboot( delay):
        simpleDaemon(
            delayedReboot,
            (
                "/sbin/reboot",
                delay,
            )
        )

reboot(10)


Version-Release number of selected component (if applicable):
rhev-hypervisor6-6.4-20130415.0.el6_4

How reproducible:
100% 
 
Steps to Reproduce:


Actual result:          
                                                  
Expect result:


Additional info:
Comment 5 haiyang,dong 2013-10-21 06:05:36 EDT
Test version:
rhev-hypervisor6-6.5-20131017.0.iso
ovirt-node-3.0.1-4.el6

The install module now uses the async daemon created and has a default delay of 3 seconds. Also now the tui installer calls the new reboot method.

For the default delay time is 3 seconds not 10 seconds, i have report another bug 1021437 - "delay time is short before reboot for auto install process" to track it.

this bug has been fixed, change the status into "VERIFIED"
Comment 7 Cheryn Tan 2013-11-07 19:29:01 EST
This bug is currently attached to errata RHBA-2013:15277. If this change is not to be documented in the text for this errata please either remove it from the errata, set the requires_doc_text flag to minus (-), or leave a "Doc Text" value of "--no tech note required" if you do not have permission to alter the flag.

Otherwise to aid in the development of relevant and accurate release documentation, please fill out the "Doc Text" field above with these four (4) pieces of information:

* Cause: What actions or circumstances cause this bug to present.
* Consequence: What happens when the bug presents.
* Fix: What was done to fix the bug.
* Result: What now happens when the actions or circumstances above occur. (NB: this is not the same as 'the bug doesn't present anymore')

Once filled out, please set the "Doc Type" field to the appropriate value for the type of change made and submit your edits to the bug.

For further details on the Cause, Consequence, Fix, Result format please refer to:

https://bugzilla.redhat.com/page.cgi?id=fields.html#cf_release_notes 

Thanks in advance.
Comment 9 errata-xmlrpc 2014-01-21 14:31:55 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0033.html

Note You need to log in before you can comment on or make changes to this bug.