// RemoveVMSwitch will delete a VMSwitch
RemoveVMSwitch will delete a VMSwitch
// RemoveVMSwitch will delete a VMSwitch
func (m *Manager) RemoveVMSwitch(switchID string) error {
	sw, err := m.GetVMSwitch(switchID)
	if err != nil {
		if err == wmi.ErrNotFound {
			return nil
		}
		return errors.Wrap(err, "GetVMSwitch")
	}
	swPapth, err := sw.Path()
	if err != nil {
		return errors.Wrap(err, "get path_")
	}
	jobPath := ole.VARIANT{}
	jobState, err := m.svc.Get("DestroySystem", swPapth, &jobPath)
	if err != nil {
		return fmt.Errorf("Failed to call DestroySystem: %v", err)
	}
	if jobState.Value().(int32) == wmi.JobStatusStarted {
		err := wmi.WaitForJob(jobPath.Value().(string))
		if err != nil {
			return errors.Wrap(err, "WaitForJob")
		}
	}
	return nil
}
func ( m * Manager ) RemoveVMSwitch ( switchID string ) error { sw , err := m . GetVMSwitch ( switchID ) if err != nil { if err == wmi . ErrNotFound { return nil } return errors . Wrap ( err , " " ) } swPapth , err := sw . Path ( ) if err != nil { return errors . Wrap ( err , " " ) } jobPath := ole . VARIANT { } jobState , err := m . svc . Get ( " " , swPapth , & jobPath ) if err != nil { return fmt . Errorf ( " " , err ) } if jobState . Value ( ) . ( int32 ) == wmi . JobStatusStarted { err := wmi . WaitForJob ( jobPath . Value ( ) . ( string ) ) if err != nil { return errors . Wrap ( err , " " ) } } return nil }
RemoveVMSwitch will delete a VMSwitch
RemoveVMSwitch will delete a VMSwitch