Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ tokio = { version = "1.46.1" }
tokio-vsock = "0.7.0"
sysinfo = "0.35.2"
default-net = "0.22.0"
url = "2.5"

# Cryptography/Security
aes-gcm = "0.10.3"
Expand Down
1 change: 1 addition & 0 deletions vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ size-parser = { workspace = true, features = ["serde"] }
fatfs.workspace = true
fscommon.workspace = true
or-panic.workspace = true
url.workspace = true

[dev-dependencies]
insta.workspace = true
Expand Down
25 changes: 19 additions & 6 deletions vmm/src/app/qemu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ fn create_shared_disk(disk_path: impl AsRef<Path>, shared_dir: impl AsRef<Path>)
impl VmInfo {
pub fn to_pb(&self, gw: &GatewayConfig, brief: bool) -> pb::VmInfo {
let workdir = VmWorkDir::new(&self.workdir);
let vm_config = workdir.manifest();
let custom_gateway_urls = vm_config
.as_ref()
.map(|c| c.gateway_urls.clone())
.unwrap_or_default();
pb::VmInfo {
id: self.manifest.id.clone(),
name: self.manifest.name.clone(),
Expand All @@ -174,15 +179,10 @@ impl VmInfo {
configuration: if brief {
None
} else {
let vm_config = workdir.manifest();
let kms_urls = vm_config
.as_ref()
.map(|c| c.kms_urls.clone())
.unwrap_or_default();
let gateway_urls = vm_config
.as_ref()
.map(|c| c.gateway_urls.clone())
.unwrap_or_default();
let no_tee = vm_config
.as_ref()
.map(|c| c.no_tee)
Expand Down Expand Up @@ -227,7 +227,7 @@ impl VmInfo {
.collect(),
}),
kms_urls,
gateway_urls,
gateway_urls: custom_gateway_urls.clone(),
stopped,
no_tee,
})
Expand All @@ -237,6 +237,19 @@ impl VmInfo {
.then_some(self.instance_id.as_ref())
.flatten()
.map(|id| {
// Use custom gateway URL if available, otherwise fall back to global config
if let Some(custom_gw_url) = custom_gateway_urls.first() {
if let Ok(url) = url::Url::parse(custom_gw_url) {
let host = url.host_str().unwrap_or(&gw.base_domain);
let port = url.port().unwrap_or(443);
if port == 443 {
return format!("https://{id}-{}.{}", gw.agent_port, host);
} else {
return format!("https://{id}-{}.{}:{}", gw.agent_port, host, port);
}
}
}
// Fall back to global gateway config
if gw.port == 443 {
format!("https://{id}-{}.{}", gw.agent_port, gw.base_domain)
} else {
Expand Down