Skip to content

Commit

Permalink
fix #12 (issues adding VM to empty DrsVMGroup)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtboren committed Apr 26, 2018
1 parent f15936b commit 876d70c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DRSRule.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,8 @@ function Set-DrsVMGroup {

## if all VMs were specified to be remove from the group (if the $groupSpec.Info.VM value is $null), write warning and take no further action (may not be supported by vSphere API, seemingly; trying to do so via GUI returns message to the effect of, "Cannot remove all members of group")
if ($null -eq $groupSpec.Info.VM) {Write-Warning "Removing all VMs from VMGroup not supported. Taking no action"}
## if the VM list is the same between the existing VMGroup and the new ClusterGroupSpec, do not bother calling ReconfigureComputeResource() method
elseif ($null -eq (Compare-Object -ReferenceObject $arrOriginalVMIDsInTarget -DifferenceObject $groupSpec.Info.VM)) {
## if the VMGroup had any VMs in it already, and the VM list is the same between the existing VMGroup and the new ClusterGroupSpec, do not bother calling ReconfigureComputeResource() method
elseif (($null -ne $arrOriginalVMIDsInTarget) -and $null -eq (Compare-Object -ReferenceObject $arrOriginalVMIDsInTarget -DifferenceObject $groupSpec.Info.VM)) {
Write-Verbose "Not changing VMGroup (no new members added, and no members to remove)"
} ## end if
else {
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### v1.2.1
Apr 2018
- \[bugfix] fixed [Issue #12](https://github.com/PowerCLIGoodies/DRSRule/issues/12), "Error at addition in empty group the VM list" -- can now add a VM to a DrsVMGroup that has no VM members to start, for whatever reason (VM atrophy, maybe?)
- \[bugfix] fixed [Issue #15](https://github.com/PowerCLIGoodies/DRSRule/issues/15), "Metadata file VMware.Vim.dll could not be found" -- now loads items properly for VMware PowerCLI version 10 as well, and on Windows PowerShell and PowerShell Core.

### v1.2.0
Expand Down
1 change: 1 addition & 0 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
- update `Get-Drs*` behavior to match standard `Get-*` cmdlets' behavior of returning error when no item found of given name when `$Name` has no wildcard:
- `Get-DrsVMGroup bogusGroupName` should throw error
- add function to get objects from exported JSON, to essentially return info items that could be used for `New-Drs*`, but that would be useful to see what items are stored in given JSON
- maybe (if only for the sake of thoroughness): look into addressing potential issues that might arise from `Compare-Object` calls where a reference- or difference object might be $null (which would cause `Compare-Object` to throw an error) -- an example of where this was fixed: `Set-DrsVMGroup`; may be minimal chance of hitting bug, as DRS VM/VMHost groups should generally have members, but may be worth a look throughout rest of code

0 comments on commit 876d70c

Please sign in to comment.