Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmm: pre-create console devices #6403

Merged
merged 10 commits into from
Jun 12, 2024

Commits on Jun 11, 2024

  1. vmm: Introduce console_devices module

    Introduce ConsoleInfo struct. This struct will be used to store FDs of
    console devices created in pre_create_console_devices and passed to
    vm_boot.
    
    Move set_raw_mode, create_pty methods to console_devices.rs to
    consolidate console management methods into a single module.
    
    Lastly, copy the logic to create and configure console devices into
    pre_create_console_devices method.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    f1352d1 View commit details
    Browse the repository at this point in the history
  2. vmm: move listen_for_sigwinch_on_tty method

    Move listen_for_sigwinch_on_tty to sigwinch_listener.rs module.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    ef8c9cd View commit details
    Browse the repository at this point in the history
  3. vmm: save console_resize_pipe info to Vmm

    With this change all the information to manage console devices is now
    available within Vmm Object.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    e71b7e5 View commit details
    Browse the repository at this point in the history
  4. vmm: populate console_info during vm actions

    Use pre_create_console_devices method to create and populate console
    device FDs into console_info in Vmm Object.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    bcd189a View commit details
    Browse the repository at this point in the history
  5. vmm: refactor DeviceManager to use console_info

    While adding console devices, DeviceManager will now use the FDs in
    console_info instead of creating them.
    
    To reduce the size of this commit, I marked some variables are unused
    with '_' prefix. All those variables are cleaned up in next commit.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    8502094 View commit details
    Browse the repository at this point in the history
  6. vmm: cleanup legacy console device management

    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    8636496 View commit details
    Browse the repository at this point in the history
  7. vmm: dup serial fds to preserve them across reboots

    During vm_shutdown or vm_snapshot, all the console devices will be
    closed. When this happens stdout (FD #2) will also be closed as the
    console device using these FD is closed. If the VM were to be started
    later, FD#2 can be assigned to a different file. But
    pre_create_console_devices looks for FD#2 while opening tty device,
    which could point to any file.
    
    To avoid this problem, the STDOUT FD is duplicated when being
    assigned to a console device. Even if the console devices were to be
    closed, the duplicated FD will be closed and FD#2 will continue to
    point to STDOUT.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    8943326 View commit details
    Browse the repository at this point in the history
  8. vmm: fix a typo in ioctl name

    Rename TIOCGTPEER ioctl to it proper name:TIOCGPTPEER.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    d6b9411 View commit details
    Browse the repository at this point in the history
  9. vmm: Fix console dev handling in live migration

    Console devices are created after vm_config is received and the created
    devices are passed Vm during vm_receive_state.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    c3bab9a View commit details
    Browse the repository at this point in the history
  10. vmm: Use cloned fd to check if dev is a tty

    While checking if the console device is a tty use the cloned fd instead
    of libc::STDOUT_FILENO.
    
    Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
    praveen-pk committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    ddb67e5 View commit details
    Browse the repository at this point in the history