-
Notifications
You must be signed in to change notification settings - Fork 3
Changes for AksIot #8
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
base: addPropertiesCheck
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ type VirtualMachineOptions struct { | |
| VnicId string | ||
| MacAddress string | ||
| UseGuestConnection bool | ||
| UseVsock bool | ||
| AllowOvercommit bool | ||
| } | ||
|
|
||
|
|
@@ -70,10 +71,10 @@ type VirtualMachineSpec struct { | |
| func CreateVirtualMachineSpec(opts *VirtualMachineOptions) (*VirtualMachineSpec, error) { | ||
| // Ensure the VM has access, we use opts.Id to create VM | ||
| if err := wclayer.GrantVmAccess(opts.Id, opts.VhdPath); err != nil { | ||
| return nil, err | ||
| return nil, fmt.Errorf("Failed to grant VM access to VHD file, error: %s", err) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| if err := wclayer.GrantVmAccess(opts.Id, opts.IsoPath); err != nil { | ||
| return nil, err | ||
| return nil, fmt.Errorf("Failed to grant VM access to ISO file, error: %s", err) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| spec := &hcsschema.ComputeSystem{ | ||
|
|
@@ -132,7 +133,7 @@ func CreateVirtualMachineSpec(opts *VirtualMachineOptions) (*VirtualMachineSpec, | |
|
|
||
| if opts.UseGuestConnection { | ||
| spec.VirtualMachine.GuestConnection = &hcsschema.GuestConnection{ | ||
| UseVsock: true, | ||
| UseVsock: opts.UseVsock, | ||
| UseConnectedSuspend: true, | ||
| } | ||
| } | ||
|
|
@@ -362,7 +363,7 @@ func (vm *VirtualMachineSpec) HotDetachEndpoint(endpoint *hcn.HostComputeEndpoin | |
| // Hot detach an endpoint from the compute system | ||
| request := hcsschema.ModifySettingRequest{ | ||
| RequestType: requesttype.Remove, | ||
| ResourcePath: path.Join("VirtualMachine/Devices/NetworkAdapters", endpoint.Id), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the original motivation to change it from
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use the ID, the ID changes every time the VM is rebooted. This is a problem for the Windows VM because it detects a different physical network adapter and loses its networking configuration. I.e. if we use the ID, a different physical network adapter is mapped into the VM each time the VM restarts.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an optional input parameter to allow caller specify resource name, if caller specify resource name, use it, otherwise use ID to ensure no conflict to existing resource name. Same for hotAttachEndpoint |
||
| ResourcePath: path.Join("VirtualMachine/Devices/NetworkAdapters", endpoint.Name), | ||
| Settings: hcsschema.NetworkAdapter{ | ||
| EndpointId: endpoint.Id, | ||
| MacAddress: endpoint.MacAddress, | ||
|
|
@@ -380,7 +381,7 @@ func (vm *VirtualMachineSpec) hotAttachEndpoint(ctx context.Context, system *hcs | |
| // Hot attach an endpoint to the compute system | ||
| request := hcsschema.ModifySettingRequest{ | ||
| RequestType: requesttype.Add, | ||
| ResourcePath: path.Join("VirtualMachine/Devices/NetworkAdapters", endpoint.Id), | ||
| ResourcePath: path.Join("VirtualMachine/Devices/NetworkAdapters", endpoint.Name), | ||
| Settings: hcsschema.NetworkAdapter{ | ||
| EndpointId: endpoint.Id, | ||
| MacAddress: endpoint.MacAddress, | ||
|
|
||
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.
decide the value of needsDefault by checking if subnet.Routes is empty before the loop, no need to set it in the loop.