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