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

Support retrieving the VM UUID on Windows #71147

Merged
merged 1 commit into from Feb 16, 2019

Conversation

@benmoss
Copy link
Member

commented Nov 16, 2018

What type of PR is this?
/kind feature

What this PR does / why we need it:
Adds support to the vSphere cloud provider for retrieving a VM's UUID when running on Windows.

Special notes for your reviewer:
On linux VMs, there is a file with the UUID in it. On windows, this file does not exist, so we use the wmic CLI tool to get the same value.

$ wmic csproduct get UUID
UUID
5EE03942-CFD7-FE7D-A250-65899E639441

Does this PR introduce a user-facing change?:

vSphere cloud provider correctly retrieves the VM's UUID when running on Windows
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Nov 16, 2018

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@benmoss

This comment has been minimized.

Copy link
Member Author

commented Nov 16, 2018

/sig windows

@benmoss

This comment has been minimized.

Copy link
Member Author

commented Nov 16, 2018

/sig vmware

@benmoss

This comment has been minimized.

Copy link
Member Author

commented Nov 16, 2018

/check-cla

@astrieanna astrieanna force-pushed the pivotal-k8s:vsphere-windows-uuid branch from 3073cae to 51b70d6 Nov 16, 2018
@benmoss

This comment has been minimized.

Copy link
Member Author

commented Nov 16, 2018

/retest

@neolit123

This comment has been minimized.

Copy link
Member

commented Nov 17, 2018

thank you for this PR @benmoss
commits should be probably squashed.

/retest
/priority important-longterm

Copy link
Member

left a comment

the wmic csproduct get UUID usage SGTM 👍

Signed-off-by: Ben Moss <bmoss@pivotal.io>
@benmoss benmoss force-pushed the pivotal-k8s:vsphere-windows-uuid branch from 51b70d6 to 255f056 Nov 17, 2018
@benmoss

This comment has been minimized.

Copy link
Member Author

commented Nov 17, 2018

@neolit123 squashed as you requested

@astrieanna

This comment has been minimized.

Copy link
Contributor

commented Dec 19, 2018

@neolit123 what needs to happen for this to get merged?

@neolit123

This comment has been minimized.

Copy link
Member

commented Dec 19, 2018

/assign @SandeepPissay

the project is fairly low activity before xmas and ny.
if the assigned reviewers and approvers do not respond try pinging them on slack at #sig-vmware and/or #sig-cloud-provider

@PatrickLang PatrickLang moved this from Backlog to In Review in SIG-Windows Jan 11, 2019
@benmoss

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2019

@SandeepPissay yup, as far as we've understood the functionality everything seems to work with this.

@PatrickLang

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

cc @michmike can you take a look?

@neolit123

This comment has been minimized.

Copy link
Member

commented Feb 14, 2019

/assign @frapposelli @dougm

hi, can you please take a look for approval here too?
the UUID logic on Windows looks sane.

@frapposelli

This comment has been minimized.

Copy link
Member

commented Feb 15, 2019

The approach is sane, I don't have the necessary Windows knowledge to validate the UUID retrieval method but

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Feb 15, 2019
Copy link
Member

left a comment

/lgtm

@dvonthenen may want to review too. We should also open an issue for porting this to the external vSphere CCM.

@dvonthenen

This comment has been minimized.

Copy link
Member

commented Feb 15, 2019

/lgtm

@dvonthenen may want to review too. We should also open an issue for porting this to the external vSphere CCM.

@dougm We use the UUID reported by the kubelet. If the kubelet populates the SystemUUID property correctly, this should automatically work for Windows systems without any code changes.

@frapposelli

This comment has been minimized.

Copy link
Member

commented Feb 15, 2019

/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Feb 15, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benmoss, frapposelli

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@astrieanna astrieanna referenced this pull request Feb 15, 2019
6 of 6 tasks complete
@benmoss

This comment has been minimized.

Copy link
Member Author

commented Feb 15, 2019

/retest

