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 <[email protected]>
---
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/34/34734/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 03e6e3a..23d574d 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;
@@ -317,6 +320,7 @@
 
         for (VmTemplate template : templates) {
             if (VmTemplateStatus.Locked != template.getStatus()) {
+                setManagedVideoDevices(template);
                 updateTemplateDisksFromDb(template);
                 boolean verifyDisksNotLocked = 
verifyImagesStatus(template.getDiskList());
                 if (verifyDisksNotLocked) {
@@ -482,6 +486,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()));
         }
@@ -495,6 +500,20 @@
         }
     }
 
+    private void setManagedVideoDevices(VmBase vm) {
+        Map<Guid, VmDevice> managedDeviceMap = vm.getManagedDeviceMap();
+        if (managedDeviceMap == null) {
+            managedDeviceMap = new HashMap<Guid, VmDevice>();
+        }
+        List<VmDevice> devices = 
DbFacade.getInstance().getVmDeviceDao().getVmDeviceByVmId(vm.getId());
+        for (VmDevice device : devices) {
+            if (device.getType() == VmDeviceGeneralType.VIDEO) {
+                managedDeviceMap.put(device.getDeviceId(), device);
+            }
+        }
+        vm.setManagedDeviceMap(managedDeviceMap);
+    }
+
     protected List<DiskImage> getAllImageSnapshots(DiskImage diskImage) {
         return ImagesHandler.getAllImageSnapshots(diskImage.getImageId());
     }


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

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

Reply via email to