mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Unix socket backend for serial port
Cloud-Hypervisor takes a path for Unix socket, where it will listen
on. Users can connect to the other end of the socket and access serial
port on the guest.
"--serial socket=/path/to/socket" is the cmdline option to pass to
cloud-hypervisor.
Users can use socat like below to access guest's serial port once the
guest starts to boot:
socat -,crnl UNIX-CONNECT:/path/to/socket
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
399c596af8
commit
6d1077fc3c
@@ -395,6 +395,9 @@ pub enum DeviceManagerError {
|
||||
/// No support for device passthrough
|
||||
NoDevicePassthroughSupport,
|
||||
|
||||
/// No socket option support for console device
|
||||
NoSocketOptionSupportForConsoleDevice,
|
||||
|
||||
/// Failed to resize virtio-balloon
|
||||
VirtioBalloonResize(virtio_devices::balloon::Error),
|
||||
|
||||
@@ -1995,6 +1998,9 @@ impl DeviceManager {
|
||||
Endpoint::File(stdout)
|
||||
}
|
||||
}
|
||||
ConsoleOutputMode::Socket => {
|
||||
return Err(DeviceManagerError::NoSocketOptionSupportForConsoleDevice);
|
||||
}
|
||||
ConsoleOutputMode::Null => Endpoint::Null,
|
||||
ConsoleOutputMode::Off => return Ok(None),
|
||||
};
|
||||
@@ -2074,15 +2080,19 @@ impl DeviceManager {
|
||||
let _ = self.set_raw_mode(&out);
|
||||
Some(Box::new(out))
|
||||
}
|
||||
ConsoleOutputMode::Off | ConsoleOutputMode::Null => None,
|
||||
ConsoleOutputMode::Off | ConsoleOutputMode::Null | ConsoleOutputMode::Socket => None,
|
||||
};
|
||||
if serial_config.mode != ConsoleOutputMode::Off {
|
||||
let serial = self.add_serial_device(interrupt_manager, serial_writer)?;
|
||||
self.serial_manager = match serial_config.mode {
|
||||
ConsoleOutputMode::Pty | ConsoleOutputMode::Tty => {
|
||||
let serial_manager =
|
||||
SerialManager::new(serial, self.serial_pty.clone(), serial_config.mode)
|
||||
.map_err(DeviceManagerError::CreateSerialManager)?;
|
||||
ConsoleOutputMode::Pty | ConsoleOutputMode::Tty | ConsoleOutputMode::Socket => {
|
||||
let serial_manager = SerialManager::new(
|
||||
serial,
|
||||
self.serial_pty.clone(),
|
||||
serial_config.mode,
|
||||
serial_config.socket,
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateSerialManager)?;
|
||||
if let Some(mut serial_manager) = serial_manager {
|
||||
serial_manager
|
||||
.start_thread(
|
||||
|
||||
Reference in New Issue
Block a user