Moti Asayag has uploaded a new change for review.

Change subject: engine: Use VmDevice.id to identify the vm device instance
......................................................................

engine: Use VmDevice.id to identify the vm device instance

The VmDevice.Id is sufficient to identify the existence of
the device within a map, rather using the entire device
which could be modified by other flows in the system (i.e.
update boot sequence).

Change-Id: Id0a976e31e97c1f250e29db9166e60ccba4b4a94
Bug-Url: https://bugzilla.redhat.com/1105842
Bug-Url: https://bugzilla.redhat.com/1136031
Signed-off-by: Moti Asayag <masa...@redhat.com>
(cherry picked from commit 06e1857bf4b2a3f8c81c4399c5799e9beb6e67c7)
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/serialization/json/JsonVmMixIn.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
5 files changed, 9 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/32275/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 6a93285..6c4be38 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -503,7 +503,7 @@
                 NetworkProviderProxy providerProxy = 
ProviderProxyFactory.getInstance().create(provider);
                 Map<String, String> deviceProperties = 
providerProxy.allocate(network, vnicProfile, iface);
 
-                getVm().getRuntimeDeviceCustomProperties().put(vmDevice, 
deviceProperties);
+                
getVm().getRuntimeDeviceCustomProperties().put(vmDevice.getId(), 
deviceProperties);
             }
         }
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java
index 94f350d..7072a63 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java
@@ -152,7 +152,7 @@
                 getProviderProxy().allocate(getNetwork(), vnicProfile, 
getParameters().getNic());
 
         if (runtimeProperties != null) {
-            getVm().getRuntimeDeviceCustomProperties().put(vmDevice, 
runtimeProperties);
+            getVm().getRuntimeDeviceCustomProperties().put(vmDevice.getId(), 
runtimeProperties);
         }
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
index f6048bf..f5de914 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
@@ -40,7 +40,7 @@
 
     private InitializationType initializationType;
 
-    private Map<VmDevice, Map<String, String>> runtimeDeviceCustomProperties;
+    private Map<VmDeviceId, Map<String, String>> runtimeDeviceCustomProperties;
 
     private ArchitectureType clusterArch;
 
@@ -68,11 +68,11 @@
         vmStatic.setPredefinedProperties(predefinedProperties);
     }
 
-    public Map<VmDevice, Map<String, String>> 
getRuntimeDeviceCustomProperties() {
+    public Map<VmDeviceId, Map<String, String>> 
getRuntimeDeviceCustomProperties() {
         return runtimeDeviceCustomProperties;
     }
 
-    public void setRuntimeDeviceCustomProperties(Map<VmDevice, Map<String, 
String>> runtimeDeviceCustomProperties) {
+    public void setRuntimeDeviceCustomProperties(Map<VmDeviceId, Map<String, 
String>> runtimeDeviceCustomProperties) {
         this.runtimeDeviceCustomProperties = runtimeDeviceCustomProperties;
     }
 
@@ -93,7 +93,7 @@
         balloonEnabled = true;
         snapshots = new ArrayList<Snapshot>();
         initializationType = InitializationType.None;
-        runtimeDeviceCustomProperties = new HashMap<VmDevice, Map<String, 
String>>();
+        runtimeDeviceCustomProperties = new HashMap<VmDeviceId, Map<String, 
String>>();
         vmtCreationDate = new Date(0);
         storagePoolId = Guid.Empty;
     }
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/serialization/json/JsonVmMixIn.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/serialization/json/JsonVmMixIn.java
index a9387bb..3fb2066 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/serialization/json/JsonVmMixIn.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/serialization/json/JsonVmMixIn.java
@@ -11,6 +11,7 @@
 import org.ovirt.engine.core.common.businessentities.DiskImage;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VmDevice;
+import org.ovirt.engine.core.common.businessentities.VmDeviceId;
 import org.ovirt.engine.core.compat.Guid;
 
 @SuppressWarnings("serial")
@@ -31,6 +32,6 @@
 
     @JsonIgnore
     @Override
-    public abstract Map<VmDevice, Map<String, String>> 
getRuntimeDeviceCustomProperties();
+    public abstract Map<VmDeviceId, Map<String, String>> 
getRuntimeDeviceCustomProperties();
 
 }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
index 4dc5444..fab0817 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
@@ -665,7 +665,7 @@
         }
 
         customProperties.putAll(vmDevice.getCustomProperties());
-        Map<String, String> runtimeCustomProperties = 
vm.getRuntimeDeviceCustomProperties().get(vmDevice);
+        Map<String, String> runtimeCustomProperties = 
vm.getRuntimeDeviceCustomProperties().get(vmDevice.getId());
         if (runtimeCustomProperties != null) {
             customProperties.putAll(runtimeCustomProperties);
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0a976e31e97c1f250e29db9166e60ccba4b4a94
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Moti Asayag <masa...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to