Skip to content

Add os_disk_caching and data_disk_caching builder operations for VM/VMSS#1252

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/expose-disk-cache-controls
Draft

Add os_disk_caching and data_disk_caching builder operations for VM/VMSS#1252
Copilot wants to merge 3 commits into
masterfrom
copilot/expose-disk-cache-controls

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

Exposes the caching property for OS and data disks on VMs and VM Scale Sets, allowing control over host-level disk caching behavior.

The changes in this PR are as follows:

  • Common.fs: Added CachingType DU (NoCaching"None", ReadOnly, ReadWrite) and Caching: CachingType option field to DiskInfo
  • Builders.Vm.fs: Added os_disk_caching and data_disk_caching builder operations; caching is applied in Run composably alongside disk_delete_option; only applies to image-based OS disks and empty data disks (not attached disks)
  • Compute.fs: storageProfile now emits caching in ARM output when set; omitted (not null-emitted) when unset, preserving Azure's default behaviour
  • Tests: 5 new tests covering OS caching, data disk caching, NoCaching ARM value, absence when unset, and composition with disk_delete_option

I have read the contributing guidelines and have completed the following:

  • Tested my code end-to-end against a live Azure subscription.
  • Updated the documentation in the docs folder for the affected changes.
  • Written unit tests against the modified code that I have made.
  • Updated the release notes with a new entry for this PR.
  • Checked the coding standards outlined in the contributions guide and ensured my code adheres to them.

If I haven't completed any of the tasks above, I include the reasons why here:

  • End-to-end testing against a live Azure subscription was not performed in this automated implementation.

Below is a minimal example configuration that includes the new features, which can be used to deploy to Azure:

open Farmer
open Farmer.Builders
open Farmer.Vm

let myVm = vm {
    name "my-vm"
    username "azureuser"
    vm_size Standard_D2s_v3
    operating_system UbuntuServer_2204LTS
    os_disk 128 Premium_LRS
    os_disk_caching ReadWrite        // Set OS disk host caching
    add_disk 512 Premium_LRS
    data_disk_caching ReadOnly       // Set caching for all data disks
}

let deployment = arm {
    location Location.EastUS
    add_resource myVm
}

Copilot AI linked an issue Apr 19, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 19, 2026 19:48
…ta_disk_caching builder operations

Agent-Logs-Url: https://github.com/CompositionalIT/farmer/sessions/d172f1d8-a5d0-42ed-94fa-643e1afebd05

Co-authored-by: ninjarobot <1520226+ninjarobot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add VM/SS disk cache controls for Data and OS disks Add os_disk_caching and data_disk_caching builder operations for VM/VMSS Apr 19, 2026
Copilot AI requested a review from ninjarobot April 19, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VM/SS disk cache controls

2 participants