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 Signed-off-by: Moti Asayag <[email protected]> --- 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/56/28456/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 4596226..d39c2b3 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 @@ -530,7 +530,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 b5af69a..88fd3fb 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; @@ -70,11 +70,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; } @@ -96,7 +96,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 7d2bee2..c235115 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 @@ -660,7 +660,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/28456 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id0a976e31e97c1f250e29db9166e60ccba4b4a94 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
