-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Fetch VM UUID from - /sys/class/dmi/id/product_serial #45311
Fetch VM UUID from - /sys/class/dmi/id/product_serial #45311
Conversation
Hi @divyenpatel. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with 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. |
|
||
// check the uuid starts with "VMware-" | ||
if !strings.HasPrefix(uuidstr, UUIDPrefix) { | ||
return "", fmt.Errorf("cannot find this VM's UUID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about recording the uuidstr
in error info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added uuid in the error.
return "", fmt.Errorf("Failed to match Prefix, UUID read from the file is %v", uuidFromFile)
uuidstr = strings.Replace(uuidstr[len(UUIDPrefix):(len(uuidstr)-1)], " ", "", -1) | ||
|
||
// need to add dashes, e.g. "564d395e-d807-e18a-cb25-b79f65eb2b9f" | ||
uuidstr = fmt.Sprintf("%s-%s-%s-%s", uuidstr[0:8], uuidstr[8:12], uuidstr[12:21], uuidstr[21:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate the length of uuidstr
in case it's shorter than expected by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verified length
if len(uuid) != 32 {
return "", fmt.Errorf("Length check failed, UUID read from the file is %v", uuidFromFile)
}
@k8s-bot ok to test |
ce2aa81
to
e086d0a
Compare
e086d0a
to
6886d69
Compare
@k8s-bot gce etcd3 e2e test this |
1 similar comment
@k8s-bot gce etcd3 e2e test this |
@dims all tests passed. Can you help merging this change to master? |
/assign @luomiao |
/approve |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, divyenpatel, luomiao
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 41903, 45311, 45474, 45472, 45501) |
…45311-kubernetes-release-1.6 Automatic merge from submit-queue Automated cherry pick of #45311 #43545 upstream release 1.6 Cherry pick of #45311 #43545 on release-1.6. #45311: Fetch VM UUID from - /sys/class/dmi/id/product_serial #43545: Remove credentials on worker nodes for vSphere cloud provider. @luomiao @BaluDontu @abrarshivani @tusharnt
What this PR does / why we need it:
Current code fetch VM uuid using uuid reported at
'/sys/devices/virtual/dmi/id/product_uuid'.
This doesn't work with all the distros like Ubuntu 16.04 and Fedora.updating code to fetch VM uuid from
/sys/class/dmi/id/product_serial
Which issue this PR fixes
fixes #
Special notes for your reviewer:
Verified UUID is matching with VM UUID on ubuntu 16.04, Cent OS 7.3 , and Photon OS
@BaluDontu @tusharnt
Release note: