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/1060705 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/97/23997/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 2259110..920be2d 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 @@ -20,6 +20,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; @@ -171,7 +172,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); + } + } } private void readCdItem(XmlNode node) { -- To view, visit http://gerrit.ovirt.org/23997 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I00a88f7856bc7f356f3ac5fd6eac8e432f659d09 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches