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

Disk: Inexact UniqueID matching #247

Open
bozho opened this issue Oct 1, 2020 · 6 comments
Open

Disk: Inexact UniqueID matching #247

bozho opened this issue Oct 1, 2020 · 6 comments
Labels
enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone.

Comments

@bozho
Copy link

bozho commented Oct 1, 2020

Details of the scenario you tried and the problem that is occurring

It seems that as of recently, AWS doesn't guarantee disk ordering in Windows VMs. Previously, the order was controlled by volume device names (xvd[a-z]) and was stable across VM reboots.

Not having stable disk ordering makes disk initialisation and drive letter assignment impossible.

AWS does map EBS volume ID to UniqueId disk property. UniqueId is formatted as:
<volume id without the dash>0001Amazon Elastic Block Store 1D0F

This allows us to use Unique ID to initialise disks and assign drive letters. However, it is unknown how stable ID format is going to be in the future, but it is safe to assume it will always reference EBS volume ID in some form.

Suggested solution to the issue

Introduce an additional DiskIdType: UniqueIdPattern, which would allow pattern matching for disk serial numbers. The resource would throw an error in case of multiple matches.

Happy to implement and submit a PR.

@PlagueHO PlagueHO added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Oct 1, 2020
@PlagueHO
Copy link
Member

PlagueHO commented Oct 1, 2020

Hi @bozho,

Do you have an example of how the resource configuration would look using this? E.g.

Disk AWSDisk {
    DiskIdType = 'UniqueIdPattern'
    DiskId = .....
}

@bozho
Copy link
Author

bozho commented Oct 2, 2020

Ah, yes. Apologies - was writing this up yesterday after losing the entire day trying to work around the problem :-)

A sample resource configuration would look something like:

Disk AWSDisk {
    DiskIdType = 'UniqueIdPattern'
    DiskId = 'vol0fcccef34ab4dff0a.*'
    DriveLetter = 'G'
}

I think it makes sense to use regex pattern matching here. I have a limited number of machines to test, but UniqueId disk property string seems to always contain disk serial number in certain format (for physical disks). For example, on my laptop (Win 10 Pro), both disks' UniqueId is in the format eui.<serial number>.

At the moment, I only have access to AWS and Proxmox VMs and both of them format UniqueId to correlate to storage volumes (Proxmox's UniqueId string contains disk number and VM name). I think it would make sense to assume that hypervisors/cloud providers will have some sort of correlation between a volume and VM's disk UniqueId

@PlagueHO
Copy link
Member

PlagueHO commented Oct 2, 2020

Cool - yep, I think this looks possible. We might need to get the resource to stop though if the RegEx returns more than one disk. Either with a Warning or most likely we'd want an error here.

@bozho
Copy link
Author

bozho commented Oct 5, 2020

I was thinking an error. I'll get on implementing this, hopefully some time during this week.

@PlagueHO
Copy link
Member

PlagueHO commented Oct 6, 2020

Cool - thanks @bozho . I'll mark it as In Progress.

@PlagueHO PlagueHO added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Oct 6, 2020
@ianwalkeruk
Copy link

Hi @bozho

Have you tried using the DiskIdType of Location? I added that last year after having a similar problem with Windows VMs in Azure?

I don't want to stop you from implementing a nice pattern matching type as well, just curious if you've got the time to test the Location type on AWS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

No branches or pull requests

3 participants