Skip to content

Commit

Permalink
changing swtich to if block
Browse files Browse the repository at this point in the history
  • Loading branch information
amanpaha committed May 27, 2021
1 parent 1699b57 commit 36b652b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions simulator/virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2241,21 +2241,28 @@ func allSnapshotsInTree(tree []types.VirtualMachineSnapshotTree) []types.Managed
}

func changeTrackingSupported(spec *types.VirtualMachineConfigSpec) *bool {
var supported bool
supported := false
for _, device := range spec.DeviceChange {
if dev, ok := device.GetVirtualDeviceConfigSpec().Device.(*types.VirtualDisk); ok {

switch dev.Backing.(type) {
case *types.VirtualDiskFlatVer2BackingInfo:
if _, ok := dev.Backing.(*types.VirtualDiskFlatVer2BackingInfo); ok {
supported = true
case *types.VirtualDiskSparseVer2BackingInfo:
return &supported
}

if _, ok := dev.Backing.(*types.VirtualDiskSparseVer2BackingInfo); ok {
supported = true
case *types.VirtualDiskRawDiskMappingVer1BackingInfo:
return &supported
}

if _, ok := dev.Backing.(*types.VirtualDiskRawDiskMappingVer1BackingInfo); ok {
supported = true
case *types.VirtualDiskRawDiskVer2BackingInfo:
return &supported
}

if _, ok := dev.Backing.(*types.VirtualDiskRawDiskVer2BackingInfo); ok {
supported = true
default:
supported = false
return &supported
}
}
}
Expand Down

0 comments on commit 36b652b

Please sign in to comment.