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

Method new

vmm/src/migration_transport.rs:264–287  ·  view source on GitHub ↗

Starts a thread to accept incoming connections and handle them. These additional connections are used to receive additional memory regions during VM migration.

(
        listener: ReceiveListener,
        guest_memory: GuestMemoryAtomic<GuestMemoryMmap>,
    )

Source from the content-addressed store, hash-verified

262 /// additional connections are used to receive additional memory regions
263 /// during VM migration.
264 pub(crate) fn new(
265 listener: ReceiveListener,
266 guest_memory: GuestMemoryAtomic<GuestMemoryMmap>,
267 ) -> Result<Self, MigratableError> {
268 let event_fd = EventFd::new(0)
269 .context("Error creating terminate fd")
270 .map_err(MigratableError::MigrateReceive)?;
271
272 let terminate_fd = event_fd
273 .try_clone()
274 .context("Error cloning terminate fd")
275 .map_err(MigratableError::MigrateReceive)?;
276
277 let accept_thread = thread::Builder::new()
278 .name("migrate-receive-accept-connections".to_owned())
279 .spawn(move || Self::accept_connections(listener, &terminate_fd, &guest_memory))
280 .context("Error creating connection accept thread")
281 .map_err(MigratableError::MigrateReceive)?;
282
283 Ok(Self {
284 accept_thread: Some(accept_thread),
285 terminate_fd: event_fd,
286 })
287 }
288
289 fn accept_connections(
290 mut listener: ReceiveListener,

Callers

nothing calls this directly

Calls 11

newFunction · 0.85
send_migration_socketFunction · 0.85
contextMethod · 0.80
spawnMethod · 0.80
okMethod · 0.80
try_cloneMethod · 0.45
getMethod · 0.45
cloneMethod · 0.45
lenMethod · 0.45
sendMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected