Skip to content

Commit 2e315e3

Browse files
Pusnowwkozaczuk
authored andcommitted
run.py: add tap option
Currently, OSv needs root permission for tap networking. However, if we have a tap interface with proper permission, we can do tap networking without root permission. This adds --tap option to specify tap interface. It enables tap networking without root permission. Usage: On root: adduser user1 kvm # allow user 1 to use kvm tunctl -u user1 -t user1_tap0 # add tap interface for user1 On user1 (without root/sudo): ./scripts/run.py -n --tap user1_tap0 Signed-off-by: Wonsup Yoon <pusnow@kaist.ac.kr> Message-Id: <20200413140011.10747-1-pusnow@kaist.ac.kr>
1 parent 89de007 commit 2e315e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/run.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ def start_osv_qemu(options):
190190
net_device_options.append('mac=%s' % options.mac)
191191

192192
if options.networking:
193-
if options.vhost:
193+
if options.tap:
194+
args += ["-netdev", "tap,id=hn%d,ifname=%s,script=no,downscript=no" % (idx, options.tap)]
195+
elif options.vhost:
194196
args += ["-netdev", "tap,id=hn%d,script=%s,vhost=on" % (idx, os.path.join(osv_base, "scripts/qemu-ifup.sh"))]
195197
else:
196198
for bridge_helper_dir in ['/usr/libexec', '/usr/lib/qemu']:
@@ -489,6 +491,8 @@ def main(options):
489491
help="bridge name for tap networking")
490492
parser.add_argument("-v", "--vhost", action="store_true",
491493
help="needs root. tap networking and vhost")
494+
parser.add_argument("-t", "--tap", action="store",
495+
help="tap interface name")
492496
parser.add_argument("-m", "--memsize", action="store", default="2G",
493497
help="specify memory: ex. 1G, 2G, ...")
494498
parser.add_argument("-c", "--vcpus", action="store", default="4",

0 commit comments

Comments
 (0)