Gilad Chaplik has uploaded a new change for review.

Change subject: core: New internal command, VmSlaPolicyCommand
......................................................................

core: New internal command, VmSlaPolicyCommand

Adding a new command to handle the SLA parameters.
For now the new command only contains the CPU Limit parameter
which limits the VM's CPU consumption.

This Command will be called from the updateVmCommand, and 
updateMomPolicyCommand.
later on it will be called from other parts of the system that configures SLA 
parameters.

Change-Id: I26b0794c52cfe1d352f26392a835023afcd9efa0
Bug-Url: https://bugzilla.redhat.com/1084930
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.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/action/VdcActionType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmSlaPolicyParameters.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
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/UpdateVmPolicyVDSParams.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
A 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/UpdateVmPolicyVDSCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
17 files changed, 199 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/31829/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java
new file mode 100644
index 0000000..1bfef52
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java
@@ -0,0 +1,72 @@
+package org.ovirt.engine.core.bll;
+
+import org.ovirt.engine.core.bll.validator.LocalizedVmStatus;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.FeatureSupported;
+import org.ovirt.engine.core.common.action.VmSlaPolicyParameters;
+import org.ovirt.engine.core.common.businessentities.VMStatus;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.vdscommands.UpdateVmPolicyVDSParams;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+
+/**
+ * VmSlaPolicyCommand, This command will push SLA parameters such as CPU, RAM 
and IO
+ * tuning to the VM. This Command runs as a hot plug (when the VM is running).
+ *
+ * The execute will never throw an exception. it will rather wrap a return 
value in case
+ * of failure.
+ */
+@NonTransactiveCommandAttribute
+public class VmSlaPolicyCommand<T extends VmSlaPolicyParameters> extends 
VmManagementCommandBase<T> {
+
+    public static final String LOGABLE_FIELD_CPU_LIMIT = "cpuLimit";
+
+    public VmSlaPolicyCommand(T parameters) {
+        super(parameters);
+        if (getParameters().getVm() != null) {
+            setVm(getParameters().getVm());
+        }
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (getVm() == null) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST);
+        }
+        if (getVm().getStatus() != VMStatus.Up) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL,
+                    LocalizedVmStatus.from(getVm().getStatus()));
+        }
+        if 
(!FeatureSupported.vmSlaPolicy(getVm().getVdsGroupCompatibilityVersion())) {
+            return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED);
+        }
+
+        return true;
+    }
+
+    /**
+     * Execution shall perform a call to VDSM to set the SLA parameters.
+     */
+    @Override
+    protected void executeCommand() {
+        VDSReturnValue vdsReturnValue = 
runVdsCommand(VDSCommandType.UpdateVmPolicy,
+                new UpdateVmPolicyVDSParams(getVm().getRunOnVds(), getVmId(), 
getParameters().getCpuLimit()));
+
+        setSucceeded(vdsReturnValue.getSucceeded());
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        addCustomValue(LOGABLE_FIELD_CPU_LIMIT,
+                String.valueOf(getParameters().getCpuLimit()));
+
+        return getSucceeded() ? AuditLogType.VM_SLA_POLICY : 
AuditLogType.FAILED_VM_SLA_POLICY;
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE_SLA_POLICY);
+        addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM);
+    }
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index feb4bcd..d02d390 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -1064,7 +1064,10 @@
     USER_REMOVE_AUDIT_LOG(10600),
     USER_REMOVE_AUDIT_LOG_FAILED(10601, AuditLogSeverity.ERROR),
     USER_CLEAR_ALL_DISMISSED_AUDIT_LOG(10602),
-    USER_CLEAR_ALL_DISMISSED_AUDIT_LOG_FAILED(10603, AuditLogSeverity.ERROR);
+    USER_CLEAR_ALL_DISMISSED_AUDIT_LOG_FAILED(10603, AuditLogSeverity.ERROR),
+
+    VM_SLA_POLICY(10550),
+    FAILED_VM_SLA_POLICY(10551, AuditLogSeverity.ERROR);
 
     private int intValue;
     // indicates time interval in seconds on which identical events from same 
instance are suppressed.
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 b537a05..9230cbd 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
@@ -61,6 +61,16 @@
     /**
      * @param version
      *            Compatibility version to check for.
+     * @return <code>true</code> if VM SLA policy is supported for the version,
+     *         <code>false</code> if it's not.
+     */
+    public static boolean vmSlaPolicy(Version version) {
+        return supportedInConfig(ConfigValues.VmSlaPolicySupported, version);
+    }
+
+    /**
+     * @param version
+     *            Compatibility version to check for.
      * @return <code>true</code> if bridges element reported by VDSM is 
supported for the version, <code>false</code> if
      *         it's not.
      */
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
index 8cd48d4..aad58a6 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
@@ -42,6 +42,7 @@
     HotPlugDiskToVm(182, ActionGroup.CONFIGURE_VM_STORAGE, false, 
QuotaDependency.NONE),
     HotUnPlugDiskFromVm(183, ActionGroup.CONFIGURE_VM_STORAGE, false, 
QuotaDependency.NONE),
     HotSetNumberOfCpus(184, ActionGroup.EDIT_VM_PROPERTIES, false, 
QuotaDependency.VDS_GROUP, true),
+    VmSlaPolicy(185, ActionGroup.EDIT_VM_PROPERTIES, false, 
QuotaDependency.NONE),
     ChangeFloppy(35, QuotaDependency.NONE),
     ImportVm(36, ActionGroup.IMPORT_EXPORT_VM, QuotaDependency.STORAGE),
     RemoveVmFromImportExport(37, ActionGroup.DELETE_VM, QuotaDependency.NONE),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmSlaPolicyParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmSlaPolicyParameters.java
new file mode 100644
index 0000000..e3e7c7a
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmSlaPolicyParameters.java
@@ -0,0 +1,22 @@
+package org.ovirt.engine.core.common.action;
+
+import org.ovirt.engine.core.compat.Guid;
+
+public class VmSlaPolicyParameters extends VmManagementParametersBase {
+
+    private static final long serialVersionUID = 3918909396931144459L;
+    private int cpuLimit;
+
+    public VmSlaPolicyParameters() {
+    }
+
+    public VmSlaPolicyParameters(Guid vmId, int cpuLimit) {
+        setVmId(vmId);
+        this.cpuLimit = cpuLimit;
+    }
+
+    public int getCpuLimit() {
+        return cpuLimit;
+    }
+
+}
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 b788376..5843fc9 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
@@ -1091,6 +1091,10 @@
     @DefaultValueAttribute("true")
     NonVmNetworkSupported,
 
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("true")
+    VmSlaPolicySupported,
+
     @TypeConverterAttribute(List.class)
     @DefaultValueAttribute("0,2")
     @OptionBehaviourAttribute(behaviour = 
OptionBehaviour.CommaSeparatedStringArray)
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 36bd3f3..40c727b 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
@@ -104,6 +104,7 @@
     VAR__ACTION__REMOVE_BRICKS_STOP,
     VAR__ACTION__REMOVE_BRICKS_COMMIT,
     VAR__ACTION__HOT_SET_CPUS,
+    VAR__ACTION__UPDATE_SLA_POLICY,
     VAR__ACTION__UPDATE_VM_VERSION,
 
     // Host statuses replacements
@@ -813,6 +814,7 @@
     ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_CANNOT_RESIZE_DISK_SNAPSHOT(ErrorType.CONFLICT),
     NON_VM_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL(ErrorType.NOT_SUPPORTED),
+    VM_SLA_POLICY_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED),
     VALIDATION_STORAGE_CONNECTION_INVALID(ErrorType.BAD_PARAMETERS),
     VALIDATION_STORAGE_CONNECTION_INVALID_PORT(ErrorType.BAD_PARAMETERS),
     VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE(ErrorType.BAD_PARAMETERS),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/UpdateVmPolicyVDSParams.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/UpdateVmPolicyVDSParams.java
new file mode 100644
index 0000000..a1f7e81
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/UpdateVmPolicyVDSParams.java
@@ -0,0 +1,21 @@
+package org.ovirt.engine.core.common.vdscommands;
+
+import org.ovirt.engine.core.compat.Guid;
+
+public class UpdateVmPolicyVDSParams extends VdsAndVmIDVDSParametersBase {
+
+    private int cpuLimit;
+
+    private UpdateVmPolicyVDSParams() {
+    }
+
+    public UpdateVmPolicyVDSParams(Guid vdsId, Guid vmId, int cpuLimit) {
+        super(vdsId, vmId);
+        this.cpuLimit = cpuLimit;
+    }
+
+    public int getCpuLimit() {
+        return cpuLimit;
+    }
+
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java
index 456d771..9e47eeb 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java
@@ -158,6 +158,7 @@
     GlusterTasksList("org.ovirt.engine.core.vdsbroker.gluster"),
     
GetGlusterVolumeRemoveBricksStatus("org.ovirt.engine.core.vdsbroker.gluster"),
     SetNumberOfCpus("org.ovirt.engine.core.vdsbroker"),
+    UpdateVmPolicy("org.ovirt.engine.core.vdsbroker"),
     List("org.ovirt.engine.core.vdsbroker.vdsbroker"),           // get a list 
of VMs with status only
     GetVmStats("org.ovirt.engine.core.vdsbroker.vdsbroker"),     // get a VM 
with full data and statistics
     GetAllVmStats("org.ovirt.engine.core.vdsbroker.vdsbroker");  // get a list 
of VMs with full data and statistics
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 3dca4aa..4b3ec16 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -348,6 +348,7 @@
 VAR__ACTION__HOT_PLUG=$action hot plug
 VAR__ACTION__HOT_UNPLUG=$action hot unplug
 VAR__ACTION__HOT_SET_CPUS=$action hot set cpus
+VAR__ACTION__UPDATE_SLA_POLICY=$action update sla policy
 VAR__ACTION__LOGON=$action log on
 VAR__ACTION__LOGOFF=$action log off
 VAR__ACTION__ASSIGN=$action assign
@@ -1005,6 +1006,8 @@
 ACTION_TYPE_FAILED_BASE_TEMPLATE_DOES_NOT_EXIST=Cannot ${action} ${type}. Base 
Template does not exist for this Template Version.
 
 NON_VM_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL=Non-VM networks are not supported 
in this Data-Center.
+
+VM_SLA_POLICY_NOT_SUPPORTED=VM SLA Policy is not supported in this Cluster.
 # Gluster Error Messages
 VAR__TYPE__GLUSTER_VOLUME=$type Gluster Volume
 VAR__TYPE__GLUSTER_VOLUME_OPTION=$type Gluster Volume Option
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index 8a4a37a..93345be 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -836,6 +836,8 @@
 USER_FAILED_TO_REMOVE_AFFINITY_GROUP=Failed to remove Affinity Group 
${affinityGroupName}. (User: ${UserName})
 USER_SET_HOSTED_ENGINE_MAINTENANCE=Hosted Engine HA maintenance mode was 
updated on host ${VdsName}.
 USER_FAILED_TO_SET_HOSTED_ENGINE_MAINTENANCE=Hosted Engine HA maintenance mode 
could not be updated on host ${VdsName}.
+VM_SLA_POLICY=VM ${VmName} SLA Policy was set. CPU limit is set to ${cpuLimit}
+FAILED_VM_SLA_POLICY= Failed to set SLA Policy to VM ${VmName}. Underlying 
error message: ${ErrorMessage}
 
 ISCSI_BOND_ADD_SUCCESS=iSCSI bond '${IscsiBondName}' was successfully created 
in Data Center '${StoragePoolName}'.
 ISCSI_BOND_ADD_SUCCESS_WITH_WARNING=iSCSI bond '${IscsiBondName}' was 
successfully created in Data Center '${StoragePoolName}' but some of the hosts 
encountered connection issues.
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/UpdateVmPolicyVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/UpdateVmPolicyVDSCommand.java
new file mode 100644
index 0000000..0a2363f
--- /dev/null
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/UpdateVmPolicyVDSCommand.java
@@ -0,0 +1,28 @@
+package org.ovirt.engine.core.vdsbroker;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ovirt.engine.core.common.vdscommands.UpdateVmPolicyVDSParams;
+import org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerCommand;
+
+public class UpdateVmPolicyVDSCommand<P extends UpdateVmPolicyVDSParams> 
extends VdsBrokerCommand<P> {
+
+    public UpdateVmPolicyVDSCommand(P parameters) {
+        super(parameters);
+    }
+
+    @Override
+    protected void executeVdsBrokerCommand() {
+        getBroker().updateVmPolicy(build());
+        proceedProxyReturnValue();
+    }
+
+    protected Map<String, Object> build() {
+        Map<String, Object> struct = new HashMap<>();
+        struct.put("vmId", getParameters().getVmId().toString());
+        struct.put("vcpuLimit", String.valueOf(getParameters().getCpuLimit()));
+        return struct;
+    }
+
+}
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java
index 6987d63..bbba12b 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java
@@ -1401,6 +1401,16 @@
     }
 
     @Override
