Juan Hernandez has uploaded a new change for review. Change subject: core: Don't write empty description/comment to OVF ......................................................................
core: Don't write empty description/comment to OVF Currently when we generate OVF files we write the description and comment properties of the VM even if they are null. As a result when a VM without a description or comment is re-imported it has an empty string a value (instead of null) for these properties. This patch changes the OVF writer so that it won't write the description or comment properties if they are null. Change-Id: Iffd0f7010bc32402c45882dc6087bf02a55a14d9 Bug-Url: https://bugzilla.redhat.com/1145466 Signed-off-by: Juan Hernandez <[email protected]> (cherry picked from commit cbd16554817f0373df18018bd65795412972544f) --- M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java 1 file changed, 10 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/33258/1 diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java index 02e0ef6..bbb4c60 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java @@ -233,13 +233,17 @@ } protected void writeGeneralData() { - _writer.WriteStartElement(OvfProperties.DESCRIPTION); - _writer.WriteRaw(vmBase.getDescription()); - _writer.WriteEndElement(); + if (vmBase.getDescription() != null) { + _writer.WriteStartElement(OvfProperties.DESCRIPTION); + _writer.WriteRaw(vmBase.getDescription()); + _writer.WriteEndElement(); + } - _writer.WriteStartElement(OvfProperties.COMMENT); - _writer.WriteRaw(vmBase.getComment()); - _writer.WriteEndElement(); + if (vmBase.getComment() != null) { + _writer.WriteStartElement(OvfProperties.COMMENT); + _writer.WriteRaw(vmBase.getComment()); + _writer.WriteEndElement(); + } if (!vmInitEnabled() && vmBase.getVmInit() != null && vmBase.getVmInit().getDomain() != null) { _writer.WriteStartElement(OvfProperties.DOMAIN); -- To view, visit http://gerrit.ovirt.org/33258 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iffd0f7010bc32402c45882dc6087bf02a55a14d9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
