<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <br>
    <br>
    于 2011年12月21日 22:41, Mike Burns 写道:
    <blockquote
      cite="mid:1324478487.12161.177.camel@beelzebub.mburnsfire.net"
      type="cite">
      <pre wrap="">Thanks for the patch.

Just so you're aware, the normal process for patch submissions is to
post patches to gerrit:

<a class="moz-txt-link-freetext" href="http://ovirt.org/wiki/Working_with_oVirt_Gerrit">http://ovirt.org/wiki/Working_with_oVirt_Gerrit</a>

It looks like you're working off a rather old version.  The
autoinstall_failed function was moved to ovirt-functions back in
September.

The current repo is at:  
Gitweb: <a class="moz-txt-link-freetext" href="http://gerrit.ovirt.org/gitweb?p=ovirt-node.git">http://gerrit.ovirt.org/gitweb?p=ovirt-node.git</a>
giturl: <a class="moz-txt-link-freetext" href="http://gerrit.ovirt.org/p/ovirt-node.git">http://gerrit.ovirt.org/p/ovirt-node.git</a>

The actual commit that moved the function is here:

<a class="moz-txt-link-freetext" href="http://gerrit.ovirt.org/gitweb?p=ovirt-node.git;a=commit;h=a6f000ae812ee1ee4d762ba1f6c807968ac13170">http://gerrit.ovirt.org/gitweb?p=ovirt-node.git;a=commit;h=a6f000ae812ee1ee4d762ba1f6c807968ac13170</a>


Some initial comments on you're patch are below:

On Wed, 2011-12-21 at 15:47 +0800, <a class="moz-txt-link-abbreviated" href="mailto:taget@linux.vnet.ibm.com">taget@linux.vnet.ibm.com</a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">From: jimmy <a class="moz-txt-link-rfc2396E" href="mailto:taget@163.com">&lt;taget@163.com&gt;</a>

This patch is to configure networking before dropping in to emergency shell.
By doing this, user can using ssh to connect host server.

Signed-off-by: Eli <a class="moz-txt-link-rfc2396E" href="mailto:taget@vnet.linux.ibm.com">&lt;taget@vnet.linux.ibm.com&gt;</a>
---
 ovirt-firstboot |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/virt-firstboot b/scripts/ovirt-firstboot
index ef0a071..48f31e6 100755
--- a/scripts/ovirt-firstboot
+++ b/scripts/ovirt-firstboot
@@ -36,6 +36,9 @@ trap 'exit $?' 1 2 13 15
 autoinstall_failed(){
     log "Automatic installation failed. Please review console messages."
     log "Press Enter to drop to emergency shell."
+    /usr/libexec/ovirt-config-networking AUTO
</pre>
      </blockquote>
      <pre wrap="">
Since changed to use python scripts instead of bash.  This should be
calling the network_auto function in network.py.  You can see how this
is called in ovirt-auto-install.py

</pre>
      <blockquote type="cite">
        <pre wrap="">+    log "Configure root password : "
+    /usr/bin/passwd
</pre>
      </blockquote>
      <pre wrap="">
This will set the root password, but ssh password authentication is
disabled by default, so you need to enable that too.

</pre>
      <blockquote type="cite">
        <pre wrap="">     read &lt; /dev/console
     bash &lt; /dev/console
 }
</pre>
      </blockquote>
      <pre wrap="">

The overall concept of being able to ssh in when auto-installation fails
is good, but it's not solved completely here.  Assuming I understand
correctly, you're looking to be able to start the installation process
and then ssh in to debug it if/when it fails.  You're current patch
doesn't remove the need for console access since you need to be able to
type the password anyway to set it.

My recommendation would be to:

1.  get the updated repo
2.  work in ovirt-auto-install.py to configure networking in the else
condition
3.  use existing means to set passwords and ssh password authentication
        you can set root password with rootpw commandline option
        you can set admin password with adminpw commandline option
        you can enable ssh password auth with ssh_pwauth option
        These options are documented in ovirt-early where they're
        parsed.

</pre>
    </blockquote>
    hi Mike,<br>
    I don't think add network configure and enable ssh password in the
    else condition is a good way , cause if so , the code is duplicated
    and ugly.<br>
    <br>
    <br>
    So , can we just configure networking and enable ssh password before
    we call storage_auto() ? By doing this , we could access the host
    even the automatic installation failed.<br>
    like this :<br>
    <br>
    <b>in scripts/ovirt-auto-install.py</b><i><br>
      ....<br>
      import os<br>
      import sys<br>
      from ovirtnode.ovirtfunctions import *<br>
      from ovirtnode.storage import *<br>
      from ovirtnode.install import *<br>
      from ovirtnode.network import *<br>
      from ovirtnode.log import *<br>
      from ovirtnode.kdump import *<br>
      from ovirtnode.snmp import *<br>
      from ovirt_config_setup.collectd import *<br>
      <br>
      <font color="#ff0000"># store /etc/shadow if adminpw/rootpw are
        set, handled already in ovirt-early<br>
            file = open("/proc/cmdline")<br>
            args = file.read()<br>
            if "adminpw" in args or "rootpw" in args:<br>
                print "Storing /etc/shadow"<br>
                ovirt_store_config("/etc/passwd")<br>
                ovirt_store_config("/etc/shadow")<br>
            file.close()<br>
            # network configuration<br>
            print "Configuring Network"<br>
            if OVIRT_VARS["OVIRT_BOOTIF"] != "":<br>
                network_auto()<br>
        <br>
            if OVIRT_VARS.has_key("OVIRT_HOSTNAME"):<br>
                system("hostname %s" % OVIRT_VARS["OVIRT_HOSTNAME"])<br>
            #set ssh_passwd_auth<br>
            if OVIRT_VARS.has_key("OVIRT_SSH_PWAUTH"):<br>
                if self.ssh_passwd_status.value() == 1:<br>
                   
        augtool("set","/files/etc/ssh/sshd_config/PasswordAuthentication",
        "yes")<br>
                elif self.ssh_passwd_status.value() == 0:<br>
                   
        augtool("set","/files/etc/ssh/sshd_config/PasswordAuthentication",
        "no")</font></i><br>
    <i>print "Performing automatic disk partitioning"</i><br>
    <i>if storage_auto():<br>
          # iscsi handled in install.py<br>
          print "Configuring Logging"<br>
          logging_auto()<br>
          print "Configuring Collectd"<br>
          collectd_auto()<br>
          install = Install()<br>
          print "Configuring KDump"<br>
          kdump_auto()<br>
          print "Configuring SNMP"<br>
          snmp_auto()<br>
          ... ...<br>
      else <br>
          print "Automatic installation failed. Please review
      /tmp/ovirt.log"<br>
          sys.exit(1)</i><br>
    <br>
    <pre class="moz-signature" cols="72">-- 
best regards
eli</pre>
  </body>
</html>