Skip to content

Commit

Permalink
Merge pull request #143 from madhanrm/errors
Browse files Browse the repository at this point in the history
Implement a new method for DestroyGroup
  • Loading branch information
madhanrm authored Nov 13, 2024
2 parents fd76bb7 + 2adaacc commit bcec9e3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/cluster/compute/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ func init() {
whost = host.NewWmiLocalHost()
}

// Setup
// new-vm -name test -NoVHD -Path C:\ClusterStorage\Volume1\test
// Get-vm -name test | add-vmtoCluster


/*
func TestGetResource(t *testing.T) {
cn, err := GetResource(whost, "*")
Expand Down Expand Up @@ -92,3 +97,18 @@ func TestGetVirtualMachineResouces(t *testing.T) {
t.Logf("Resource Owners %v \n", owners)
}
}

func TestGetVirtualMachine(t *testing.T) {
resource, err := GetVirtualMachineResource(whost, "test")
if err != nil {
t.Fatalf("Failed %+v", err)
return
}

ownerGroup, err := resource.GetPropertyOwnerGroup()
if err != nil {
t.Fatalf("Failed %+v", err)
return
}
t.Logf("Resource Name : %s\n", ownerGroup)
}
11 changes: 11 additions & 0 deletions pkg/cluster/compute/resourcegroup/resourcegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,14 @@ func (c *ResourceGroup) GetPreferredOwnersEx1() (preferredOwners []string, err e

return
}

// DestroyGroupEx1 destroys the resource group
func (c *ResourceGroup) DestroyGroupEx1(Options uint32) (err error) {
// Typecasting to int32 is a fix to get this method working
// Documentation says uint32 but it is not working
_, err = c.InvokeMethod("DestroyGroup", int32(Options))
if err != nil {
return
}
return
}

0 comments on commit bcec9e3

Please sign in to comment.