@@ -228,6 +228,7 @@ class BaseConfig(object):
228228
229229 def acquire_taplock (self , error = True ):
230230 logger .debug ("Acquiring lockfile %s..." % self .taplock )
231+ self .taplog (" Acquiring lockfile %s..." % self .taplock )
231232 try :
232233 self .taplock_descriptor = open (self .taplock , 'w' )
233234 fcntl .flock (self .taplock_descriptor , fcntl .LOCK_EX | fcntl .LOCK_NB )
@@ -241,6 +242,7 @@ class BaseConfig(object):
241242 self .taplock_descriptor .close ()
242243 self .taplock_descriptor = None
243244 return False
245+ self .taplog ("Acquired lockfile %s..." % self .taplock )
244246 return True
245247
246248 def release_taplock (self ):
@@ -253,6 +255,7 @@ class BaseConfig(object):
253255 # Removing the file is a potential race, don't do that either
254256 # os.remove(self.taplock)
255257 self .taplock_descriptor = None
258+ self .taplog ("Releasing lockfile for tap device '%s'" % self .tap )
256259
257260 def check_free_port (self , host , port , lockdir ):
258261 """ Check whether the port is free or not """
@@ -1143,6 +1146,11 @@ to your build configuration.
11431146 if hostfwd :
11441147 logger .info ('Port forward: %s' % ' ' .join (hostfwd ))
11451148
1149+ def taplog (self , msg ):
1150+ with open ("/tmp/qemutaplog" , "a+" ) as logf :
1151+ logf .write ("%s - %s: %s\n " % (str (os .getpid ()), time .time (), msg ))
1152+
1153+
11461154 def setup_tap (self ):
11471155 """Setup tap"""
11481156
@@ -1177,11 +1185,13 @@ to your build configuration.
11771185 lockfile = os .path .join (lockdir , p )
11781186 if os .path .exists ('%s.skip' % lockfile ):
11791187 logger .info ('Found %s.skip, skipping %s' % (lockfile , p ))
1188+ self .taplog ('Found %s.skip, skipping %s' % (lockfile , p ))
11801189 continue
11811190 self .taplock = lockfile + '.lock'
11821191 if self .acquire_taplock (error = False ):
11831192 tap = p
11841193 logger .info ("Using preconfigured tap device %s" % tap )
1194+ self .taplog ("Using preconfigured tap device %s" % tap )
11851195 logger .info ("If this is not intended, touch %s.skip to make runqemu skip %s." % (lockfile , tap ))
11861196 break
11871197
@@ -1213,6 +1223,7 @@ to your build configuration.
12131223 logger .error ("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create." )
12141224 sys .exit (1 )
12151225 self .tap = tap
1226+ self .taplog ("Using tap device %s to start qemu" % tap )
12161227 tapnum = int (tap [len (oe_tap_name ):])
12171228 gateway = tapnum * 2 + 1
12181229 client = gateway + 1
@@ -1239,18 +1250,22 @@ to your build configuration.
12391250 def setup_network (self ):
12401251 if self .nonetwork or self .get ('QB_NET' ) == 'none' :
12411252 self .set ('NETWORK_CMD' , '-nic none' )
1253+ self .taplog ('Using -nic none' )
12421254 return
12431255 if sys .stdin .isatty ():
12441256 self .saved_stty = subprocess .check_output (("stty" , "-g" )).decode ('utf-8' ).strip ()
12451257 self .network_device = self .get ('QB_NETWORK_DEVICE' ) or self .network_device
12461258 if self .net_bridge :
12471259 self .setup_net_bridge ()
1260+ self .taplog ('Setup net_bridge %s' % (self .network_device ))
12481261 elif self .slirp_enabled :
12491262 self .cmdline_ip_slirp = self .get ('QB_CMDLINE_IP_SLIRP' ) or self .cmdline_ip_slirp
12501263 self .setup_slirp ()
1264+ self .taplog ('Setup slirp for %s' % (self .network_device ))
12511265 else :
12521266 self .cmdline_ip_tap = self .get ('QB_CMDLINE_IP_TAP' ) or self .cmdline_ip_tap
12531267 self .setup_tap ()
1268+ self .taplog ('Setup tap for %s' % (self .network_device ))
12541269
12551270 def setup_rootfs (self ):
12561271 if self .get ('QB_ROOTFS' ) == 'none' :
@@ -1640,6 +1655,7 @@ to your build configuration.
16401655 logger .debug ('Running %s' % str (cmd ))
16411656 subprocess .check_call (cmd )
16421657 self .release_taplock ()
1658+ self .taplog ("Qemu exiting" )
16431659
16441660 if self .nfs_running :
16451661 logger .info ("Shutting down the userspace NFS server..." )
@@ -1753,6 +1769,8 @@ def main():
17531769 config .cleanup ()
17541770 signal .signal (signal .SIGTERM , sigterm_handler )
17551771
1772+ config .taplog ("Qemu starting" )
1773+
17561774 config .check_args ()
17571775 config .read_qemuboot ()
17581776 config .check_and_set ()
0 commit comments