@k8s-ci-robot k8s-ci-robot merged commit e4db147 into kubernetes:master Feb 16, 2019
20 checks passed
20 checks passed
cla/linuxfoundation astrieanna authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Skipped
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Context retired without replacement.
pull-kubernetes-e2e-kubeadm-gce Skipped
pull-kubernetes-godeps Skipped
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped
pull-kubernetes-local-e2e-containerized Skipped
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped
tide In merge pool.
Details
SIG-Windows automation moved this from In Review to Done (v.1.14) Feb 16, 2019
@benmoss benmoss deleted the pivotal-k8s:vsphere-windows-uuid branch Feb 16, 2019
@rhockenbury

This comment has been minimized.

Copy link

commented Feb 28, 2019

Having trouble getting windows nodes to find vm id with 1.14 beta.1:

E0228 18:07:38.491060    4324 datacenter.go:78] Unable to find VM by UUID. VM UUID: a7ff1742-06d1-549d-712b-193a270b7917
E0228 18:07:38.491060    4324 vsphere.go:1467] Cannot find VM runtime host. Get zone for node ul-win-node-5k error
E0228 18:07:38.491060    4324 kubelet_node_status.go:68] Unable to construct v1.Node object for kubelet: failed to get zone from cloud provider: No VM found

On linux, the /sys/class/dmi/id/product_serial file is used, which contains an id with a VMware prefix:

$ cat /sys/class/dmi/id/product_serial
VMware-42 17 76 c6 8e 65 8a 09-28 e9 1b 55 34 fa b9 76

To return the equivalent form on Windows, it looks like the following can be used:

$ wmic bios get serialnumber
SerialNumber
VMware-42 17 ff a7 d1 06 9d 54-71 2b 19 3a 27 0b 79 17

or

wmic csproduct get identifyingnumber
IdentifyingNumber
VMware-42 17 ff a7 d1 06 9d 54-71 2b 19 3a 27 0b 79 17

BUT the current implementation uses wmic csproduct get uuid which returns:

UUID
A7FF1742-06D1-549D-712B-193A270B7917

So is wmic csproduct get uuid the correct logic?

It appears the logic was correct at the time of opening the PR. However, in light of the change on the linux side from /sys/class/dmi/id/product_uuid to /sys/class/dmi/id/product_serial as implemented in #59519, the logic used on the windows side needs to be modified.

@rhockenbury

This comment has been minimized.

Copy link

commented Mar 1, 2019

/lgtm
@dvonthenen may want to review too. We should also open an issue for porting this to the external vSphere CCM.

@dougm We use the UUID reported by the kubelet. If the kubelet populates the SystemUUID property correctly, this should automatically work for Windows systems without any code changes.

On windows, the systemUUID does not currently get populated because of how cadvisor discovers it (https://github.com/google/cadvisor/blob/master/utils/sysfs/sysfs.go#L237).

@dvonthenen

This comment has been minimized.

Copy link
Member

commented Mar 4, 2019

@rhockenbury Yes, the wmic csproduct get uuid is the correct implementation. The in-tree vSphere cloud provider code populates the UUID using that command. Please see below:
https://github.com/kubernetes/kubernetes/blob/master/pkg/cloudprovider/providers/vsphere/vsphere_util_windows.go#L28

@rhockenbury

This comment has been minimized.

Copy link

commented Mar 4, 2019

Yes, but this makes the assumption that the uuid and serial are the same, which is only true on some vm versions. vmware#450 (comment), vmware#450 (comment)

@benmoss

This comment has been minimized.

Copy link
Member Author

commented Mar 4, 2019

Agreed, from what I remember of why I chose get uuid it was just because it required less formatting than the serial. I wasn't aware that there were instances where they disagreed. Do you want to submit a PR @rhockenbury?

@rhockenbury

This comment has been minimized.

Copy link

commented Mar 4, 2019

I don't have an environment set up where I could get a PR out quickly. Possibly by end of week, so if someone else is able and willing to get to it sooner, please go for it. Would this need to be in by code freeze (3/7) to make it into the 1.14 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.