use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class ActivateDeactivateVmNicCommand method plugNic.
private void plugNic() {
clearAddressIfPciSlotIsDuplicated(vmDevice);
// HotPlug in the host is called only if the Vm is UP
if (hotPlugVmNicRequired(getVm().getStatus())) {
boolean externalNetworkIsPlugged = getNetwork() != null && getNetwork().isExternal();
if (externalNetworkIsPlugged) {
plugToExternalNetwork();
}
String vfToUse = null;
try {
if (isPassthrough()) {
String preallocatedVfForNic = getVfPreallocatedForNic();
boolean preallocatedVfExist = preallocatedVfForNic != null;
if (preallocatedVfExist) {
vfToUse = preallocatedVfForNic;
} else {
vfToUse = acquireVF();
if (vfToUse == null) {
failValidationCannotPlugPassthroughVnicNoSuitableVf();
return;
}
networkDeviceHelper.setVmIdOnVfs(getVdsId(), getVmId(), Collections.singleton(vfToUse));
}
vmDevice.setHostDevice(vfToUse);
}
if (executePlugOrUnplug(PlugAction.PLUG)) {
if (isPassthrough()) {
runInternalAction(ActionType.RefreshHost, new VdsActionParameters(getVdsId()));
}
} else {
clearPassthroughData(vfToUse);
}
} catch (EngineException e) {
if (externalNetworkIsPlugged && getParameters().isNewNic()) {
unplugFromExternalNetwork();
}
clearPassthroughData(vfToUse);
throw e;
}
}
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class ActivateDeactivateVmNicCommand method unplugNic.
private void unplugNic() {
if (hotPlugVmNicRequired(getVm().getStatus())) {
if (executePlugOrUnplug(PlugAction.UNPLUG)) {
if (isPassthrough()) {
clearPassthroughData(vmDevice.getHostDevice());
runInternalAction(ActionType.RefreshHost, new VdsActionParameters(getVdsId()));
}
}
}
}
Aggregations