reubenur-rahman / vmware-pyvmomi-examples

The example codes are written using the VMware official python library pyvmomi
Apache License 2.0
91 stars 60 forks source link

Is there a way to remove a DVPortgorup from DVSwitch? #17

Closed jonathanmier closed 7 years ago

jonathanmier commented 7 years ago

I now you can add a DVPortgroup to a DVSwitch with CreateDVPortgroup_Task. Is there a way to delete that DVPortgroup?

reubenur-rahman commented 7 years ago

Yes directly cal Destroy_Task on the pg object.

Before doing that verify that the pg is not connected with any VM.

vms = pg_obj.summary.vm
if not vms:
    destroy_task = pg_obj.Destroy_Task()
    task.WaitForTask(destroy_task, si)
jonathanmier commented 7 years ago

Thanks alot