use of org.ovirt.engine.core.common.vdscommands.HostDevChangeNumVfsVDSParameters in project ovirt-engine by oVirt.
the class UpdateHostNicVfsConfigCommand method executeCommand.
@Override
protected void executeCommand() {
boolean result = true;
HostNicVfsConfig oldVfsConfig = getVfsConfig();
boolean allNetworksAllowedChanged = isAllNetworksAllowed() != oldVfsConfig.isAllNetworksAllowed();
super.executeCommand();
// Check if 'allNetworksAllowed' has changed
if (allNetworksAllowedChanged) {
oldVfsConfig.setAllNetworksAllowed(isAllNetworksAllowed());
if (isAllNetworksAllowed()) {
oldVfsConfig.setNetworks(Collections.emptySet());
oldVfsConfig.setNetworkLabels(Collections.emptySet());
}
}
boolean shouldRefreshHost = false;
if (wasNumOfVfsChanged()) {
shouldRefreshHost = true;
String deviceName = networkDeviceHelper.getPciDeviceNameByNic(getNic());
try {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.HostDevChangeNumVfs, new HostDevChangeNumVfsVDSParameters(getVdsId(), deviceName, getNumOfVfs()));
result = returnValue.getSucceeded();
} catch (EngineException e) {
throw new EngineException(EngineError.UPDATE_NUM_VFS_FAILURE);
}
}
if (result) {
setSucceeded(saveChangesToDb(shouldRefreshHost, oldVfsConfig, allNetworksAllowedChanged));
}
}
Aggregations