summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/runqemu19
1 files changed, 8 insertions, 11 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index cef5b8d4a4..7c6f1cb964 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1015,17 +1015,14 @@ to your build configuration.
1015 else: 1015 else:
1016 self.nfs_server = '192.168.7.@GATEWAY@' 1016 self.nfs_server = '192.168.7.@GATEWAY@'
1017 1017
1018 # Figure out a new nfs_instance to allow multiple qemus running. 1018 nfsd_port = 3048 + self.nfs_instance
1019 ps = subprocess.check_output(("ps", "auxww")).decode('utf-8') 1019 lockdir = "/tmp/qemu-port-locks"
1020 pattern = '/bin/unfsd .* -i .*\.pid -e .*/exports([0-9]+) ' 1020 self.make_lock_dir(lockdir)
1021 all_instances = re.findall(pattern, ps, re.M) 1021 while not self.check_free_port('localhost', nfsd_port, lockdir):
1022 if all_instances: 1022 self.nfs_instance += 1
1023 all_instances.sort(key=int) 1023 nfsd_port += 1
1024 self.nfs_instance = int(all_instances.pop()) + 1
1025
1026 nfsd_port = 3049 + 2 * self.nfs_instance
1027 mountd_port = 3048 + 2 * self.nfs_instance
1028 1024
1025 mountd_port = nfsd_port
1029 # Export vars for runqemu-export-rootfs 1026 # Export vars for runqemu-export-rootfs
1030 export_dict = { 1027 export_dict = {
1031 'NFS_INSTANCE': self.nfs_instance, 1028 'NFS_INSTANCE': self.nfs_instance,
@@ -1600,13 +1597,13 @@ to your build configuration.
1600 logger.debug('Running %s' % str(cmd)) 1597 logger.debug('Running %s' % str(cmd))
1601 subprocess.check_call(cmd) 1598 subprocess.check_call(cmd)
1602 self.release_taplock() 1599 self.release_taplock()
1603 self.release_portlock()
1604 1600
1605 if self.nfs_running: 1601 if self.nfs_running:
1606 logger.info("Shutting down the userspace NFS server...") 1602 logger.info("Shutting down the userspace NFS server...")
1607 cmd = ("runqemu-export-rootfs", "stop", self.rootfs) 1603 cmd = ("runqemu-export-rootfs", "stop", self.rootfs)
1608 logger.debug('Running %s' % str(cmd)) 1604 logger.debug('Running %s' % str(cmd))
1609 subprocess.check_call(cmd) 1605 subprocess.check_call(cmd)
1606 self.release_portlock()
1610 1607
1611 if self.saved_stty: 1608 if self.saved_stty:
1612 subprocess.check_call(("stty", self.saved_stty)) 1609 subprocess.check_call(("stty", self.saved_stty))