Source:
protected void executeCommand() { String bond = null; List<String> nics = new ArrayList<String>(); nics.add(NetworkUtils.StripVlan(getParameters().getInterface().getName())); Integer vlanId = NetworkUtils.GetVlanId(getParameters().getInterface().getName()); boolean isBond = getParameters().getInterface().getName().startsWith("bond") && getParameters().getInterface().getName().contains("."); isBond = isBond || (getParameters().getInterface().getBonded() != null && getParameters().getInterface().getBonded()); if (isBond) { nics.clear(); bond = NetworkUtils.StripVlan(getParameters().getInterface().getName()); List<VdsNetworkInterface> interfaces = getDbFacade() .getInterfaceDao().getAllInterfacesForVds(getParameters().getVdsId()); for (VdsNetworkInterface i : interfaces) { if (StringUtils.equals(i.getBondName(), bond)) { nics.add(NetworkUtils.StripVlan(i.getName())); } } } NetworkVdsmVDSCommandParameters parameters = new NetworkVdsmVDSCommandParameters(getParameters().getVdsId(), getParameters().getNetwork().getName(), vlanId, bond, nics.toArray(new String[] {}), getParameters() .getNetwork().getAddr(), getParameters().getNetwork().getSubnet(), getParameters().getNetwork() .getGateway(), getParameters().getNetwork().getStp(), getParameters().getBondingOptions(), getParameters().getBootProtocol()); VDSReturnValue retVal = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveNetwork, parameters); if (retVal.getSucceeded()) { retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.CollectVdsNetworkData, new CollectVdsNetworkDataVDSCommandParameters(getVds())); if (retVal.getSucceeded()) { setSucceeded(true); } } }

Target:
protected void executeCommand() { String bond = null; List<String> nics = new ArrayList<>(); nics.add(NetworkUtils.StripVlan(getParameters().getInterface().getName())); Integer vlanId = NetworkUtils.GetVlanId(getParameters().getInterface().getName()); boolean isBond = getParameters().getInterface().getName().startsWith("bond") && getParameters().getInterface().getName().contains("."); isBond = isBond || (getParameters().getInterface().getBonded() != null && getParameters().getInterface().getBonded()); if (isBond) { nics.clear(); bond = NetworkUtils.StripVlan(getParameters().getInterface().getName()); List<VdsNetworkInterface> interfaces = getDbFacade() .getInterfaceDao().getAllInterfacesForVds(getParameters().getVdsId()); for (VdsNetworkInterface i : interfaces) { if (StringUtils.equals(i.getBondName(), bond)) { nics.add(NetworkUtils.StripVlan(i.getName())); } } } NetworkVdsmVDSCommandParameters parameters = new NetworkVdsmVDSCommandParameters(getParameters().getVdsId(), getParameters().getNetwork().getName(), vlanId, bond, nics.toArray(new String[] {}), getParameters() .getNetwork().getAddr(), getParameters().getNetwork().getSubnet(), getParameters().getNetwork() .getGateway(), getParameters().getNetwork().getStp(), getParameters().getBondingOptions(), getParameters().getBootProtocol()); VDSReturnValue retVal = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveNetwork, parameters); if (retVal.getSucceeded()) { retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.CollectVdsNetworkData, new CollectVdsNetworkDataVDSCommandParameters(getVds())); if (retVal.getSucceeded()) { setSucceeded(true); } } }