Skip to content

Commit 02a9e08

Browse files
committed
Factor alloc_utils out.
Currently, we statically allocate resources--namely, tap interfaces--for a given number of instances. This means that we are creating many interfaces that we may not actually use. The previous mechanism partially implemented to solve this problem was to delegate allocation to a sidecar daemon, allocd, that would receive RPCs to signal that resources should be allocated and tore down. However, we can use a simpler design that creates interfaces before the vmm starts and tears them down after the vmm exits. The existing implementation shells out to use the platform ip(8), ebtables(8), and dnsmasq(8) commands to make the necessary network changes. While we could reimplemnt these using netlink, for now, it makes sense to just expose the existing implementation from allocd so we can borrow it later.
1 parent 7354bfd commit 02a9e08

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

base/cvd/allocd/BUILD.bazel

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ package(
77
cc_binary(
88
name = "allocd",
99
srcs = [
10-
"alloc_utils.cpp",
11-
"alloc_utils.h",
1210
"allocd.cpp",
1311
"request.h",
1412
"resource.cpp",
@@ -28,10 +26,26 @@ cc_binary(
2826
],
2927
includes = [""],
3028
deps = [
29+
":alloc_utils",
3130
"//cuttlefish/common/libs/fs",
3231
"//cuttlefish/host/libs/config:logging",
3332
"//libbase",
3433
"@gflags",
3534
"@jsoncpp",
3635
],
3736
)
37+
38+
cc_library(
39+
name = "alloc_utils",
40+
srcs = [
41+
"alloc_utils.cpp",
42+
],
43+
hdrs = [
44+
"alloc_utils.h",
45+
],
46+
deps = [
47+
"//cuttlefish/common/libs/fs",
48+
"//cuttlefish/host/libs/config:logging",
49+
"//libbase",
50+
],
51+
)

base/cvd/allocd/alloc_utils.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <sstream>
2626

2727
#include "cuttlefish/common/libs/fs/shared_fd.h"
28-
#include "request.h"
2928

3029
namespace cuttlefish {
3130

0 commit comments

Comments
 (0)