MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / vm_action

Method vm_action

vmm/src/api/dbus/mod.rs:92–108  ·  view source on GitHub ↗
(
        &self,
        action: &'static Action,
        body: Action::RequestBody,
    )

Source from the content-addressed store, hash-verified

90 }
91
92 async fn vm_action<Action: ApiAction<ResponseBody = Option<Body>>>(
93 &self,
94 action: &'static Action,
95 body: Action::RequestBody,
96 ) -> Result<Optional<String>> {
97 let api_sender = self.clone_api_sender().await;
98 let api_notifier = self.clone_api_notifier()?;
99
100 let result = blocking::unblock(move || action.send(api_notifier, api_sender, body))
101 .await
102 .map_err(api_error)?
103 // We're using `from_utf8_lossy` here to not deal with the
104 // error case of `from_utf8` as we know that `b.body` is valid JSON.
105 .map(|b| String::from_utf8_lossy(&b.body).to_string());
106
107 Ok(result.into())
108 }
109}
110
111#[interface(name = "org.cloudhypervisor.DBusApi1")]

Callers 15

vm_add_deviceMethod · 0.80
vm_add_diskMethod · 0.80
vm_add_fsMethod · 0.80
vm_add_netMethod · 0.80
vm_add_pmemMethod · 0.80
vm_add_user_deviceMethod · 0.80
vm_add_vdpaMethod · 0.80
vm_add_vsockMethod · 0.80
vm_bootMethod · 0.80
vm_coredumpMethod · 0.80
vm_countersMethod · 0.80

Calls 4

clone_api_senderMethod · 0.80
clone_api_notifierMethod · 0.80
mapMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected