← Back to team overview

ubuntu-server-iso-testing-dev team mailing list archive

[Merge] lp:~jibel/ubuntu-server-iso-testing/serial-logging into lp:ubuntu-server-iso-testing

 

Jean-Baptiste Lallement has proposed merging lp:~jibel/ubuntu-server-iso-testing/serial-logging into lp:ubuntu-server-iso-testing.

Requested reviews:
  Ubuntu Server Iso Testing Developers (ubuntu-server-iso-testing-dev)

For more details, see:
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/serial-logging/+merge/72969
-- 
https://code.launchpad.net/~jibel/ubuntu-server-iso-testing/serial-logging/+merge/72969
Your team Ubuntu Server Iso Testing Developers is requested to review the proposed merge of lp:~jibel/ubuntu-server-iso-testing/serial-logging into lp:ubuntu-server-iso-testing.
=== modified file 'run-test.py'
--- run-test.py	2011-08-23 16:04:41 +0000
+++ run-test.py	2011-08-25 22:32:27 +0000
@@ -105,6 +105,22 @@
 
     return True
 
+def update_inittab(tmpdir):
+    """Add an entry to inittab for logging
+    @param tmp_dir: Temp directory where initrd has been unpacked
+    """
+    # Add entry to inittab for logging
+    inittab = os.path.join(tmpdir, 'etc', 'inittab')
+    if os.path.isfile(inittab):
+        logging.debug('Updating inittab')
+        with open(inittab, 'a') as f:
+            ttyS = "\n\
+# logging to serial\n\
+ttyS0::respawn:/usr/bin/tail -n 1200 -f /var/log/syslog \n"
+            f.write(ttyS)
+    else:
+        logging.info('inittab not found')
+
 # Defaults
 DEFAULT_VARIANT = 'server'
 DEFAULT_RELEASE = 'oneiric'
@@ -295,6 +311,8 @@
 test_case_doc = db[test_uuid]
 db.put_attachment(test_case_doc, open(RUN_TEST), "run_test")
 
+update_inittab(initrd_tmp_dir)
+
 if options.variant == 'desktop':
     # Specific bits for Desktop
     # Put run_test wrapper in the initrd too
@@ -567,19 +585,8 @@
         The latest d-i syslog is kept at d-i-syslog.log.
     '''
     logging.debug("Capturing current d-i syslog for test case %s" % domain)
-    cmd = [ "wget", "--timeout=10", "-q", "--output-document=d-i-syslog.tmp",
-            "http://"; + ipAddress + "/syslog" ]
-    logging.debug("Cmd=%s" % cmd)
-    proc = subprocess.Popen(cmd, bufsize=204800, stdout=subprocess.PIPE)
-    retcode = proc.wait()
-    output = proc.communicate()[0].strip()
-    #logging.debug(output)
-    if retcode:
-        os.remove('d-i-syslog.tmp')
-        return None
-    # OK, let's get up to ten lines from the end of the log
-    os.rename('d-i-syslog.tmp', 'd-i-syslog.log')
-    cmd = [ 'tail', 'd-i-syslog.log']
+    syslog_path = os.path.join('/tmp', '%s.syslog.log' % domain)
+    cmd = [ 'tail', syslog_path]
     proc = subprocess.Popen(cmd, bufsize=204800, stdout=subprocess.PIPE)
     retcode = proc.wait()
     output = proc.communicate()[0].strip()
@@ -604,6 +611,13 @@
 seen_di_syslog = False
 iter_wait_di_syslog = 0
 wait_di_syslog = 20
+
+# libvirt thinks it owns everything!
+syslog_path = os.path.join('/tmp/', '%s.syslog.log' % test['_id'])
+cmd = [ "sudo", "chown", os.getenv('USER'), syslog_path]
+logging.debug("Cmd: %s" % (cmd))
+subprocess.check_call(cmd)
+
 while True:
     if l_ipAddress is None:
         l_ipAddress = get_ipAddress(test['_id'], mac_address)
@@ -680,9 +694,9 @@
 else:
     logging.debug("VM for test case %s powered off but tests not completed" % test['_id'])
 # save D-I logs no matter what (if they exist, of course)
-if os.path.isfile('d-i-syslog.log'):
+if os.path.isfile(syslog_path):
     # we do have a debian-installer syslog
-    os.rename('d-i-syslog.log', os.path.join(testresultsdir, 'd-i-syslog.log'))
+    os.rename(syslog_path, os.path.join(testresultsdir, 'd-i-syslog.log'))
     
 # Undefine and delete the Virtual Machine
 logging.debug("Undefine VM for  test case %s" % (test['_id']))

=== modified file 'templates.alternate/libvirt.xml'
--- templates.alternate/libvirt.xml	2011-08-09 10:08:56 +0000
+++ templates.alternate/libvirt.xml	2011-08-25 22:32:27 +0000
@@ -57,5 +57,9 @@
                 <acceleration accel3d='yes' accel2d='yes'/>
             </model>
         </video>
+        <serial type="file">
+            <source path="/tmp/{{ uuid }}.syslog.log"/>
+            <target port="0"/>
+        </serial>
     </devices>
 </domain>

=== modified file 'templates.alternate/preseeds-common/base'
--- templates.alternate/preseeds-common/base	2011-08-23 06:59:35 +0000
+++ templates.alternate/preseeds-common/base	2011-08-25 22:32:27 +0000
@@ -34,7 +34,7 @@
 # start the HTTP server early, so that we can grab the d-i log
 # # will be executed after network initialisation is completed.
 #d-i preseed/early_command string httpd
-d-i partman/early_command string httpd
+#d-i partman/early_command string httpd
 
 ### Network configuration
 # netcfg will choose an interface that has link if possible. This makes it

=== modified file 'templates.desktop/libvirt.xml'
--- templates.desktop/libvirt.xml	2011-08-11 15:26:22 +0000
+++ templates.desktop/libvirt.xml	2011-08-25 22:32:27 +0000
@@ -58,5 +58,9 @@
                 <acceleration accel3d='yes' accel2d='yes'/>
             </model>
         </video>
+        <serial type="file">
+            <source path="/tmp/{{ uuid }}.syslog.log"/>
+            <target port="0"/>
+        </serial>
     </devices>
 </domain>

=== modified file 'templates.kernel/libvirt.xml'
--- templates.kernel/libvirt.xml	2011-06-26 14:06:40 +0000
+++ templates.kernel/libvirt.xml	2011-08-25 22:32:27 +0000
@@ -52,5 +52,9 @@
 			<model type='virtio'/>
        		</interface>
       		<graphics type='vnc' listen='0.0.0.0'/>
+        <serial type="file">
+            <source path="/tmp/{{ uuid }}.syslog.log"/>
+            <target port="0"/>
+        </serial>
         </devices>
 </domain>

=== modified file 'templates.kernel/preseeds-common/base'
--- templates.kernel/preseeds-common/base	2011-08-11 12:40:13 +0000
+++ templates.kernel/preseeds-common/base	2011-08-25 22:32:27 +0000
@@ -33,7 +33,7 @@
 
 # start the HTTP server early, so that we can grab the d-i log
 # # will be executed after network initialisation is completed.
-d-i preseed/early_command string httpd
+#d-i preseed/early_command string httpd
 
 ### Network configuration
 # netcfg will choose an interface that has link if possible. This makes it

=== modified file 'templates/libvirt.xml'
--- templates/libvirt.xml	2011-06-26 14:06:40 +0000
+++ templates/libvirt.xml	2011-08-25 22:32:27 +0000
@@ -52,5 +52,9 @@
 			<model type='virtio'/>
        		</interface>
       		<graphics type='vnc' listen='0.0.0.0'/>
+        <serial type="file">
+            <source path="/tmp/{{ uuid }}.syslog.log"/>
+            <target port="0"/>
+        </serial>
         </devices>
 </domain>

=== modified file 'templates/preseeds-common/base'
--- templates/preseeds-common/base	2011-08-11 12:40:13 +0000
+++ templates/preseeds-common/base	2011-08-25 22:32:27 +0000
@@ -33,7 +33,7 @@
 
 # start the HTTP server early, so that we can grab the d-i log
 # # will be executed after network initialisation is completed.
-d-i preseed/early_command string httpd
+#d-i preseed/early_command string httpd
 
 ### Network configuration
 # netcfg will choose an interface that has link if possible. This makes it


Follow ups