Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion dstack-util/src/system_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ fn emit_key_provider_info(provider_info: &KeyProviderInfo) -> Result<()> {

pub async fn cmd_sys_setup(args: SetupArgs) -> Result<()> {
let stage0 = Stage0::load(&args)?;
let vmm = stage0.host_api();
let result = do_sys_setup(stage0).await;
if let Err(err) = &result {
vmm.notify_q("boot.error", &format!("{err:#}")).await;
}
result
}

async fn do_sys_setup(stage0: Stage0<'_>) -> Result<()> {
if stage0.shared.app_compose.secure_time {
info!("Waiting for the system time to be synchronized");
cmd! {
Expand Down Expand Up @@ -585,6 +594,12 @@ struct Stage1<'a> {
}

impl<'a> Stage0<'a> {
fn host_api(&self) -> HostApi {
HostApi::new(
self.shared.sys_config.host_api_url.clone(),
self.shared.sys_config.pccs_url.clone(),
)
}
fn load(args: &'a SetupArgs) -> Result<Self> {
let host_shared_copy_dir = args.work_dir.join(HOST_SHARED_DIR_NAME);
let host_shared = HostShared::copy("/tmp/.host-shared".as_ref(), &host_shared_copy_dir)?;
Expand Down Expand Up @@ -1155,7 +1170,10 @@ impl<'a> Stage0<'a> {
self.vmm
.notify_q("boot.progress", "requesting app keys")
.await;
let app_keys = self.request_app_keys().await?;
let app_keys = self
.request_app_keys()
.await
.context("Failed to request app keys")?;
if app_keys.disk_crypt_key.is_empty() {
bail!("Failed to get valid key phrase from KMS");
}
Expand Down