Alon Bar-Lev has uploaded a new change for review. Change subject: bootstrap: handle bootstrap messages using string member ......................................................................
bootstrap: handle bootstrap messages using string member Current implementation holds the VdsInstaller object in context of InstallVdsCommand only to extract the error message out of it. VdsInstaller is going to be retired so we move the reference to local scope and store the error message in string at state scope. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=875528 Change-Id: I928db05fa3ca7cd5941f30af8036d598847ea7d2 Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java 2 files changed, 15 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/9173/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java index d9837d9..4dafdfd 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ApproveVdsCommand.java @@ -50,7 +50,7 @@ public AuditLogType getAuditLogTypeValue() { if (!getSucceeded()) { if (_failureLogTypeValue == AuditLogType.VDS_INSTALL_FAILED) { - AddCustomValue("FailedInstallMessage", getErrorMessage(_vdsInstaller.getErrorMessage())); + AddCustomValue("FailedInstallMessage", getErrorMessage(_failureMessage)); } return _failureLogTypeValue; } else { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java index 7e50fd5..a556caf 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java @@ -23,8 +23,8 @@ public class InstallVdsCommand<T extends InstallVdsParameters> extends VdsCommand<T> { private static Log log = LogFactory.getLog(InstallVdsCommand.class); - protected VdsInstaller _vdsInstaller; private static final String GENERIC_ERROR = "Please refer to enging.log on engine and log files under /tmp on host for further details."; + protected String _failureMessage = null; public InstallVdsCommand(T parameters) { super(parameters); @@ -69,7 +69,7 @@ } else { // In case of failure - add to audit log the error as achieved from // the host - AddCustomValue("FailedInstallMessage", getErrorMessage(_vdsInstaller.getErrorMessage())); + AddCustomValue("FailedInstallMessage", getErrorMessage(_failureMessage)); result = AuditLogType.VDS_INSTALL_FAILED; } return result; @@ -81,9 +81,10 @@ getVds() != null && isOvirtReInstallOrUpgrade() ) { + VdsInstaller vdsInstaller = null; try { T parameters = getParameters(); - _vdsInstaller = new OVirtUpgrader(getVds(), parameters.getoVirtIsoFile()); + vdsInstaller = new OVirtUpgrader(getVds(), parameters.getoVirtIsoFile()); Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters( @@ -97,7 +98,7 @@ getVds().getId(), getVds().getvds_name() ); - if (!_vdsInstaller.Install()) { + if (!vdsInstaller.Install()) { throw new Exception("Upgrade failed"); } log.infoFormat( @@ -118,7 +119,8 @@ e ); setSucceeded(false); - AddCustomValue("FailedInstallMessage", getErrorMessage(_vdsInstaller.getErrorMessage())); + _failureMessage = getErrorMessage(vdsInstaller.getErrorMessage()); + AddCustomValue("FailedInstallMessage", _failureMessage); setHostStatus(VDSStatus.InstallFailed); } return; @@ -126,8 +128,9 @@ if (getVds() != null) { T parameters = getParameters(); + VdsInstaller vdsInstaller = null; if (getVds().getvds_type() == VDSType.VDS) { - _vdsInstaller = + vdsInstaller = new VdsInstaller(getVds(), parameters.getRootPassword(), parameters.getOverrideFirewall(), @@ -144,13 +147,13 @@ .getResourceManager() .RunVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Installing)); - _vdsInstaller = new OVirtInstaller(getVds()); + vdsInstaller = new OVirtInstaller(getVds()); } log.infoFormat("Before Installation {0}", Thread.currentThread().getName()); boolean installResult = false; try { - installResult = _vdsInstaller.Install(); + installResult = vdsInstaller.Install(); } catch (Exception e) { log.errorFormat("Host installation failed for host {0}, {1}.", getVds().getId(), @@ -161,7 +164,7 @@ log.infoFormat("After Installation {0}", Thread.currentThread().getName()); if (getSucceeded()) { - if (_vdsInstaller.isAddOvirtFlow()) { + if (vdsInstaller.isAddOvirtFlow()) { log.debugFormat("Add manual oVirt flow ended successfully for {0}.", getVds().getvds_name()); return; } @@ -191,7 +194,8 @@ } } else { - AddCustomValue("FailedInstallMessage", getErrorMessage(_vdsInstaller.getErrorMessage())); + _failureMessage = getErrorMessage(vdsInstaller.getErrorMessage()); + AddCustomValue("FailedInstallMessage", _failureMessage); setHostStatus(VDSStatus.InstallFailed); } } -- To view, visit http://gerrit.ovirt.org/9173 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I928db05fa3ca7cd5941f30af8036d598847ea7d2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches