Skip to content

Commit 1b77e60

Browse files
committed
Add a use_cvdalloc flag to the config.
To ensure that we can manage changes without disruption, we should have a feature flag to isolate new behavior from old. We could just repurpose the allocd flag, but it might be more readable to add a flag here and remove the allocd flag later in a different commit.
1 parent 7f6510a commit 1b77e60

File tree

7 files changed

+21
-0
lines changed

7 files changed

+21
-0
lines changed

base/cvd/cuttlefish/host/commands/assemble_cvd/assemble_cvd_flags.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,13 @@ DEFINE_vec(
120120
"Frame socket path to use when launching a VM "
121121
"For example, \"--frames_socket_path=${XDG_RUNTIME_DIR}/wayland-0\"");
122122

123+
123124
DEFINE_vec(use_allocd, CF_DEFAULTS_USE_ALLOCD?"true":"false",
124125
"Acquire static resources from the resource allocator daemon.");
126+
127+
DEFINE_vec(use_cvdalloc, CF_DEFAULTS_USE_CVDALLOC? "true": "false",
128+
"Acquire static resources with cvdalloc.");
129+
125130
DEFINE_vec(
126131
enable_minimal_mode, CF_DEFAULTS_ENABLE_MINIMAL_MODE ? "true" : "false",
127132
"Only enable the minimum features to boot a cuttlefish device and "

base/cvd/cuttlefish/host/commands/assemble_cvd/assemble_cvd_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ DECLARE_vec(guest_vulkan_driver);
6161
DECLARE_vec(frames_socket_path);
6262

6363
DECLARE_vec(use_allocd);
64+
DECLARE_vec(use_cvdalloc);
6465
DECLARE_vec(enable_minimal_mode);
6566
DECLARE_vec(pause_in_bootloader);
6667
DECLARE_bool(enable_host_bluetooth);

base/cvd/cuttlefish/host/commands/assemble_cvd/flags.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
519519
std::vector<bool> use_random_serial_vec = CF_EXPECT(GET_FLAG_BOOL_VALUE(
520520
use_random_serial));
521521
std::vector<bool> use_allocd_vec = CF_EXPECT(GET_FLAG_BOOL_VALUE(use_allocd));
522+
std::vector<bool> use_cvdalloc_vec = CF_EXPECT(GET_FLAG_BOOL_VALUE(use_cvdalloc));
522523
std::vector<bool> use_sdcard_vec = CF_EXPECT(GET_FLAG_BOOL_VALUE(use_sdcard));
523524
std::vector<bool> pause_in_bootloader_vec = CF_EXPECT(GET_FLAG_BOOL_VALUE(
524525
pause_in_bootloader));
@@ -786,6 +787,7 @@ Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
786787
auto const_instance =
787788
const_cast<const CuttlefishConfig&>(tmp_config_obj).ForInstance(num);
788789

790+
instance.set_use_cvdalloc(use_cvdalloc_vec[instance_index]);
789791
instance.set_crosvm_use_balloon(use_balloon_vec[instance_index]);
790792
instance.set_crosvm_use_rng(use_rng_vec[instance_index]);
791793
instance.set_crosvm_simple_media_device(simple_media_device_vec[instance_index]);

base/cvd/cuttlefish/host/commands/assemble_cvd/flags_defaults.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#define CF_DEFAULTS_SETUPWIZARD_MODE "DISABLED"
5656
#define CF_DEFAULTS_SMT false
5757
#define CF_DEFAULTS_USE_ALLOCD false
58+
#define CF_DEFAULTS_USE_CVDALLOC false
5859
#define CF_DEFAULTS_USE_SDCARD true
5960
#define CF_DEFAULTS_UUID \
6061
cuttlefish::ForCurrentInstance(cuttlefish::kDefaultUuidPrefix)

base/cvd/cuttlefish/host/commands/start/main.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ const std::unordered_set<std::string>& BoolFlags() {
158158
"start_gnss_proxy",
159159
"start_webrtc",
160160
"use_allocd",
161+
"use_cvdalloc",
161162
"use_random_serial",
162163
"use_sdcard",
163164
"vhost_net",

base/cvd/cuttlefish/host/libs/config/cuttlefish_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ class CuttlefishConfig {
324324
std::string ethernet_ipv6() const;
325325
uint32_t session_id() const;
326326
bool use_allocd() const;
327+
bool use_cvdalloc() const;
327328
int vsock_guest_cid() const;
328329
std::string vsock_guest_group() const;
329330
std::string uuid() const;
@@ -673,6 +674,7 @@ class CuttlefishConfig {
673674
void set_ethernet_ipv6(const std::string& ip);
674675
void set_session_id(uint32_t session_id);
675676
void set_use_allocd(bool use_allocd);
677+
void set_use_cvdalloc(bool use_cvdalloc);
676678
void set_vsock_guest_cid(int vsock_guest_cid);
677679
void set_vsock_guest_group(const std::string& vsock_guest_group);
678680
void set_uuid(const std::string& uuid);

base/cvd/cuttlefish/host/libs/config/cuttlefish_config_instance.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,15 @@ void CuttlefishConfig::MutableInstanceSpecific::set_use_allocd(
15961596
(*Dictionary())[kUseAllocd] = use_allocd;
15971597
}
15981598

1599+
static constexpr char kUseCvdalloc[] = "use_cvdalloc";
1600+
bool CuttlefishConfig::InstanceSpecific::use_cvdalloc() const {
1601+
return (*Dictionary())[kUseCvdalloc].asBool();
1602+
}
1603+
void CuttlefishConfig::MutableInstanceSpecific::set_use_cvdalloc(
1604+
bool use_cvdalloc) {
1605+
(*Dictionary())[kUseCvdalloc] = use_cvdalloc;
1606+
}
1607+
15991608
static constexpr char kSessionId[] = "session_id";
16001609
uint32_t CuttlefishConfig::InstanceSpecific::session_id() const {
16011610
return (*Dictionary())[kSessionId].asUInt();

0 commit comments

Comments
 (0)