Eli Mesika has uploaded a new change for review. Change subject: core: set cluster for host registration if null ......................................................................
core: set cluster for host registration if null This patch handles a case were the default cluster for host registration is not defined in vdc_options properly or the default cluster was removed. In that case instead of a failure, he code will try to find first the default cluster and if not found any other cluster. Change-Id: I5eda0fe04de8338a49000d62338717584518b153 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1192950 Signed-off-by: emesika <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java 1 file changed, 16 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/42/37842/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java index 4707393..f32cd13 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java @@ -310,7 +310,22 @@ protected boolean validateVdsGroup() { if (getVdsGroup() == null) { - return failCanDoAction(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); + // get the default cluster + VDSGroup cluster = getVdsGroupDAO().getByName("Default"); + if (cluster != null) { + setVdsGroup(cluster); + return true; + } + else { + // this may occur when the default cluster is removed + List<VDSGroup> clusters = getVdsGroupDAO().getAll(); + if (clusters.size() > 0) { + setVdsGroup(clusters.get(0)); + return true; + } + log.error("AddVdsCommand: No default or valid cluster was found, host registration failed."); + return failCanDoAction(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); + } } return true; } -- To view, visit http://gerrit.ovirt.org/37842 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5eda0fe04de8338a49000d62338717584518b153 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
