VMware Cloud Community
manfriday
Enthusiast
Enthusiast
Jump to solution

Deleting a DRS group with orchestrator

Hi!

 

I have managed to modify DRS groups with orchestrator, but I'd like to delete a DRS group as well, and I am having some trouble figuring out how that works. Can anyone point me in the right direction?

 

Thanks

 

Jason

Reply
0 Kudos
1 Solution

Accepted Solutions
manfriday
Enthusiast
Enthusiast
Jump to solution

Ok. Solved my own problem.

If anyone is struggling with the same issue, the answer is that groupSpec.removeKey needs to be set to the name of the group you wish to delete.

so this works:

// Search for DRS Group by name
System.log("Looking for Group named '" + vm_group + "'");
for (i in cluster.configurationEx.group) {
    if (cluster.configurationEx.group[i].name == vm_group) {
        if (cluster.configurationEx.group[i] instanceof VcClusterHostGroup) {
            var spec = new VcClusterConfigSpecEx();
            spec.groupSpec = [new VcClusterGroupSpec()];
            spec.groupSpec[0].operation = VcArrayUpdateOperation.remove;
            spec.groupSpec[0].removeKey = cluster.configurationEx.group[i].name;
            task = cluster.reconfigureComputeResource_Task(spec, true);
        }
    }
}

 

View solution in original post

Reply
0 Kudos
2 Replies
manfriday
Enthusiast
Enthusiast
Jump to solution

OK, so maybe a little more information is warranted. 🙂

 

I have the following code, which executes successfully, but the Host Group is not deleted and I get the following message in vCenter:

"A specified parameter was not correct: groupSpec.removeKey"

 

Here is my code:

// Search for DRS Group by name
System.log("Looking for Group named '" + vm_group + "'");
for (i in cluster.configurationEx.group) {
    if (cluster.configurationEx.group[i].name == vm_group) {
        if (cluster.configurationEx.group[i] instanceof VcClusterHostGroup) {
            var spec = new VcClusterConfigSpecEx();
            spec.groupSpec = [new VcClusterGroupSpec()];
            spec.groupSpec[0].operation = VcArrayUpdateOperation.remove;
            spec.groupSpec[0].info = cluster.configurationEx.group[i];
            task = cluster.reconfigureComputeResource_Task(spec, true);
        }
    }
}
Reply
0 Kudos
manfriday
Enthusiast
Enthusiast
Jump to solution

Ok. Solved my own problem.

If anyone is struggling with the same issue, the answer is that groupSpec.removeKey needs to be set to the name of the group you wish to delete.

so this works:

// Search for DRS Group by name
System.log("Looking for Group named '" + vm_group + "'");
for (i in cluster.configurationEx.group) {
    if (cluster.configurationEx.group[i].name == vm_group) {
        if (cluster.configurationEx.group[i] instanceof VcClusterHostGroup) {
            var spec = new VcClusterConfigSpecEx();
            spec.groupSpec = [new VcClusterGroupSpec()];
            spec.groupSpec[0].operation = VcArrayUpdateOperation.remove;
            spec.groupSpec[0].removeKey = cluster.configurationEx.group[i].name;
            task = cluster.reconfigureComputeResource_Task(spec, true);
        }
    }
}

 

Reply
0 Kudos