-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: use standard API for Azure VMs in VMSS with flexible orchestration mode #829
Conversation
13e6373
to
6cbb647
Compare
@@ -47,6 +47,12 @@ func tableAzureComputeVirtualMachine(_ context.Context) *plugin.Table { | |||
Description: "The friendly name that identifies the virtual machine.", | |||
Type: proto.ColumnType_STRING, | |||
}, | |||
{ | |||
Name: "virtual_machine_scale_set", |
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.
This is necessary to distinguish standard VMs from VMs managed by VMSS in flexible orchestration mode.
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.
Hi @pdecat,
Thank you so much for raising the PR! The changes make perfect sense to me.
I have a few suggestions:
- Could you please add a comment above the getAzureComputeVirtualMachineScaleSetVmInstanceView function explaining why these changes are needed? It would be helpful to include a link to the official discussion regarding the error, for future reference.
- Could you also please add the query results in the PR body after fixing the issue?
Thank you again!
|
||
return op, nil | ||
op, err := client.InstanceView(ctx, resourceGroupName, *virtualMachine.Name) | ||
if err != nil { |
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.
Please include the error log statement.
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.
Done!
client.Authorizer = session.Authorizer | ||
|
||
op, err := client.GetInstanceView(ctx, resourceGroupName, virtualMachine.ScaleSetName, instanceId) | ||
if err != nil { |
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.
Please include the error log statement.
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.
Done!
4a15eeb
to
e3dee99
Compare
e3dee99
to
c69ade6
Compare
If VMs are managed by VMSS in flexible orchestration mode, the standard VM API must be used: https://learn.microsoft.com/en-us/answers/questions/1418158/rest-api-request-returns-badrequest-for-vmss
Without this change, the following error occurs when trying to read
power_state
of such VMs:With this change, this returns the power state properly: