Tomas Jelinek has uploaded a new change for review.

Change subject: core: changed the list of fields which can not be overridden
......................................................................

core: changed the list of fields which can not be overridden

Some of the fields on the instance types are prohibited to be overridden
because in such a case the VM would not be considered to be based on that
instance type anymore.

This patch reduces the num of fields which can not be overridden to contain
only the really most important ones. This avoids the situation that the user 
will
have to have instance types like: "big with soundcard", "big with smardcard and
soundcard" etc.

The list is now significantly smaller, contains only:
- memory size
- num of sockets/cores per socket
- HA
- migration model/downtime
- priority
- balloon/min allocated memory

Change-Id: I6142a240d60d54634361d3e6427b2a56fbd01362
Bug-Url: https://bugzilla.redhat.com/1149663
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
1 file changed, 14 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/35133/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
index 9b365cf..aa05d8b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
@@ -12,16 +12,14 @@
 import org.ovirt.engine.core.bll.context.CommandContext;
 import org.ovirt.engine.core.bll.profiles.CpuProfileHelper;
 import org.ovirt.engine.core.bll.utils.VmDeviceUtils;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.action.VmManagementParametersBase;
 import org.ovirt.engine.core.common.businessentities.InstanceType;
 import org.ovirt.engine.core.common.businessentities.MigrationSupport;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VmDevice;
-import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType;
-import org.ovirt.engine.core.common.businessentities.VmRngDevice;
 import org.ovirt.engine.core.common.businessentities.VmStatic;
-import org.ovirt.engine.core.common.businessentities.VmWatchdog;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
@@ -274,29 +272,22 @@
             vmStatic.setMemSizeMb(instanceType.getMemSizeMb());
             vmStatic.setNumOfSockets(instanceType.getNumOfSockets());
             vmStatic.setCpuPerSocket(instanceType.getCpuPerSocket());
-            
vmStatic.setDefaultBootSequence(instanceType.getDefaultBootSequence());
-            
vmStatic.setDefaultDisplayType(instanceType.getDefaultDisplayType());
-            vmStatic.setPriority(instanceType.getPriority());
-            vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem());
-            vmStatic.setTunnelMigration(instanceType.getTunnelMigration());
+            vmStatic.setAutoStartup(instanceType.isAutoStartup());
 
-            // use sound card only if instance type has it
-            
getParameters().setSoundDeviceEnabled(!VmDeviceUtils.getSoundDevices(instanceType.getId()).isEmpty());
-
-            
getParameters().setVirtioScsiEnabled(!VmDeviceUtils.getVirtioScsiControllers(instanceType.getId()).isEmpty());
-
-            getParameters().setUpdateWatchdog(true);
-            List<VmDevice> vmDevices = 
VmDeviceUtils.getWatchdogs(instanceType.getId());
-            if (!vmDevices.isEmpty()) {
-                vmDevices.get(0).setVmId(getVmId());
-                getParameters().setWatchdog(new VmWatchdog(vmDevices.get(0)));
+            if 
(FeatureSupported.isMigrationSupported(getVdsGroup().getArchitecture(), 
getVdsGroup().getcompatibility_version())) {
+                
vmStatic.setMigrationSupport(instanceType.getMigrationSupport());
             }
 
-            getParameters().setUpdateRngDevice(true);
-            vmDevices = 
getVmDeviceDao().getVmDeviceByVmIdAndType(instanceType.getId(), 
VmDeviceGeneralType.RNG);
-            if (!vmDevices.isEmpty()) {
-                vmDevices.get(0).setVmId(getVmId());
-                getParameters().setRngDevice(new 
VmRngDevice(vmDevices.get(0)));
+            vmStatic.setMigrationDowntime(instanceType.getMigrationDowntime());
+            vmStatic.setPriority(instanceType.getPriority());
+            vmStatic.setTunnelMigration(instanceType.getTunnelMigration());
+
+            List<VmDevice> vmDevices = 
VmDeviceUtils.getBalloonDevices(instanceType.getId());
+            vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem());
+            if (vmDevices.isEmpty()) {
+                getParameters().setBalloonEnabled(false);
+            } else if 
(osRepository.isBalloonEnabled(getParameters().getVmStaticData().getOsId(), 
getVdsGroup().getcompatibility_version())) {
+                getParameters().setBalloonEnabled(true);
             }
         }
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6142a240d60d54634361d3e6427b2a56fbd01362
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to