Omer Frenkel has uploaded a new change for review.

Change subject: core: allow using cloud init only from 3.3
......................................................................

core: allow using cloud init only from 3.3

since cloud init uses new vdsm capability to set cd volume name,
it is supported only from 3.3
add check in canDoAction to enforce this.

Change-Id: I88d4ba3ca4dc24bdd3c12aeaf8168683e60096d9
Signed-off-by: Omer Frenkel <ofren...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/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/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
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
9 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/17476/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
index c5227a5..4d2aa57 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
@@ -8,6 +8,7 @@
 import org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter;
 import org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter;
 import org.ovirt.engine.core.bll.quota.QuotaStorageDependent;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.action.RunVmOnceParams;
 import org.ovirt.engine.core.common.action.RunVmParams;
 import org.ovirt.engine.core.common.action.SysPrepParams;
@@ -33,6 +34,11 @@
             return 
failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM);
         }
 
+        if (getParameters().getCloudInitParameters() != null
+                && 
!FeatureSupported.cloudInit(getVm().getVdsGroupCompatibilityVersion())) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED);
+        }
+
         return true;
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
index ae8c2a3..5095dc6 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
@@ -140,4 +140,13 @@
     public static boolean setupManagementNetwork(Version version) {
         return supportedInConfig(ConfigValues.NormalizedMgmgNetworkEnabled, 
version);
     }
+
+    /**
+     * @param version
+     *            Compatibility version to check for.
+     * @return <code>true</code> if cloud-init is supported for the cluster 
version.
+     */
+    public static boolean cloudInit(Version version) {
+        return supportedInConfig(ConfigValues.CloudInitSupported, version);
+    }
 }
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 e3298f9..5bcad36 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
@@ -1449,6 +1449,10 @@
     @DefaultValueAttribute("true")
     NormalizedMgmgNetworkEnabled(522),
 
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("true")
+    CloudInitSupported(523),
+
     Invalid(65535);
 
     private int intValue;
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 8d744fd..f0c8327 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -423,6 +423,7 @@
     NETWORK_MTU_DIFFERENCES(ErrorType.CONFLICT),
     NETWORK_MTU_OVERRIDE_NOT_SUPPORTED(ErrorType.CONFLICT),
     EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED(ErrorType.NOT_SUPPORTED),
+    ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED),
     
ACTION_TYPE_FAILED_MIGRATION_NETWORK_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED),
     ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_MANAGEMENT_NETWORK_REQUIRED(ErrorType.BAD_PARAMETERS),
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 b0112ae..9b85b15 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -968,3 +968,4 @@
 ACTION_TYPE_FAILED_STORAGE_DOMAIN_UNAVAILABLE=Cannot register disk ${diskId} 
on storage domain ${domainId} as it is unavailable.
 ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED=Disks may only be 
registered from a data storage domain. The storage domain {$domainId} is type 
{$domainType}.
 FAILED_TO_RUN_LDAP_QUERY=Failed to run LDAP query, please check server logs 
for more info.
+ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED=Cannot ${action} ${type}. 
Cloud-Init is not supported in this cluster compatibility 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 fbfc319..93cf8dc 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
@@ -2557,4 +2557,7 @@
 
     @DefaultStringValue("Cannot ${action} ${type}. Function factor cannot be 
negative.")
     String ACTION_TYPE_FAILED_CLUSTER_POLICY_FUNCTION_FACTOR_NEGATIVE();
+
+    @DefaultStringValue("Cannot ${action} ${type}. Cloud-Init is not supported 
in this cluster compatibility version.")
+    String ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED();
 }
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 573b013..f10b5dd 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
@@ -849,3 +849,4 @@
 ACTION_TYPE_NO_JOB=Cannot ${action} ${type}. Job not found.
 ACTION_TYPE_NO_STEP=Cannot ${action} ${type}. Step not found.
 ACTION_TYPE_NON_MONITORED=Cannot ${action} ${type}. Non monitored command.
+ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED=Cannot ${action} ${type}. 
Cloud-Init is not supported in this cluster compatibility version.
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 2bfd719..9d51431 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
@@ -943,3 +943,4 @@
 ACTION_TYPE_NO_JOB=Cannot ${action} ${type}. Job not found.
 ACTION_TYPE_NO_STEP=Cannot ${action} ${type}. Step not found.
 ACTION_TYPE_NON_MONITORED=Cannot ${action} ${type}. Non monitored command.
+ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED=Cannot ${action} ${type}. 
Cloud-Init is not supported in this cluster compatibility version.
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index c8b692c..5ac6f23 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -196,6 +196,9 @@
 select 
fn_db_add_config_value('VirtIoScsiUnsupportedOsList','WindowsXP,RHEL5,RHEL5x64,RHEL4,RHEL4x64,RHEL3,RHEL3x64','general');
 select fn_db_add_config_value('NormalizedMgmgNetworkEnabled','false','3.0');
 select fn_db_add_config_value('NormalizedMgmgNetworkEnabled','false','3.1');
+select fn_db_add_config_value('CloudInitSupported','false','3.0');
+select fn_db_add_config_value('CloudInitSupported','false','3.1');
+select fn_db_add_config_value('CloudInitSupported','false','3.2');
 
 -- by default use no proxy
 select fn_db_add_config_value('SpiceProxyDefault','','general');


-- 
To view, visit http://gerrit.ovirt.org/17476
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88d4ba3ca4dc24bdd3c12aeaf8168683e60096d9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Omer Frenkel <ofren...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to