diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index c324982e8a..dd0aa4b28f 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -165,6 +165,7 @@ class BaseConfig(object): | |||
165 | self.kvm_enabled = False | 165 | self.kvm_enabled = False |
166 | self.vhost_enabled = False | 166 | self.vhost_enabled = False |
167 | self.slirp_enabled = False | 167 | self.slirp_enabled = False |
168 | self.net_bridge = None | ||
168 | self.nfs_instance = 0 | 169 | self.nfs_instance = 0 |
169 | self.nfs_running = False | 170 | self.nfs_running = False |
170 | self.serialconsole = False | 171 | self.serialconsole = False |
@@ -485,6 +486,8 @@ class BaseConfig(object): | |||
485 | self.vhost_enabled = True | 486 | self.vhost_enabled = True |
486 | elif arg == 'slirp': | 487 | elif arg == 'slirp': |
487 | self.slirp_enabled = True | 488 | self.slirp_enabled = True |
489 | elif arg.startswith('bridge='): | ||
490 | self.net_bridge = '%s' % arg[len('bridge='):] | ||
488 | elif arg == 'snapshot': | 491 | elif arg == 'snapshot': |
489 | self.snapshot = True | 492 | self.snapshot = True |
490 | elif arg == 'publicvnc': | 493 | elif arg == 'publicvnc': |
@@ -802,7 +805,7 @@ class BaseConfig(object): | |||
802 | def check_and_set(self): | 805 | def check_and_set(self): |
803 | """Check configs sanity and set when needed""" | 806 | """Check configs sanity and set when needed""" |
804 | self.validate_paths() | 807 | self.validate_paths() |
805 | if not self.slirp_enabled: | 808 | if not self.slirp_enabled and not self.net_bridge: |
806 | check_tun() | 809 | check_tun() |
807 | # Check audio | 810 | # Check audio |
808 | if self.audio_enabled: | 811 | if self.audio_enabled: |
@@ -1020,6 +1023,10 @@ class BaseConfig(object): | |||
1020 | 1023 | ||
1021 | self.nfs_running = True | 1024 | self.nfs_running = True |
1022 | 1025 | ||
1026 | def setup_net_bridge(self): | ||
1027 | self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( | ||
1028 | self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) | ||
1029 | |||
1023 | def setup_slirp(self): | 1030 | def setup_slirp(self): |
1024 | """Setup user networking""" | 1031 | """Setup user networking""" |
1025 | 1032 | ||
@@ -1161,7 +1168,9 @@ class BaseConfig(object): | |||
1161 | if sys.stdin.isatty(): | 1168 | if sys.stdin.isatty(): |
1162 | self.saved_stty = subprocess.check_output(("stty", "-g")).decode('utf-8').strip() | 1169 | self.saved_stty = subprocess.check_output(("stty", "-g")).decode('utf-8').strip() |
1163 | self.network_device = self.get('QB_NETWORK_DEVICE') or self.network_device | 1170 | self.network_device = self.get('QB_NETWORK_DEVICE') or self.network_device |
1164 | if self.slirp_enabled: | 1171 | if self.net_bridge: |
1172 | self.setup_net_bridge() | ||
1173 | elif self.slirp_enabled: | ||
1165 | self.setup_slirp() | 1174 | self.setup_slirp() |
1166 | else: | 1175 | else: |
1167 | self.setup_tap() | 1176 | self.setup_tap() |