vm: Expose memory, CPU topology, host affinity, and HA settings#13
Open
olivierlambert wants to merge 1 commit intomainfrom
Open
vm: Expose memory, CPU topology, host affinity, and HA settings#13olivierlambert wants to merge 1 commit intomainfrom
olivierlambert wants to merge 1 commit intomainfrom
Conversation
Closes #2 Get-XoVm now returns these additional friendly properties: - AffinityHost: preferred host UUID for VM placement - MemorySize: memory allocation in bytes (from memory.size) - CoresPerSocket: CPU topology (cores per socket) - AutoPoweron: whether the VM auto-starts on host boot - HA: high availability restart priority Set-XoVm now accepts these new parameters: - -AffinityHost: set the preferred host (with UUID validation) - -Memory: set memory size in bytes - -CPUs: set vCPU count - -CoresPerSocket: set cores per socket (CPU topology) - -AutoPoweron: set auto power-on behavior - -HA: set HA priority ("", "restart", "best-effort") The fields affinityHost, coresPerSocket, and high_availability are added to the API query so they are fetched from Xen Orchestra. Example — set each running VM's affinity to its current host: Get-XoVm -PowerState Running | ForEach-Object { Set-XoVm -VmUuid $_.VmUuid -AffinityHost $_.HostUuid } Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f06e45c to
069c1a7
Compare
Collaborator
|
Hi, the Patch endpoint of VM seems to have disappeared? It doesn't work nor show up in the Swagger doc. |
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
Addresses #2 — adds the ability to retrieve and modify VM settings like memory, CPU topology, host affinity, and high availability.
Get-XoVm— new properties on VM objectsAffinityHostaffinityHostMemorySizememory.sizeCoresPerSocketcoresPerSocketAutoPoweronauto_poweronHAhigh_availabilityThese are added as friendly named properties (same pattern as
VmUuid,Name,PowerState, etc.). The raw API fieldsaffinityHost,coresPerSocket, andhigh_availabilityare now included in the fields query.Set-XoVm— new parameters-AffinityHoststring(UUID)affinityHost-Memorylongmemory-CPUsintCPUs-CoresPerSocketintcoresPerSocket-AutoPoweronboolauto_poweron-HAstringhigh_availability"","restart","best-effort")-AffinityHostsupportsValueFromPipelineByPropertyNameand has UUID validation, consistent with other UUID parameters in the module.Use case from the issue
Test plan
Get-XoVmreturnsAffinityHost,MemorySize,CoresPerSocket,AutoPoweron,HApropertiesGet-XoVm | Select-Object Name, AffinityHost, MemorySize, CoresPerSocketshows expected valuesSet-XoVm -VmUuid <id> -AffinityHost <host-uuid>sets the affinitySet-XoVm -VmUuid <id> -Memory <bytes>sets memorySet-XoVm -VmUuid <id> -CPUs <n> -CoresPerSocket <n>sets CPU topologySet-XoVm -VmUuid <id> -AutoPoweron $trueenables auto power-onSet-XoVm -VmUuid <id> -HA "restart"sets HA prioritySet-XoVm -Name/-Description/-Tagsstill work🤖 Generated with Claude Code