-
Notifications
You must be signed in to change notification settings - Fork 916
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
vcsim: Sets "ChangeTrackingSupported" property of the simulated VM #2468
vcsim: Sets "ChangeTrackingSupported" property of the simulated VM #2468
Conversation
36b652b
to
7b961a8
Compare
simulator/virtual_machine.go
Outdated
for _, device := range spec.DeviceChange { | ||
if dev, ok := device.GetVirtualDeviceConfigSpec().Device.(*types.VirtualDisk); ok { | ||
|
||
if _, ok := dev.Backing.(*types.VirtualDiskFlatVer2BackingInfo); ok { |
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.
Thanks @amanpaha , your first commit used a switch dev.Backing.(type)
, which is what I would suggest here. I think changeTrackingSupported
can return bool
instead of *bool
, then each case can return true
and the default case return false
. Then use the NewBool
helper to convert to a pointer:
vm.Capability.ChangeTrackingSupported = types.NewBool(changeTrackingSupported(spec))
What do you think?
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.
Yes, definitely looks good now, thanks for the suggestion.
I have made the change, should I resolve the conversation or reviewer will do it after verifying that the correct changes were made.
changing swtich to if block Reverting to switch block
b3d7bd7
to
44ae85f
Compare
@amanpaha, VMware has approved your signed contributor license agreement. |
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.
Looks good, thanks @amanpaha !
Description
This change checks the device type and sets ChangeTrackingSupported property for the simulated VM accordingly.
Before enabling change tracking for VM, we validates if change tracking is supported or not by checking the Capability.ChangeTrackingSupported property. While writing unit test we are using vcsim for getting simulated VM but we cant test our functionality after checking ChangeTrackingSupported, since it is always nil.
How Has This Been Tested?
Ran virtual_machine_test.go (package simulator) to see if this property is populated or not.