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

Remove dependence on GetScsiUvmPath function #1742

Merged
merged 2 commits into from
May 4, 2023

Commits on May 3, 2023

  1. Remove dependency on GetScsiUvmPath from driver installation

    Currently, when installing drivers on LCOW, we use GetScsiUvmPath to
    check if the VHD is already mounted, and if it is, we assume the drivers
    have already been installed, so we can skip doing it again. This check
    has a few problems:
    
    - It relies on GetScsiUvmPath, which assumes a single mount-point in the
      guest for a given VHD. This assumption is not safe to make in the face
      of future changes, where we could mount a device (or partitions on it)
      multiple times.
    - It assumes the disk has stayed attached the whole time after drivers
      were installed. This may be a safe assumption today, but can be
      fragile in the future.
    - It does not work in the case of a VHD containing multiple sets of
      drivers, or a VHD being changed/updated to newer content after first
      install. Again, this is safe given the current overall design today,
      but could break in the future.
    
    This change is still mostly a bandaid fix. Probably what is most correct
    is to track driver installation in something with state (the GCS) rather
    than using a separately invoked binary to do the in-guest install.
    However, this change does address the first issue above, removing the
    dependency on GetScsiUvmPath. I do this in the following way:
    
    - Change install-drivers to check if the overlay path exists already,
      and exit with a no-op if it does. This encodes the assumption that the
      overlay path will be consistent for a given driver set.
    - Change InstallDrivers in the shim to compute a V5 GUID from the VHD
      path, and use that as part of the overlay path given to the guest.
      This ensures there is a unique guest overlay path for each unique host
      driver VHD path.
    
    Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
    kevpar committed May 3, 2023
    Configuration menu
    Copy the full SHA
    d429483 View commit details
    Browse the repository at this point in the history
  2. Remove dependency on GetScsiUvmPath from WCOW-isolated mounts

    The WCOW-isolated SCSI mount process currently works as follows:
    - In resources_wcow.go, go through each mount on the OCI spec, and if it
      is a SCSI mount, add a mount to the UVM for it.
    - in hcsdoc_wcow.go, go through each mount on the OCI spec, use
      GetScsiUvmPath to determine the guest path it was mounted to, and add
      an entry to the container doc for it.
    
    This is quite hacky, as it relies on a 1:1 mapping between host VHDs and
    mounts in the guest, and also because it requires us to re-query
    information we've already been given. The SCSIMount object returned when
    we mounted to the guest can already tell us the guest path.
    
    This change resolves this problem by instead determing the set of guest
    mounts that should be added to the container doc at the time when the
    SCSI mounts are done, and saving it in the creation options. Then, when
    we construct the actual container doc, we just grab those mounts and add
    them in.
    
    Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
    kevpar committed May 3, 2023
    Configuration menu
    Copy the full SHA
    1dd217b View commit details
    Browse the repository at this point in the history