aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2019-06-17 18:22:24 -0700
committerAndy Lutomirski <luto@kernel.org>2019-06-17 18:22:24 -0700
commit81ce1e816a21d4a00a09c3c504b8bcfb57b1fa64 (patch)
treeab61c713c76c8096ae083c91b5bbe8a098548585
parenta8baf1ba6d4ba760c8a0ea2ef9fd2c8588b5a4d5 (diff)
downloadvirtme-81ce1e816a21d4a00a09c3c504b8bcfb57b1fa64.tar.gz
Add very basic --net=bridge support
This isn't obviously terribly useful without careful configuration of the host. Signed-off-by: Andy Lutomirski <luto@kernel.org>
-rw-r--r--virtme/commands/run.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/virtme/commands/run.py b/virtme/commands/run.py
index 9a627a5..4c27bed 100644
--- a/virtme/commands/run.py
+++ b/virtme/commands/run.py
@@ -54,7 +54,8 @@ def make_parser():
help='Give the guest read-write access to its root filesystem')
g.add_argument('--graphics', action='store_true',
help='Show graphical output instead of using a console.')
- g.add_argument('--net', action='store_true',
+ g.add_argument('--net', action='store', const='user', nargs='?',
+ choices=['user', 'bridge'],
help='Enable basic network access.')
g.add_argument('--balloon', action='store_true',
help='Allow the host to ask the guest to release memory.')
@@ -372,7 +373,17 @@ def main():
if args.net:
qemuargs.extend(['-device', 'virtio-net-pci,netdev=n0'])
- qemuargs.extend(['-netdev', 'user,id=n0'])
+ if args.net == 'user':
+ qemuargs.extend(['-netdev', 'user,id=n0'])
+ elif args.net == 'bridge':
+ # This is highly experimental. At least on Fedora 30 on
+ # a wireless network, it appears to successfully start but
+ # not have any network access. Patches or guidance welcome.
+ # (I assume it's mostly a lost cause on a wireless network
+ # due to a lack of widespread or automatic WDS support.)
+ qemuargs.extend(['-netdev', 'bridge,id=n0,br=virbr0'])
+ else:
+ assert False
kernelargs.extend(['virtme.dhcp'])
if args.pwd: