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

gcs: Add SCSIDevice type with remove operation #1741

Merged
merged 1 commit into from
May 3, 2023

Conversation

kevpar
Copy link
Member

@kevpar kevpar commented Apr 23, 2023

This is commit 2/6 in a chain. Recommended to review in order. If reviewing a later PR in the chain, you can view individual commits to see just what that PR changes.

SCSI devices must be unplugged by the guest before removal on the host
side, to ensure smooth operation. Previously a SCSI device was unplugged
when a LCOWMappedVirtualDisk entry was removed. However, we want to
support multiple mounts per disk, which means we need to decouple unplug
from unmount.

This change introduces a new SCSIDevice resource type that has a remove
operation that can be used by the host to trigger an explicit unplug via
SCSI.

This is a breaking change to the bridge protocol:

  • With new host/old guest, the host will attempt a SCSIDevice remove
    which will fail due to being unsupported by the guest.
  • With old host/new guest, the host will expect the device to be
    unplugged when the disk is removed, which will no longer occur.

@katiewasnothere
Copy link
Contributor

Could you explain more about why you chose to go with this new "SCSIDevice" type? Is the goal to eventually expand that type to also handle other actions like attaching the device? Why the name "SCSIDevice"?

@kevpar
Copy link
Member Author

kevpar commented Apr 25, 2023

Could you explain more about why you chose to go with this new "SCSIDevice" type? Is the goal to eventually expand that type to also handle other actions like attaching the device? Why the name "SCSIDevice"?

SCSIDevice seemed an apt name, since the underlying action we are taking is removing a SCSI device from the guest OS (by calling scsi.UnplugDevice). I wouldn't expect this to necessarily expand to other functionality unless we found some reason to do so.

Is there another way of representing this you have in mind?

@katiewasnothere
Copy link
Contributor

Is there another way of representing this you have in mind?

Okay I spent some time investigating this and I think that I agree this is the best approach.

However, for naming, what do you think about "LCOWVirtualDisk" instead? The type that we use for mounting the SCSI device is referred to as "LCOWMappedVirtualDisk". This type is meant to represent a mounted scsi device in the guest. Following that pattern of naming, something like "LCOWVirtualDisk" could be used to indicate that this type is for dealing specifically with the virtual device itself, not a mount.

We should also make it clear that this type is not meant to be expanded at all, especially not for scsi mount features in the future.

@kevpar
Copy link
Member Author

kevpar commented Apr 25, 2023

Is there another way of representing this you have in mind?

Okay I spent some time investigating this and I think that I agree this is the best approach.

However, for naming, what do you think about "LCOWVirtualDisk" instead? The type that we use for mounting the SCSI device is referred to as "LCOWMappedVirtualDisk". This type is meant to represent a mounted scsi device in the guest. Following that pattern of naming, something like "LCOWVirtualDisk" could be used to indicate that this type is for dealing specifically with the virtual device itself, not a mount.

We should also make it clear that this type is not meant to be expanded at all, especially not for scsi mount features in the future.

I think I'd like to keep the naming as SCSIDevice. LCOWMappedVirtualDisk is a pretty bad name, even for where it's used (the guest has no idea it's a virtual disk), and in this case we could use this resource type for any sort of SCSI device removal, not just a disk.

@katiewasnothere
Copy link
Contributor

I think I'd like to keep the naming as SCSIDevice. LCOWMappedVirtualDisk is a pretty bad name, even for where it's used (the guest has no idea it's a virtual disk), and in this case we could use this resource type for any sort of SCSI device removal, not just a disk.

Seems reasonable to me, I'm fine with keeping it then. Could we still add a comment about what it should and should not be used for?

@kevpar
Copy link
Member Author

kevpar commented Apr 25, 2023

I think I'd like to keep the naming as SCSIDevice. LCOWMappedVirtualDisk is a pretty bad name, even for where it's used (the guest has no idea it's a virtual disk), and in this case we could use this resource type for any sort of SCSI device removal, not just a disk.

Seems reasonable to me, I'm fine with keeping it then. Could we still add a comment about what it should and should not be used for?

Sure, but can you let me know what you feel is missing from this comment?

// ResourceTypeSCSIDevice is the modify resources type for SCSI devices.
// Currently it only supports Remove, to cleanly remove a SCSI device.

@katiewasnothere
Copy link
Contributor

// ResourceTypeSCSIDevice is the modify resources type for SCSI devices.
// Currently it only supports Remove, to cleanly remove a SCSI device.

We have a lot of terms that we overload throughout, so I think it would be best to make it explicit that this should not be used for management of a scsi mount.

Copy link
Contributor

@katiewasnothere katiewasnothere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just the small comment otherwise lgtm

@kevpar
Copy link
Member Author

kevpar commented Apr 26, 2023

// ResourceTypeSCSIDevice is the modify resources type for SCSI devices.
// Currently it only supports Remove, to cleanly remove a SCSI device.

We have a lot of terms that we overload throughout, so I think it would be best to make it explicit that this should not be used for management of a scsi mount.

I've improved the comment.

SCSI devices must be unplugged by the guest before removal on the host
side, to ensure smooth operation. Previously a SCSI device was unplugged
when a LCOWMappedVirtualDisk entry was removed. However, we want to
support multiple mounts per disk, which means we need to decouple unplug
from unmount.

This change introduces a new SCSIDevice resource type that has a remove
operation that can be used by the host to trigger an explicit unplug via
SCSI.

This is a breaking change to the bridge protocol:
- With new host/old guest, the host will attempt a SCSIDevice remove
  which will fail due to being unsupported by the guest.
- With old host/new guest, the host will expect the device to be
  unplugged when the disk is removed, which will no longer occur.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
@kevpar
Copy link
Member Author

kevpar commented May 3, 2023

CI failures are not related.

@kevpar kevpar merged commit d446b24 into microsoft:main May 3, 2023
14 of 16 checks passed
anmaxvl pushed a commit that referenced this pull request Oct 20, 2023
This PR updates our ADO fork to commits in hcsshim up to commit hash [7769a64](7769a64). This includes support for partitioned scsi devices and ensuring filesystem format for lcow scsi devices.

Related work items: #1728, #1740, #1741, #1742, #1743, #1744, #1745, #1747, #1748, #1749, #1750, #1752, #1754, #1756, #1757, #1767, #1769, #1771, #1772, #1773, #1779
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants