Tomas Jelinek has uploaded a new change for review. Change subject: core: copy disks from template instead of instance type ......................................................................
core: copy disks from template instead of instance type When the VM was created from both template and instance type, all the devices (including the disks) were taken from the instance type. The problem is that the disks are supposed to be taken from the template. This patch ensures that if the VM is created from an instance type, the disks are taken from the template. Change-Id: Iaddc4d3da99c0a459c7339639cca15cbb597df18 Signed-off-by: Tomas Jelinek <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java 1 file changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/27630/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java index 961a575..c925218 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java @@ -797,6 +797,34 @@ isVirtioScsiEnabled(), isBalloonEnabled(), false); + + if (instanceTypeId != null) { + copyDiskDevicesFromTemplate(); + } + } + + /** + * If both the instance type and the template is set, than all the devices has to be copied from instance type except the + * disk devices which has to be copied from the template (since the instance type has no disks but the template does have). + */ + private void copyDiskDevicesFromTemplate() { + Guid templateId = getParameters().getVmStaticData().getVmtGuid(); + + List<VmDevice> disks = DbFacade.getInstance().getVmDeviceDao().getVmDeviceByVmIdAndType(templateId, VmDeviceGeneralType.DISK); + VmDeviceUtils.copyVmDevices( + templateId, + getVmId(), + getVm(), + getVm().getStaticData(), + true, + disks, + getSrcDeviceIdToTargetDeviceIdMapping(), + false, + false, + false, + false, + false + ); } protected static boolean isLegalClusterId(Guid clusterId, List<String> reasons) { -- To view, visit http://gerrit.ovirt.org/27630 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaddc4d3da99c0a459c7339639cca15cbb597df18 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
