vmm: do not start signal thread to resize console if no need

Now cloud hypervisor will start signal thread to catch
SIGWINCH signal, cloud hypervisor then will resize the
guest console via vconsole.

This patch skip starting signal thread when there is no
need to resize guest console, such as console is not
configured.

Signed-off-by: Yong He <alexyonghe@tencent.com>
This commit is contained in:
Yong He 2023-02-27 20:07:07 +08:00 committed by Bo Chen
parent 5132e3b907
commit 76d6d28f3e
2 changed files with 13 additions and 0 deletions

View File

@ -530,6 +530,14 @@ pub struct Console {
}
impl Console {
pub fn need_resize(&self) -> bool {
if let Some(_resizer) = self.console_resizer.as_ref() {
return true;
}
false
}
pub fn update_console_size(&self) {
if let Some(resizer) = self.console_resizer.as_ref() {
resizer.update_console_size()

View File

@ -1943,6 +1943,11 @@ impl Vm {
fn setup_signal_handler(&mut self) -> Result<()> {
let console = self.device_manager.lock().unwrap().console().clone();
let signals = Signals::new(Vm::HANDLED_SIGNALS);
if !console.need_resize() {
return Ok(());
}
match signals {
Ok(signals) => {
self.signals = Some(signals.handle());