remi_clouzeau
VMware Employee
VMware Employee

Fail to remove a PG in svSwitch

Hi,

I'm trying to dev. a workflow which will remove a network portgroup on a standard virtual switch., when I'm tring to use the method : destroyNetwork() on a PG, i'm receiving an error that it is in use. I've double checked that there is no more VM on it.

bellow is my script in a Script task

ListTestPG is an Array of VC:Network

for each (var pg in ListTestPG) {
if (pg.vm.length == 0) { //Check that no vm is on this PG
   var task = pg.destroyNetwork();
};
}

Any idea, or does someone already done an action or workflow to remove a PG on stargard vSwitch ??

Thanks for your help.

Regards

0 Kudos
2 Replies
cdecanini_
VMware Employee
VMware Employee

Hi Remi,

You should definitely use Onyx to see what happens when the PG is removed. You may be missing an operation.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
remi_clouzeau
VMware Employee
VMware Employee

Thanks Christophe,

Onyx is a very cool tools and very quick to install and run.

Onyx show me that it is unsing the method : removePortGroup instead of destroyNetwork.

So with this script, my PG is well removed.

var netConf = ESX.configManager.networkSystem;

for each (var pg in ListTestPG) {
if (pg.vm.length == 0) { //Check that no vm is on this PG
  netConf.removePortGroup(pg.name);
};
}

Thanks

Rémi

0 Kudos