Ravi Nori has uploaded a new change for review. Change subject: tools: engine-config cleanup 2.2 LimitNumberOfNetworkInterfaces ......................................................................
tools: engine-config cleanup 2.2 LimitNumberOfNetworkInterfaces Remove deprecated config values for version 2.2 from engine-config Removed LimitNumberOfNetworkInterfaces key and the boolean logic corresponding to it. Remove unused method validateNumberOfNics from VmCommand and removed the unused messages from propery files. Change-Id: I52c53990fa7440107ddc14ceba58b1971340a8e0 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=859045 Signed-off-by: Ravi Nori <[email protected]> --- M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmInterfaceCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmInterfaceCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.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 backend/manager/modules/utils/src/test/resources/AppErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 15 files changed, 4 insertions(+), 108 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/9486/1 diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql index 0121a4e..1218493 100644 --- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -246,10 +246,6 @@ select fn_db_add_config_value('LeaseRetries','3','general'); select fn_db_add_config_value('LeaseTimeSec','60','general'); select fn_db_add_config_value('LicenseCertificateFingerPrint','5f 38 41 89 b1 33 49 0c 24 13 6b b3 e5 ba 9e c7 fd 83 80 3b','general'); -select fn_db_add_config_value('LimitNumberOfNetworkInterfaces','true','2.2'); -select fn_db_add_config_value('LimitNumberOfNetworkInterfaces','false','3.0'); -select fn_db_add_config_value('LimitNumberOfNetworkInterfaces','false','3.1'); -select fn_db_add_config_value('LimitNumberOfNetworkInterfaces','false','3.2'); select fn_db_add_config_value('LiveSnapshotEnabled','false','2.2'); select fn_db_add_config_value('LiveSnapshotEnabled','false','3.0'); select fn_db_add_config_value('LiveSnapshotEnabled','true','3.1'); @@ -662,6 +658,10 @@ select fn_db_delete_config_value('LogVdsRegistration','general'); select fn_db_delete_config_value('IsNeedSupportForOldVgAPI','2.2'); select fn_db_delete_config_value('IsNeedSupportForOldVgAPI','3.0'); +select fn_db_delete_config_value('LimitNumberOfNetworkInterfaces','2.2'); +select fn_db_delete_config_value('LimitNumberOfNetworkInterfaces','3.0'); +select fn_db_delete_config_value('LimitNumberOfNetworkInterfaces','3.1'); +select fn_db_delete_config_value('LimitNumberOfNetworkInterfaces','3.2'); ------------------------------------------------------------------------------------ -- Split config section -- The purpose of this section is to treat config option that was once diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java index c17c413..c64adc5 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java @@ -308,15 +308,6 @@ } } - if (returnValue && Config.<Boolean> GetValue(ConfigValues.LimitNumberOfNetworkInterfaces, - getVdsGroup().getcompatibility_version().toString())) { - // check that we have no more then 8 interfaces (kvm limitation in version 2.x) - if (!validateNumberOfNics(getVmInterfaces(), null)) { - addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_EXITED_MAX_INTERFACES); - returnValue = false; - } - } - // check for Vm Payload if (returnValue && getParameters().getVmPayload() != null) { returnValue = checkPayload(getParameters().getVmPayload(), diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmInterfaceCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmInterfaceCommand.java index 1a0269d..e5a9d3b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmInterfaceCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmInterfaceCommand.java @@ -161,18 +161,6 @@ return false; } - // check that the number of interfaces does not exceed limit. Necessary - // only for version 2.2. - boolean limitNumOfNics = Config.<Boolean> GetValue(ConfigValues.LimitNumberOfNetworkInterfaces, getVm() - .getvds_group_compatibility_version().toString()); - if (limitNumOfNics) { - boolean numOfNicsLegal = validateNumberOfNics(interfaces, getParameters().getInterface()); - if (!numOfNicsLegal) { - addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_EXITED_MAX_INTERFACES); - return false; - } - } - // check that the exists in current cluster List<Network> networks = DbFacade.getInstance().getNetworkDao().getAllForCluster(vm.getvds_group_id()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java index 79de676..d605f55 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java @@ -14,8 +14,6 @@ import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VmNetworkInterface; import org.ovirt.engine.core.common.businessentities.Network; -import org.ovirt.engine.core.common.config.Config; -import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.dal.VdcBllMessages; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.utils.ObjectIdentityChecker; @@ -58,25 +56,6 @@ List<VmNetworkInterface> interfaces = DbFacade.getInstance().getVmNetworkInterfaceDao() .getAllForVm(getParameters().getVmId()); - - // Get if the cluster chosen got limit of nics. - boolean limitNumOfNics = Config.<Boolean> GetValue(ConfigValues.LimitNumberOfNetworkInterfaces, - targetCluster.getcompatibility_version() - .getValue() - .toString()); - - // If so , check if nic count has exceeded and print appropriate - // message. - if (limitNumOfNics) { - // Check that the number of interfaces does not exceed - // limit. - // Necessary only for version 2.2. - boolean numOfNicsLegal = validateNumberOfNics(interfaces, null); - if (!numOfNicsLegal) { - addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_EXITED_MAX_INTERFACES); - return false; - } - } // Check the destination cluster have all the networks that the VM use List<Network> networks = DbFacade.getInstance().getNetworkDao().getAllForCluster(getParameters().getClusterId()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java index c33c446..73da09a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java @@ -50,8 +50,6 @@ import org.ovirt.engine.core.common.businessentities.VmTemplate; import org.ovirt.engine.core.common.businessentities.VmTemplateStatus; import org.ovirt.engine.core.common.businessentities.storage_domains; -import org.ovirt.engine.core.common.config.Config; -import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters; import org.ovirt.engine.core.common.queries.GetStorageDomainsByVmTemplateIdQueryParameters; @@ -356,16 +354,6 @@ addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); break; } - } - } - - if (retVal && Config.<Boolean> GetValue(ConfigValues.LimitNumberOfNetworkInterfaces, - getVdsGroup().getcompatibility_version().toString())) { - // check that we have no more then 8 interfaces (kvm limitation in - // version 2.x) - if (!VmCommand.validateNumberOfNics(vm.getInterfaces(), null)) { - addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_EXITED_MAX_INTERFACES); - retVal = false; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmInterfaceCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmInterfaceCommand.java index 9c486ac..33ae9a9 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmInterfaceCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmInterfaceCommand.java @@ -126,20 +126,6 @@ return false; } - // check that the number of interfaces does not exceed limit. Necessary - // only for versions 2.1, 2.2. - boolean limitNumOfNics = Config.<Boolean> GetValue(ConfigValues.LimitNumberOfNetworkInterfaces, getVm() - .getvds_group_compatibility_version().toString()); - if (limitNumOfNics) { - interfaces.remove(oldIface); - boolean numOfNicsLegal = validateNumberOfNics(interfaces, getParameters().getInterface()); - interfaces.add(oldIface); - if (!numOfNicsLegal) { - addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_EXITED_MAX_INTERFACES); - return false; - } - } - if (getParameters().getInterface().getVmTemplateId() != null) { addCanDoActionMessage(VdcBllMessages.NETWORK_INTERFACE_TEMPLATE_CANNOT_BE_SET); return false; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java index 4597909..6b714f5 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java @@ -436,26 +436,6 @@ } } - /** - * check that we number of Network-Interfaces does not exceed maximum (kvm limitation). This limitation is different - * for RHEL-5.5 and RHEL-6.0. This is expresses in configuraiton parameters. - * - * @param interfaces - * @return false if validation failed; i.e thera are more nics than allowed. true if validation succeeded. - */ - public static boolean validateNumberOfNics(List<VmNetworkInterface> interfaces, VmNetworkInterface networkInterface) { - int ifCount = 0; - if (networkInterface != null && networkInterface.getType() != null) { - ifCount += (VmInterfaceType.forValue(networkInterface.getType()) == VmInterfaceType.rtl8139_pv ? 2 : 1); - } - for (VmNetworkInterface i : interfaces) { - if (i.getType() != null) { - ifCount += (i.getType() == VmInterfaceType.rtl8139_pv.getValue()) ? 2 : 1; - } - } - return (ifCount <= MAX_NETWORK_INTERFACES_SUPPORTED); - } - protected boolean canPerformHotPlug() { return isHotPlugSupported() && isOsSupportingHotPlug(); } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java index a47f493..3956271 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java @@ -2,8 +2,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.spy; import java.util.Set; @@ -51,7 +49,6 @@ private ImportVmCommand setupDiskSpaceTest(final int diskSpaceRequired, final int diskSpacePct) { mcr.mockConfigValue(ConfigValues.FreeSpaceCriticalLowInGB, diskSpaceRequired); mcr.mockConfigValue(ConfigValues.FreeSpaceLow, diskSpacePct); - mcr.mockConfigValue(eq(ConfigValues.LimitNumberOfNetworkInterfaces), anyString(), Boolean.TRUE); return new TestHelperImportVmCommand(createParameters()); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java index 74588e1..116d7a7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java @@ -926,11 +926,6 @@ MaxNumberOfHostsInStoragePool(274), @Reloadable - @TypeConverterAttribute(Boolean.class) - @DefaultValueAttribute("true") - LimitNumberOfNetworkInterfaces(275), - - @Reloadable @TypeConverterAttribute(Integer.class) @DefaultValueAttribute("15") MaxVmNameLengthWindows(276), 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 d5a516f..d7ddfcd 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 @@ -375,7 +375,6 @@ NETWORK_ADDR_MANDATORY_IN_STATIC_IP, NETWORK_MAC_ADDRESS_IN_USE, NETWORK_INVALID_MAC_ADDRESS, - NETWORK_INTERFACE_EXITED_MAX_INTERFACES, NETWORK_INTERFACE_NAME_ALREADY_IN_USE, NETWORK_INTERFACE_IN_USE_BY_VLAN, NETWORK_INTERFACE_CANNOT_UPDATE_INTERFACE_VLAN, 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 7d0bf96..7acc919 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -452,7 +452,6 @@ VM_CLUSTER_IS_NOT_VALID=Cannot ${action} ${type}. Cluster ID is not valid. NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK=The Management Network ('${NetworkName}') is mandatory and cannot be removed. NETWORK_OLD_NETWORK_NOT_SPECIFIED=Previous network name is required. -NETWORK_INTERFACE_EXITED_MAX_INTERFACES=Cannot ${action} ${type}. VM cannot have more than 8 interfaces. ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS=Cannot ${action} ${type}. Active VMs were detected.\n\ -Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first. ACTION_TYPE_FAILED_HOST_NOT_EXIST=The provided Host does not exist. diff --git a/backend/manager/modules/utils/src/test/resources/AppErrors.properties b/backend/manager/modules/utils/src/test/resources/AppErrors.properties index a7c72b5..150c3c7 100644 --- a/backend/manager/modules/utils/src/test/resources/AppErrors.properties +++ b/backend/manager/modules/utils/src/test/resources/AppErrors.properties @@ -315,7 +315,6 @@ ACTION_TYPE_FAILED_XP_MEMORY_ERROR=Cannot ${action} ${type}. Illegal memory defined for Windows XP. NETWORK_INTERFACE_CANNOT_UPDATE_INTERFACE_VLAN=Cannot update Network with VLAN, you need to set the interface to "None" Network NETWORK_OLD_NETWORK_NOT_SPECIFIED=Old network name is required -NETWORK_INTERFACE_EXITED_MAX_INTERFACES=You cannot add more than 8 interfaces ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS=Cannot ${action} ${type}. Detected running VMs. TAGS_SPECIFY_TAG_IS_IN_USE=Specified tag is in use NETWORK_NET_EXISTS_IN_CLUSTER=Network not exists in cluster 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 9c25876..5614f07 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 @@ -1195,9 +1195,6 @@ @DefaultStringValue("Previous network name is required.") String NETWORK_OLD_NETWORK_NOT_SPECIFIED(); - @DefaultStringValue("Cannot ${action} ${type}. VM cannot have more than 8 interfaces.") - String NETWORK_INTERFACE_EXITED_MAX_INTERFACES(); - @DefaultStringValue("Cannot ${action} ${type}. Active VMs were detected.\n-Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first.") String ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 7743fb0..9de9ef3 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -448,7 +448,6 @@ VM_CLUSTER_IS_NOT_VALID=Cannot ${action} ${type}. Cluster ID is not valid. NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK=The Management Network ('${NetworkName}') is mandatory and cannot be removed. NETWORK_OLD_NETWORK_NOT_SPECIFIED=Previous network name is required. -NETWORK_INTERFACE_EXITED_MAX_INTERFACES=Cannot ${action} ${type}. VM cannot have more than 8 interfaces. ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS=Cannot ${action} ${type}. Active VMs were detected.\n\ -Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first. ACTION_TYPE_FAILED_HOST_NOT_EXIST=The provided Host does not exist. 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 6076ef1..ccfb9e8 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 @@ -446,7 +446,6 @@ VM_CLUSTER_IS_NOT_VALID=Cannot ${action} ${type}. Cluster ID is not valid. NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK=The Management Network ('${NetworkName}') is mandatory and cannot be removed. NETWORK_OLD_NETWORK_NOT_SPECIFIED=Previous network name is required. -NETWORK_INTERFACE_EXITED_MAX_INTERFACES=Cannot ${action} ${type}. VM cannot have more than 8 interfaces. ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS=Cannot ${action} ${type}. Active VMs were detected.\n\ -Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first. ACTION_TYPE_FAILED_HOST_NOT_EXIST=The provided Host does not exist. -- To view, visit http://gerrit.ovirt.org/9486 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I52c53990fa7440107ddc14ceba58b1971340a8e0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