+    public StatusOnlyReturnForXmlRpc updateVmPolicy(Map params) {
+        JsonRpcRequest request =
+                new 
RequestBuilder("VM.updateVmPolicy").withParameter("params", params)
+                        .build();
+        Map<String, Object> response =
+                new FutureMap(this.client, request);
+        return new StatusOnlyReturnForXmlRpc(response);
+    }
+
+    @Override
     public StatusOnlyReturnForXmlRpc setHaMaintenanceMode(String mode, boolean 
enabled) {
         JsonRpcRequest request =
                 new 
RequestBuilder("Host.setHaMaintenanceMode").withParameter("mode", mode)
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java
index 4d3f8cf..ff27a06 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java
@@ -303,4 +303,6 @@
     GlusterVolumeTaskReturnForXmlRpc glusterVolumeRemoveBrickStatus(String 
volumeName, String[] bricksList);
 
     StatusOnlyReturnForXmlRpc setNumberOfCpus(String vmId, String 
numberOfCpus);
+
+    StatusOnlyReturnForXmlRpc updateVmPolicy(Map info);
 }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java
index 69c1ae7..c937834 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java
@@ -292,4 +292,6 @@
     public Map<String, Object> glusterVolumeRemoveBrickStatus(String 
volumeName, String[] bricksList);
 
     public Map<String, Object> setNumberOfCpus(String vmId, String 
numberOfCpus);
+
+    public Map<String, Object> updateVmPolicy(Map info);
 }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java
index 02ec14f..82e28e0 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java
@@ -1384,6 +1384,15 @@
     }
 
     @Override
+    public StatusOnlyReturnForXmlRpc updateVmPolicy(Map info) {
+        try {
+            return new 
StatusOnlyReturnForXmlRpc(vdsServer.updateVmPolicy(info));
+        } catch (UndeclaredThrowableException ute) {
+            throw new XmlRpcRunTimeException(ute);
+        }
+    }
+
+    @Override
     public StatusOnlyReturnForXmlRpc setMOMPolicyParameters(Map<String, 
Object> key_value_store) {
         try {
             Map<String, Object> xmlRpcReturnValue = 
vdsServer.setMOMPolicyParameters(key_value_store);
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index c0a4e9f..934303a 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -336,6 +336,12 @@
 select fn_db_add_config_value('JsonProtocolSupported','false','3.3');
 select fn_db_add_config_value('JsonProtocolSupported','false','3.4');
 
+select fn_db_add_config_value('VmSlaPolicySupported','false','3.0');
+select fn_db_add_config_value('VmSlaPolicySupported','false','3.1');
+select fn_db_add_config_value('VmSlaPolicySupported','false','3.2');
+select fn_db_add_config_value('VmSlaPolicySupported','false','3.3');
+select fn_db_add_config_value('VmSlaPolicySupported','false','3.4');
+
 -- by default use no proxy
 select fn_db_add_config_value('SpiceProxyDefault','','general');
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I26b0794c52cfe1d352f26392a835023afcd9efa0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com>
Gerrit-Reviewer: Kobi Ianko <k...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to