Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 955543

Summary: [RFE]Rewrite "the reboot implementation" in ovirt_boot_setup(self, reboot="N") of install.py
Product: Red Hat Enterprise Linux 6 Reporter: haiyang,dong <hadong>
Component: ovirt-nodeAssignee: Joey Boggs <jboggs>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, bsarathy, cboyle, cshao, gouyang, hadong, huiwa, jboggs, leiwang, mburns, ovirt-maint, robimath, ycui
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 19:31:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description haiyang,dong 2013-04-23 09:18:59 UTC
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 10:05:36 UTC
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-08 00:29:01 UTC
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 19:31:55 UTC
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