Skip to content

feat(azure): VM updates and data disks, resource SKUs, and the AI Search and OpenAI ingestion data planes - #116

Open
Joey Lin (jlinpw) wants to merge 12 commits into
parallelworks:canaryfrom
jlinpw:feat/arm-search-skus-datadisks
Open

Joey Lin (jlinpw) wants to merge 12 commits into
parallelworks:canaryfrom
jlinpw:feat/arm-search-skus-datadisks

Conversation

@jlinpw

Copy link
Copy Markdown

Summary

Extends the azure/arm and azure/graph stand-ins so code that provisions VMs, scale sets and Azure AI services can be tested through the official Azure SDK for Go, instead of the SDK's per-service fake servers or hand-written HTTP stand-ins.

Stacked on #115. Both come from the same fork, so GitHub shows #115's commits here too until it merges. The changes in this PR are the five commits after 0e437f3, and they touch only azure/.

Virtual machine updates and data disks.

  • VM PATCH takes tags and storageProfile.dataDisks. Renaming the OS disk fails with PropertyChangeNotAllowed, and other properties fail with 400 as not supported, so callers change them with a PUT.
  • Data disks attach existing managed disks (createOption: Attach), each at its own lun from 0 to 63. A PUT or PATCH that lists dataDisks replaces them: a disk it leaves out, or marks toBeDetached, is detached. Attaching a disk another VM holds fails with 409 OperationNotAllowed.
  • Deleting a VM detaches its data disks and deletes those whose deleteOption is Delete. Deleting a group that holds a disk a VM elsewhere has attached fails with ResourceGroupDeletionBlocked.

Resource SKUs. WithResourceSKUs(...) sets the SKUs a subscription is offered, with locations, zones, capabilities and restrictions. resourceSkus list takes the one $filter Azure supports (location eq '...'), and any other filter fails with 400. The default is still none.

More VM behavior.

  • A VM create whose operation fails (a FailOperation fault, such as AllocationFailed) leaves the VM Failed, as Azure does: it keeps its interfaces and OS disk, has no power state, and its instance view shows ProvisioningState/failed/{code}. A PUT over it provisions it again. Previously a failed create left nothing.
  • powerOff shows the VM stopping, then stopped, with its OS disk still attached.
  • An update that changes osProfile.customData or the Linux SSH public keys fails with 409 PropertyChangeNotAllowed, as Azure refuses both.

Gallery image version updates. PATCH merges tags, publishingProfile and safetyProfile; storageProfile, securityProfile and restore fail with 400. blockDeletionBeforeEndOfLife is recorded, not enforced.

Azure AI Search data plane (Server.Search(), served like Server.Blob()):

  • Indexes, data sources and indexers: create or update, get and delete, addressed as indexes/x or indexes('x'). Also indexer search.run and search.status, Index Documents, and a GET document search.
  • Each call needs one of the service's admin keys in api-key; a missing or wrong key fails with 403. A get or delete of something that doesn't exist answers 404.
  • ETags, If-Match/If-None-Match and Prefer: return=minimal behave as documented. A data source's connection string reads back as null, and <unchanged> keeps it.
  • An indexer runs when it's created unless disabled. A run stays inProgress until WithSettleAfter's reads are spent or Settle, and a second run while one is in progress fails with 409.

Azure OpenAI ingestion jobs (Server.OpenAI()): PUT and GET {endpoint}openai/ingestion/jobs/{id} on an OpenAI or AIServices account, found by its custom subdomain. Each call needs key1 or key2; a wrong key fails with 401. A job is running until settled, then succeeded.

Seeding methods, for states a fault can't leave behind:

  • Server.FailProvisioning(id) leaves a resource Failed.
  • Server.FailSubnetCheck(subnet, message) fails a Managed Lustre subnet check with the body the API defines.

Graph. graph.Organization takes NoCountry and NoDefaultUsageLocation, so /organization can answer those fields as null, as Graph does.

Data-plane faults are named after the REST spec's operation IDs (Indexes_Delete, Indexers_Run, IngestionJobs_Create, ...). FailOperation on Indexers_Run ends the run in transientFailure, and on IngestionJobs_Create it returns a job that has failed.

The package documentation lists where the stand-in differs from Azure, including:

  • Indexers read and index nothing, and ingestion jobs create nothing in the search service.
  • Skillsets, schedules, resets, listing, query keys and Entra ID tokens on the Search data plane aren't supported.
  • Search error codes are empty, as Search writes most of them; the messages the docs don't give are marked as inferred.
  • The disks of scale set VMs are not modeled.
  • The SKU catalog isn't checked when a VM or scale set is created.
  • Key-authenticated data-plane calls aren't checked against WithPolicy.

Testing

  • sdktest/azure/arm: datadisks_test.go, and new cases in compute_test.go and arm_test.go, go through armcompute (virtual machines, disks, resource SKUs, gallery image versions) and armresources. The Search and OpenAI data planes are tested over plain HTTP, as their REST references document them, the way the Blob data plane is.
  • sdktest/azure/graph: TestOrganizationWithoutCountry goes through the official Graph client.
  • make check passes (on Go 1.27.4; 1.27.3's standard library has GO-2026-6859, which govulncheck reports regardless of this change).
  • make bench against canary for azure/arm, with benchstat over 10 runs each. Times are unchanged within noise, and bytes and allocations per op are the same:
                              │    canary     │             this PR              │
                              │    sec/op     │   sec/op     vs base             │
PutGetDelete-8                   26.48µ ±  2%   26.50µ ± 1%        ~ (p=0.897)
ListGroupsFiltered-8             190.9µ ±  2%   190.0µ ± 2%        ~ (p=0.247)
ListGroupResources/all-8         1.161m ± 26%   1.155m ± 2%        ~ (p=0.105)
ListGroupResources/filtered-8    151.0µ ± 23%   111.1µ ± 1%  -26.47% (p=0.000)
PutListDeleteBlob-8              97.57µ ±  6%   97.59µ ± 2%        ~ (p=0.971)
ListBlobs/page-8                 414.2µ ± 37%   376.8µ ± 2%   -9.04% (p=0.007)
ListBlobs/versions-8             3.025m ±  2%   3.057m ± 2%        ~ (p=0.123)
ListBlobs/delimiter-8            105.4µ ±  2%   106.1µ ± 2%        ~ (p=0.353)

The two faster rows reflect a noisy canary run (±23% and ±37%), not a speedup.

Checklist

  • make check passes
  • New methods are tested through the official client library
  • Package documentation says where the stand-in differs from the real API

…uspend and resume

acceleratorTypes answers aggregatedList, list and get from a per-zone catalog that WithAcceleratorTypes sets. regionInstances.bulkInsert places instances in the region's zones by its locationPolicy and shares the zonal bulkInsert's naming, conflict and minCount rules. instances.suspend and resume move a running instance through SUSPENDING to SUSPENDED and back.
Zonal instance group managers: insert, get, list, aggregatedList, delete,
createInstances, deleteInstances, listManagedInstances and
setInstanceTemplate. A group creates real instances from its template, which
instances.get and list see, and reports them with their instanceStatus and
currentAction; deleting a group deletes its instances, and a template a group
uses cannot be deleted.

Resize requests: insert, get, list, cancel and delete, moving from ACCEPTED
through CREATING to SUCCEEDED as WithSettleAfter and Settle allow, with the
412 the API gives a cancel or delete in the wrong state.
Server.FailResizeRequest and Server.FailResizeAttempt end a request in
FAILED or record a failed attempt on one still waiting, as want of quota or
capacity does.
# Conflicts:
#	gcp/compute/instances.go
#	gcp/compute/server.go
Server.Search serves a search service's indexes, data sources, indexers
(with runs and status) and documents, authenticated with its admin keys.
Server.OpenAI serves an Azure OpenAI account's ingestion jobs, authenticated
with its account keys. Indexer runs and ingestion jobs settle as other
operations do, and faults can fail them.

FailProvisioning leaves a resource Failed, and FailSubnetCheck makes Managed
Lustre subnet checks fail with the error the API defines.
Organization.NoCountry and NoDefaultUsageLocation make GET /organization
answer countryLetterCode or defaultUsageLocation as null, as Graph does for a
tenant set up without them.
…version updates

Resource SKUs list the catalog WithResourceSKUs sets, filtered by location. A VM create whose operation fails leaves the VM Failed, powerOff stops a VM, an update that changes a VM's customData or SSH public keys fails with PropertyChangeNotAllowed, and a PATCH updates a gallery image version's tags, publishingProfile and safetyProfile.
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.

1 participant