Mike Kolesnik has uploaded a new change for review. Change subject: engine: Added runtime custom properties ......................................................................
engine: Added runtime custom properties Added custom properties that can be set at runtime, so that a hook can be passed properties by the engine itself. Change-Id: Iea0b33f9e57a35780fd71b9c3bbb77008de04087 Signed-off-by: Mike Kolesnik <[email protected]> --- 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/vmproperties/VmPropertiesUtils.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java 3 files changed, 15 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/11031/1 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 27b859f..0b6061c 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 @@ -30,6 +30,8 @@ private List<Snapshot> snapshots = new ArrayList<Snapshot>(); private boolean runOnce = false; + private Map<String, String> runtimeCustomProperties = new HashMap<String, String>(); + public String getUserDefinedProperties() { return vmStatic.getUserDefinedProperties(); } @@ -54,6 +56,14 @@ vmStatic.setPredefinedProperties(predefinedProperties); } + public Map<String, String> getRuntimeCustomProperties() { + return runtimeCustomProperties; + } + + public void setRuntimeCustomProperties(Map<String, String> runtimeCustomProperties) { + this.runtimeCustomProperties = runtimeCustomProperties; + } + public VM() { vmStatic = new VmStatic(); vmDynamic = new VmDynamic(); diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java index 6f326e0..53a7dbf 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/vmproperties/VmPropertiesUtils.java @@ -13,6 +13,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; +import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VmStatic; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; @@ -271,9 +272,11 @@ * * @return map containing the VM custom properties */ - public Map<String, String> getVMProperties(Version version, VmStatic vmStatic) { + public Map<String, String> getVMProperties(Version version, VM vm) { + VmStatic vmStatic = vm.getStaticData(); separeteCustomPropertiesToUserAndPredefined(version, vmStatic); Map<String, String> map = new HashMap<String, String>(); + map.putAll(vm.getRuntimeCustomProperties()); getPredefinedProperties(version, vmStatic, map); getUserDefinedProperties(version, vmStatic, map); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java index 0b6de75..6d2b8ea 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java @@ -67,8 +67,7 @@ .toLowerCase()); createInfo.add(VdsProperties.Custom, - VmPropertiesUtils.getInstance().getVMProperties(vm.getVdsGroupCompatibilityVersion(), - vm.getStaticData())); + VmPropertiesUtils.getInstance().getVMProperties(vm.getVdsGroupCompatibilityVersion(), vm)); createInfo.add(VdsProperties.vm_type, "kvm"); // "qemu", "kvm" if (vm.isRunAndPause()) { createInfo.add(VdsProperties.launch_paused_param, "true"); -- To view, visit http://gerrit.ovirt.org/11031 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iea0b33f9e57a35780fd71b9c3bbb77008de04087 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Mike Kolesnik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
