Maor Lipchuk has uploaded a new change for review.

Change subject: core: Add Video managed device for VM's/Template's OVF.
......................................................................

core: Add Video managed device for VM's/Template's OVF.

The number of monitors data in the Template should be part of the OVF
data.
so the information will still be availale after the attach of
a Storage Domain with import of existing entities.

This information consists in the video device of the entity, therefore
the fix adds video devices while building the OVF data, same as being
done in the export VM/Template process.

Change-Id: I5583edadd75bce7dfb3f5ba04cfcbe38f1dc7091
Bug-Url: https://bugzilla.redhat.com/1136902
Signed-off-by: Maor Lipchuk <mlipc...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/35448/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
index 184a9ef..4cb75ce 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
@@ -29,6 +29,9 @@
 import org.ovirt.engine.core.common.businessentities.StoragePoolStatus;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
+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.businessentities.VmTemplateStatus;
 import org.ovirt.engine.core.common.config.Config;
@@ -467,6 +470,7 @@
      * Loads additional need template data for it's ovf
      */
     protected void loadTemplateData(VmTemplate template) {
+        setManagedVideoDevices(template);
         if (template.getInterfaces() == null || 
template.getInterfaces().isEmpty()) {
             template.setInterfaces(getVmNetworkInterfaceDao()
                     .getAllForTemplate(template.getId()));
@@ -477,6 +481,7 @@
      * Loads additional need vm data for it's ovf
      */
     protected void loadVmData(VM vm) {
+        setManagedVideoDevices(vm.getStaticData());
         if (vm.getInterfaces().isEmpty()) {
             
vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId()));
         }
@@ -490,6 +495,20 @@
         }
     }
 
+    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);
+        }
+    }
+
     protected List<DiskImage> getAllImageSnapshots(DiskImage diskImage) {
         return ImagesHandler.getAllImageSnapshots(diskImage.getImageId());
     }


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

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

Reply via email to