Maor Lipchuk has uploaded a new change for review.

Change subject: core: Add managed devices to OVF
......................................................................

core: Add managed devices to OVF

Add all managed devices to the VM before generating the OVF for
OVF_STORE disk.

Change-Id: Ie0e912c9b2950f1461ae95f4704f18b818b83a3b
Bug-Url: https://bugzilla.redhat.com/1191397
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfUpdateProcessHelper.java
1 file changed, 3 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/42/38242/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfUpdateProcessHelper.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfUpdateProcessHelper.java
index 63ddf2d..7284774 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfUpdateProcessHelper.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfUpdateProcessHelper.java
@@ -1,18 +1,15 @@
 package org.ovirt.engine.core.bll;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.utils.ClusterUtils;
+import org.ovirt.engine.core.bll.utils.VmDeviceUtils;
 import org.ovirt.engine.core.common.businessentities.Disk;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
 import org.ovirt.engine.core.common.businessentities.VM;
-import org.ovirt.engine.core.common.businessentities.VmBase;
-import org.ovirt.engine.core.common.businessentities.VmDevice;
-import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType;
 import org.ovirt.engine.core.common.businessentities.VmTemplate;
 import org.ovirt.engine.core.common.vdscommands.RemoveVMVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.UpdateVMVDSCommandParameters;
@@ -81,7 +78,7 @@
      * Loads additional need vm data for it's ovf
      */
     protected void loadVmData(VM vm) {
-        setManagedVideoDevices(vm.getStaticData());
+        VmDeviceUtils.setVmDevices(vm.getStaticData());
         if (vm.getInterfaces().isEmpty()) {
             
vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId()));
         }
@@ -92,20 +89,6 @@
             } else {
                 vm.setVmtName(VmTemplateHandler.BLANK_VM_TEMPLATE_NAME);
             }
-        }
-    }
-
-    private void setManagedVideoDevices(VmBase vmBase) {
-        Map<Guid, VmDevice> managedDeviceMap = vmBase.getManagedDeviceMap();
-        if (managedDeviceMap == null) {
-            managedDeviceMap = new HashMap<Guid, VmDevice>();
-        }
-        List<VmDevice> devices =
-                DbFacade.getInstance()
-                        .getVmDeviceDao()
-                        .getVmDeviceByVmIdAndType(vmBase.getId(), 
VmDeviceGeneralType.VIDEO);
-        for (VmDevice device : devices) {
-            managedDeviceMap.put(device.getDeviceId(), device);
         }
     }
 
@@ -128,7 +111,7 @@
      * Loads additional need template data for it's ovf
      */
     protected void loadTemplateData(VmTemplate template) {
-        setManagedVideoDevices(template);
+        VmDeviceUtils.setVmDevices(template);
         if (template.getInterfaces() == null || 
template.getInterfaces().isEmpty()) {
             template.setInterfaces(getVmNetworkInterfaceDao()
                     .getAllForTemplate(template.getId()));


-- 
To view, visit https://gerrit.ovirt.org/38242
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0e912c9b2950f1461ae95f4704f18b818b83a3b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Maor Lipchuk <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to