1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mod vmm_launcher;
use {
anyhow::Context,
fidl::endpoints::ServerEnd,
fidl_fuchsia_component::RealmMarker,
fidl_fuchsia_virtualization::GuestLifecycleMarker,
fuchsia_component::{client, server},
vmm_launcher_config::Config,
};
#[fuchsia::main(logging = true, threads = 1)]
async fn main() -> Result<(), anyhow::Error> {
let mut fs = server::ServiceFs::new();
fs.dir("svc").add_service_connector(|server_end: ServerEnd<GuestLifecycleMarker>| server_end);
fs.take_and_serve_directory_handle().context("Error starting server")?;
let config = Config::take_from_startup_handle();
let realm_proxy = client::connect_to_protocol::<RealmMarker>()
.context("Error connecting to Realm protocol")?;
let mut launcher =
crate::vmm_launcher::VmmLauncher::new(config.vmm_component_url.to_string(), realm_proxy);
launcher.run(fs).await;
Ok(())
}