mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
virtio-devices: vhost_user: Kill threads upon migration completion
In order to prevent the vhost-user devices from reconnecting to the backend after the migration has been successfully performed, we make sure to kill the thread in charge of handling the reconnection mechanism. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
5a83ebce64
commit
c85aa6dfae
@ -483,4 +483,23 @@ impl Migratable for Blk {
|
||||
Ok(MemoryRangeTable::default())
|
||||
}
|
||||
}
|
||||
|
||||
fn complete_migration(&mut self) -> std::result::Result<(), MigratableError> {
|
||||
// Make sure the device thread is killed in order to prevent from
|
||||
// reconnections to the socket.
|
||||
if let Some(kill_evt) = self.common.kill_evt.take() {
|
||||
kill_evt.write(1).map_err(|e| {
|
||||
MigratableError::CompleteMigration(anyhow!(
|
||||
"Error killing vhost-user-blk thread: {:?}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
}
|
||||
|
||||
// Drop the vhost-user handler to avoid further calls to fail because
|
||||
// the connection with the backend has been closed.
|
||||
self.vu = None;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -763,4 +763,23 @@ impl Migratable for Fs {
|
||||
Ok(MemoryRangeTable::default())
|
||||
}
|
||||
}
|
||||
|
||||
fn complete_migration(&mut self) -> std::result::Result<(), MigratableError> {
|
||||
// Make sure the device thread is killed in order to prevent from
|
||||
// reconnections to the socket.
|
||||
if let Some(kill_evt) = self.common.kill_evt.take() {
|
||||
kill_evt.write(1).map_err(|e| {
|
||||
MigratableError::CompleteMigration(anyhow!(
|
||||
"Error killing vhost-user-fs threads: {:?}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
}
|
||||
|
||||
// Drop the vhost-user handler to avoid further calls to fail because
|
||||
// the connection with the backend has been closed.
|
||||
self.vu = None;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -569,4 +569,23 @@ impl Migratable for Net {
|
||||
Ok(MemoryRangeTable::default())
|
||||
}
|
||||
}
|
||||
|
||||
fn complete_migration(&mut self) -> std::result::Result<(), MigratableError> {
|
||||
// Make sure the device thread is killed in order to prevent from
|
||||
// reconnections to the socket.
|
||||
if let Some(kill_evt) = self.common.kill_evt.take() {
|
||||
kill_evt.write(1).map_err(|e| {
|
||||
MigratableError::CompleteMigration(anyhow!(
|
||||
"Error killing vhost-user-net threads: {:?}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
}
|
||||
|
||||
// Drop the vhost-user handler to avoid further calls to fail because
|
||||
// the connection with the backend has been closed.
|
||||
self.vu = None;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user