Alon Bar-Lev has posted comments on this change.
Change subject: engine: Allow engine to configure management network
......................................................................
Patch Set 10: (3 inline comments)
Hi,
I suggest moving the entire status management sequence to one place...
Thanks!!!
Alon
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
Line 176: );
Line 177: }
Line 178: setVdsStatus(VDSStatus.Installing);
Line 179: installer.execute();
Line 180: setVdsStatus(getVds().getStatus());
What about moving the entire status management here?
class VdsInstallException {
VdsInstallException(VDSStatus status, String message) {
...
}
}
try {
setVdsStatus(VDSStatus.Installing);
installer.execute();
if (installer.getPartialInstallation()) {
throw new VdsInstallException(VDSStatus.InstallFailed, "Partial
installation")
}
if (installer.getReboot()) {
setVdsStatus(VDSStatus.Reboot);
RunSleepOnReboot();
}
else {
try {
network stuff
}
catch (VDSNetworkException e) {
...
}
catch (Exception e) {
throw new VdsInstallException(VDSStatus.NonOperational, "...", e);
}
}
}
catch (VdsInstallException e) {
setVdsStatus(e.getStatus());
// setSucceed?
}
catch (Exception e) {
setVdsStatus(VDSStatus.InstallFailed());
setSucceeded(false);
}
Line 181:
Line 182: switch (getVds().getStatus()) {
Line 183: case Reboot:
Line 184: RunSleepOnReboot();
Line 273: * @param status
Line 274: * new status.
Line 275: */
Line 276: private void setVdsStatus(VDSStatus status) {
Line 277: runVdsCommand(VDSCommandType.SetVdsStatus, new
SetVdsStatusVDSCommandParameters(getVdsId(), status));
Just to confirm... this runs in new transaction, right? So it will be visible
during long running operation.
Line 278: }
Line 279:
Line 280: private boolean isOvirtReInstallOrUpgrade() {
Line 281: return getParameters().getIsReinstallOrUpgrade() &&
getVds().getVdsType() == VDSType.oVirtNode;
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
Line 941: "Installation failed, please refer to
installation logs"
Line 942: );
Line 943: }
Line 944: else if (_goingToReboot) {
Line 945: _vds.setStatus(VDSStatus.Reboot);
If we are at this... I guess all status management can be moved to command.
1. If exception - InstalledFailed - this is easy.
2. If success, a getter for reboot or incomplete will show you the way.
This way we manage the state at one place.
Line 946: }
Line 947: else if (_installIncomplete) {
Line 948: _vds.setStatus(VDSStatus.InstallFailed);
Line 949: }
--
To view, visit http://gerrit.ovirt.org/14230
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaf82e10481e595d690e7ce894283b4ed5b9b3269
Gerrit-PatchSet: 10
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Livnat Peer <[email protected]>
Gerrit-Reviewer: Martin Pavlik <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches