Add AttachDisk/DetachDisk RPCs to VirtualMachineAgent - #441
Merged
Conversation
Introduce two dedicated cloud-agent RPCs for attaching and detaching specific virtual hard disks on an existing virtual machine: rpc AttachDisk(VirtualMachineDiskRequest) returns (VirtualMachineDiskResponse) rpc DetachDisk(VirtualMachineDiskRequest) returns (VirtualMachineDiskResponse) VirtualMachineDiskRequest carries the target VM (groupName, vmName, locationName) and only the disks to act on, rather than the VM's full storage configuration. This lets the agent operate on exactly the passed disks and verify the VM exists before proceeding, instead of routing disk attach/detach through CreateOrUpdate (Invoke/POST), which can recreate a VM after it was deleted. Regenerated moc_cloudagent_virtualmachine.pb.go with protoc 3.11.4 and protoc-gen-go v1.3.2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7af05a8a-88fb-475d-abd2-c17953abf477
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
madhanrm
approved these changes
Jul 20, 2026
rjaini
approved these changes
Jul 20, 2026
raghavendra-nataraj
added a commit
that referenced
this pull request
Jul 22, 2026
PR #441 added two dedicated cloud-agent RPCs (AttachDisk, DetachDisk) to the VirtualMachineAgent service. Since no consumer implements or calls them yet (the wssdcloudagent handler is a follow-up), collapse them into a single UpdateDisks RPC whose VirtualMachineDiskRequest carries a VirtualMachineDiskOperation (ATTACH/DETACH) selector. - Single-direction per call matches the CSI driver, which attaches/detaches exactly one disk per ControllerPublish/UnpublishVolume call. - operation field defaults to UNSPECIFIED (proto3 zero) so a caller that omits it is rejected rather than silently attaching/detaching. - Preserves the #441 intent: operate only on the passed disks, never recreate the VM (unlike Invoke/CreateOrUpdate). Regenerated moc_cloudagent_virtualmachine.pb.go with protoc 3.11.4 + protoc-gen-go v1.3.2 (matching the repo toolchain). Copilot-Session: 4a902de7-e15e-494c-b590-1f9e94a5fadd Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two dedicated cloud-agent gRPC RPCs to the
VirtualMachineAgentservice for attaching and detaching virtual hard disks on an existing virtual machine:rpc AttachDisk(VirtualMachineDiskRequest) returns (VirtualMachineDiskResponse) {} rpc DetachDisk(VirtualMachineDiskRequest) returns (VirtualMachineDiskResponse) {}New messages:
Why
Today, CSI attaches/detaches disks by calling
VirtualMachineAgent.InvokewithOperation_POST(CreateOrUpdate). That path can recreate a VM after it has been deleted (a create/delete race), which is unintended, and it validates/reconciles the VM's entire disk set.VirtualMachineDiskRequestcarries the target VM identity plus only the disks to act on (not the VM's full storage configuration). This lets the cloud agent:Scope
This PR is the proto + generated code foundation only. The cloud-agent handler/provider/client implementation (VM-existence guard, per-disk attach/detach) will land in a follow-up
wssdcloudagentPR once this change is released and the module version is bumped there.RBAC: the follow-up handler will reuse
ProviderAccessOperation_Unspecified(asRunCommanddoes), so nomoc_common_common.protoenum change is needed here.Codegen
moc_cloudagent_virtualmachine.pb.goregenerated with protoc 3.11.4 + protoc-gen-go v1.3.2 (matching the repo toolchain; a no-op baseline regen was byte-identical to the previous generated file before this change).go build ./...andgo vet ./rpc/cloudagent/compute/pass.