Arik Hadas has uploaded a new change for review. Change subject: core: backward compatibility for monitor devices ......................................................................
core: backward compatibility for monitor devices Before v3.1 we used to have just one item for monitors in the OVF file which contained an element called VirtualQuantity that represented the number of monitors the VM has. Now we're setting monitor device per monitor item in the OVF file, assuming that we have a separate item for each monitor. Since it doesn't hold for OVF that was created in versions which are earlier that 3.1, when we import a VM that was exported in version 3.0 and below, it will always have just one monitor device. The solution is that in case we import a VM that was exported in version which is early than 3.1, the number of monitor devices that will be created will be according to the VirtualQuantity value. Change-Id: I00a88f7856bc7f356f3ac5fd6eac8e432f659d09 Bug-Url: https://bugzilla.redhat.com/1024636 Signed-off-by: Arik Hadas <aha...@redhat.com> --- M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java 1 file changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/24057/1 diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java index ee5a7db..71dcb19 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java @@ -19,6 +19,7 @@ import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; import org.ovirt.engine.core.common.utils.VmDeviceCommonUtils; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.core.compat.backendcompat.XmlDocument; import org.ovirt.engine.core.compat.backendcompat.XmlNode; import org.ovirt.engine.core.compat.backendcompat.XmlNodeList; @@ -119,7 +120,15 @@ if (node.SelectSingleNode("rasd:SinglePciQxl", _xmlNS) != null) { _vm.setSingleQxlPci(Boolean.parseBoolean(node.SelectSingleNode("rasd:SinglePciQxl", _xmlNS).InnerText)); } - readVmDevice(node, _vm.getStaticData(), Guid.newGuid(), Boolean.TRUE); + if (new Version(getVersion()).compareTo(Version.v3_1) >= 0) { + readVmDevice(node, _vm.getStaticData(), Guid.newGuid(), Boolean.TRUE); + } else { + // before v3.1 we had just one monitor item for all the monitors so in this + // case we need to add monitor devices according to the numOfMonitors field + for (int i=0; i<_vm.getStaticData().getNumOfMonitors(); ++i) { + readVmDevice(node, _vm.getStaticData(), Guid.newGuid(), Boolean.TRUE); + } + } } else if (OvfHardware.CD.equals(resourceType)) { readVmDevice(node, _vm.getStaticData(), Guid.newGuid(), Boolean.TRUE); } else if (OvfHardware.OTHER.equals(resourceType)) { -- To view, visit http://gerrit.ovirt.org/24057 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I00a88f7856bc7f356f3ac5fd6eac8e432f659d09 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches