← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/maas_detect_ipmi_bug1064527 into lp:maas

 

Andres Rodriguez has proposed merging lp:~andreserl/maas/maas_detect_ipmi_bug1064527 into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1064527 in MAAS: "detect_ipmi needs improvement.  detects non-existant device in nested kvm"
  https://bugs.launchpad.net/maas/+bug/1064527

For more details, see:
https://code.launchpad.net/~andreserl/maas/maas_detect_ipmi_bug1064527/+merge/157944
-- 
https://code.launchpad.net/~andreserl/maas/maas_detect_ipmi_bug1064527/+merge/157944
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/maas_detect_ipmi_bug1064527 into lp:maas.
=== modified file 'contrib/preseeds_v2/enlist_userdata'
--- contrib/preseeds_v2/enlist_userdata	2013-04-08 19:56:51 +0000
+++ contrib/preseeds_v2/enlist_userdata	2013-04-09 19:50:27 +0000
@@ -66,7 +66,15 @@
    import json
 
    def detect_ipmi():
-       # TODO: Detection could be improved.
+       # XXX: andreserl 2013-04-09 bug=1064527: Try to detect if node
+       # is a Virtual Machine. If it is, do not try to detect IPMI.
+       f = open('/proc/cpuinfo', 'r')
+       cpu_info = f.readlines()
+       f.close()
+       for line in cpu_info:
+           if line.startswith('model name') and 'QEMU' in line:
+               return (False, None)
+
        (status, output) = commands.getstatusoutput('ipmi-locate')
        show_re = re.compile('(IPMI\ Version:) (\d\.\d)')
        res = show_re.search(output)

=== modified file 'src/metadataserver/commissioning/user_data.template'
--- src/metadataserver/commissioning/user_data.template	2013-04-08 19:56:51 +0000
+++ src/metadataserver/commissioning/user_data.template	2013-04-09 19:50:27 +0000
@@ -229,7 +229,15 @@
 import time
 
 def detect_ipmi():
-    # TODO: Detection could be improved.
+    # XXX: andreserl 2013-04-09 bug=1064527: Try to detect if node
+    # is a Virtual Machine. If it is, do not try to detect IPMI.
+    f = open('/proc/cpuinfo', 'r')
+    cpu_info = f.readlines()
+    f.close()
+    for line in cpu_info:
+        if line.startswith('model name') and 'QEMU' in line:
+            return (False, None)
+
     (status, output) = commands.getstatusoutput('ipmi-locate')
     show_re = re.compile('(IPMI\ Version:) (\d\.\d)')
     res = show_re.search(output)