-
Notifications
You must be signed in to change notification settings - Fork 42.1k
Mark volume as detached when node does not exist for vsphere #50281
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
Mark volume as detached when node does not exist for vsphere #50281
Conversation
|
Hi @FengyunPan. 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 I understand the commands that are listed here. DetailsInstructions 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. |
|
/assign @luomiao |
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.
During host failover when node VM goes to disconnected state or is not accessible for any reason we are returning a Map of volumepath and its attachment status set to false. This will be misinterpreted as disks are already detached from the node and Kubernetes mark volumes as detached after orphaned pod is cleaned up.
This can causes volumes to remain attached to previous node, and new pod creation on another node will remains in the “containercreating” state. Since both the node vms are powered on and hot volumes can not be attached to other node.
We need to test this PR change for vSphere HA failover.
@BaluDontu @luomiao @tusharnt @rohitjogvmw
|
@FengyunPan Thanks for coming up this PR regarding to the detached volumes. Edit: |
|
@luomiao Could you confirm that when a node is deleted, will the volume be detached automatically? For all other cloud providers such as GCE PD, AWS, that is the behavior. So the function DiskIsAttached() in cloud provider should return false (not attached) without error. |
|
@jingxu97 I feel there are two different issues are mixed here :) but the short answer is no, volumes are not detached automatically. What @FengyunPan 's PR has changed is not when the node is deleted. Instead, it's when the node is powered off but still exists in vCenter. In this case, volumes are still attached to the VM. Thus we cannot simply return false (means disk is not attached). The variable and function names are misleading here. Instead of nodeExist, it should be nodeActive. Regarding to your question, it also depends on how you define "deleting".
@divyenpatel would you please confirm if the above understanding is correct or not? |
|
@luomiao By "deleted" I mean deleted from vCenter, similar to the case of node instance is deleted from cloud provider. The code nodeExist, err := vs.NodeExists(nodeName) what does it mean? I thought it means the node is deleted from vcenter already? |
|
@jingxu97 |
|
@jingxu97 |
|
Is there a way to identify whether the node is deleted from vsphere cloud provider. If no, could we add one? |
I see, @luomiao thank for your comments.
I think it is necessary for attachDetachManager, we should add one. |
2d9952a to
0f1a34e
Compare
e0a4030 to
4b0fca1
Compare
|
@FengyunPan @jingxu97 We will submit another PR to fix NodeExists (NodeActive) function to return InstanceNotFound error when a node is not existing anymore. /lgtm |
|
/ok-to-test |
|
@luomiao should we wait until your fix is merged to merge this PR? Thanks! |
|
@luomiao @divyenpatel @jingxu97 I have add codes to check if node exists and rebase the PR ( #49164), Please take a look. |
48a5c58 to
05a748b
Compare
|
/retest |
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.
Not related to the change made in the PR, but just came across this unwanted code block.
I think this is not required.
if vmMoList[0].Summary.Config.Template == false {
glog.Warningf("VM is not in %s state", ActivePowerState)
} else {
glog.Warningf("VM is a template")
}
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.
I think this change of Exists() is helpful for reader, is right?
Yeah, that is not required.
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.
Yes IsActive is helpful for reader.
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.
Returned error should be different. When the Node VM is powered off, we can still determine whether disks are attached to powered off VM or not. Current error message does not look good in this case.
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.
Yes, I agree, there is no need to determine wherher node is powered off in DisksAreAttached() and DisksisAttached().
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.
Same as commented for DisksAreAttached. When node VM is powered off, we can still check if disks are attached to the Node VM, and return actual state of the disk.
divyenpatel
left a comment
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.
Provided my review comments.
05a748b to
8e8da99
Compare
divyenpatel
left a comment
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.
Changes looks good to me.
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.
Yes IsActive is helpful for reader.
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.
The current log statement is very confusing as when the node is not found, disks will not detached automatically.
Can you rephrase this info log to
glog.Infof("Node %q does not exist, vsphere CP will assume all disks %v are not attached to it.", nodeName, volPaths).
Same at other places as well.
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.
Ok, thank for your comment.
8e8da99 to
0927121
Compare
If node does not exist, node's volumes will be detached automatically and become available. So mark them detached and return false without error. Fix kubernetes#50266
0927121 to
ea32f06
Compare
| glog.Errorf("Failed to get VM object for node: %q. err: +%v", vSphereInstance, err) | ||
| return nil, err | ||
| } | ||
| nodeExist, err := vm.Exists(ctx) |
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.
I have one more question. If node is powered off and the pod is placed on to other available nodes, will the volumes attached to powered off node detach automatically?
What logic in here, would cause it to happen?
Its because i have one PR which does this #40118. Throwing an error when node is powered off caused the volume to be detached automatically.
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.
Doesn't it matter if the node is powered off or not when the DisksAreAttached() call is made.
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.
@bacongobbler Have you see the comment from @divyenpatel:"Same as commented for DisksAreAttached. When node VM is powered off, we can still check if disks are attached to the Node VM, and return actual state of the disk."
It seem it doesn't matter if the node is powered off or not when the DisksAreAttached() call is made.
On the other hand, the "vm.Exists(ctx)" just check if vm is power on, can't check if vm is exist.
|
@dims @jingxu97 @kerneltime @luomiao @BaluDontu - Any thoughts on it? |
|
The change looks good to me. /lgtm from my side. |
|
sorry for the late reply. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FengyunPan, luomiao Associated issue: 50266 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these OWNERS Files:You can indicate your approval by writing |
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue |
If node does not exist, node's volumes will be detached
automatically and become available. So mark them detached and
return false without error.
Fix #50266
Special notes for your reviewer:
/assign @jingxu97
Release note: