Omer Frenkel has uploaded a new change for review. Change subject: core: add message when no host with network found on run vm ......................................................................
core: add message when no host with network found on run vm when running vm, there is a check when selection host to run, that the host has all the networks used by the vm. currently when this happens, the vm is just not run without any message. this patch adds a message in CanDoAction in addition, as done for other run failure reasons. Change-Id: I6f4066b80f0ec7db0b640fc818f833fdb387fdf8 Signed-off-by: Omer Frenkel <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 5 files changed, 20 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/7130/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java index 8c63f09..0f1b82f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java @@ -27,6 +27,7 @@ public class VdsSelector { private final List<Guid> privateRunVdssList = new ArrayList<Guid>(); + private List<VmNetworkInterface> vmNICs; public List<Guid> getRunVdssList() { return privateRunVdssList; @@ -239,6 +240,9 @@ else if (!IsVMSwapValueLegal(vds)) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_SWAP); } + else if (!areRequiredNetworksAvailable(getInterfaceDAO().getAllInterfacesForVds(vds.getId()))) { + return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_NETWORKS); + } return ValidationResult.VALID; } @@ -286,7 +290,6 @@ private Guid getVdsToRunOn(Iterable<VDS> vdss) { final List<VDS> readyToRun = new ArrayList<VDS>(); - final List<VmNetworkInterface> vmNICs = getVmNetworkInterfaceDAO().getAllForVm(getVm().getId()); for (VDS curVds : vdss) { // vds must be in the correct group if (!curVds.getvds_group_id().equals(getVm().getvds_group_id())) @@ -315,7 +318,7 @@ if (!IsVMSwapValueLegal(curVds)) continue; - if(!areRequiredNetworksAvailable(vmNICs, getInterfaceDAO().getAllInterfacesForVds(curVds.getId()))) + if(!areRequiredNetworksAvailable(getInterfaceDAO().getAllInterfacesForVds(curVds.getId()))) continue; readyToRun.add(curVds); @@ -324,9 +327,8 @@ return readyToRun.isEmpty() ? Guid.Empty : getBestVdsToRun(readyToRun); } - boolean areRequiredNetworksAvailable(final List<VmNetworkInterface> vmNetworkInterfaces, - final List<VdsNetworkInterface> allInterfacesForVds) { - for (final VmNetworkInterface vmIf : vmNetworkInterfaces) { + boolean areRequiredNetworksAvailable(final List<VdsNetworkInterface> allInterfacesForVds) { + for (final VmNetworkInterface vmIf : getVmNICs()) { boolean found = false; for (final VdsNetworkInterface vdsIf : allInterfacesForVds) { if (StringUtils.equals(vmIf.getNetworkName(), vdsIf.getNetworkName())) { @@ -369,5 +371,12 @@ return bestVDS.getId(); } + private List<VmNetworkInterface> getVmNICs() { + if (vmNICs == null) { + vmNICs = getVmNetworkInterfaceDAO().getAllForVm(getVm().getId()); + } + return vmNICs; + } + private static Log log = LogFactory.getLog(VdsSelector.class); } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java index 9171781..fb7b495 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java @@ -110,6 +110,7 @@ ACTION_TYPE_FAILED_VDS_VM_VERSION, ACTION_TYPE_FAILED_VDS_VM_SWAP, ACTION_TYPE_FAILED_VDS_VM_CPUS, + ACTION_TYPE_FAILED_VDS_VM_NETWORKS, ACTION_TYPE_FAILED_NO_VDS_AVAILABLE_IN_CLUSTER, ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE, ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE, diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index 3e31491..4bd7d0c 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -169,6 +169,7 @@ ACTION_TYPE_FAILED_VDS_VM_CLUSTER=Cannot ${action} ${type}. There are no available running Hosts in the Host Cluster. ACTION_TYPE_FAILED_VDS_VM_MEMORY=Cannot ${action} ${type}. There are no available running Hosts with sufficient memory in VM's Cluster . ACTION_TYPE_FAILED_VDS_VM_CPUS=Cannot ${action} ${type}. There are no available running Hosts with enough cores in VM's Cluster . +ACTION_TYPE_FAILED_VDS_VM_NETWORKS=Cannot ${action} ${type}. There are no available running Hosts with all the networks used by the VM. CANNOT_MAINTANANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS=The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}. Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}. ACTION_TYPE_FAILED_VDS_VM_VERSION=Cannot ${action} ${type}. VM's tools version (${toolsVersion}) mismatch with the Host's (${serverVersion}) version. diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index 54bea2c..5e8a55a 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -433,6 +433,9 @@ @DefaultStringValue("Cannot ${action} ${type}. There are no available running Hosts with enough cores in VM's Cluster .") String ACTION_TYPE_FAILED_VDS_VM_CPUS(); + @DefaultStringValue("Cannot ${action} ${type}. There are no available running Hosts with all the networks used by the VM.") + String ACTION_TYPE_FAILED_VDS_VM_NETWORKS(); + @DefaultStringValue("The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}.Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}.") String CANNOT_MAINTANANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS(); diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 7188f9a..b1aa351 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -166,6 +166,7 @@ ACTION_TYPE_FAILED_VDS_VM_CLUSTER=Cannot ${action} ${type}. There are no available running Hosts in the Host Cluster. ACTION_TYPE_FAILED_VDS_VM_MEMORY=Cannot ${action} ${type}. There are no available running Hosts with sufficient memory in VM's Cluster . ACTION_TYPE_FAILED_VDS_VM_CPUS=Cannot ${action} ${type}. There are no available running Hosts with enough cores in VM's Cluster . +ACTION_TYPE_FAILED_VDS_VM_NETWORKS=Cannot ${action} ${type}. There are no available running Hosts with all the networks used by the VM. CANNOT_MAINTANANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS=The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}. Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}. ACTION_TYPE_FAILED_VDS_VM_VERSION=Cannot ${action} ${type}. VM's tools version (${toolsVersion}) mismatch with the Host's (${serverVersion}) version. -- To view, visit http://gerrit.ovirt.org/7130 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6f4066b80f0ec7db0b640fc818f833fdb387fdf8 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Omer Frenkel <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
