Allon Mureinik has posted comments on this change. Change subject: core,webadmin: Plug disk to VM when adding a new disk ......................................................................
Patch Set 2: Code-Review-1 (6 comments) @Tal - see comments inline @Cheryn - could you please take a look at backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties ? thanks! .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java Line 98: return false; Line 99: } Line 100: } Line 101: else { Line 102: if (getParameters().getPlugDiskToVm()) { Agreed. Should be: else if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm())) Line 103: return failCanDoAction(VdcBllMessages.CANNOT_ADD_FLOATING_DISK_WITH_PLUG_VM_SET); Line 104: } Line 105: } Line 106: Line 367: StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); Line 368: getBaseDiskDao().save(getParameters().getDiskInfo()); Line 369: getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); Line 370: if (getVm() != null) { Line 371: boolean shouldPlugDisk = getVm().getStatus() == VMStatus.Down && (getParameters().getPlugDiskToVm() == null || getParameters().getPlugDiskToVm()); This seems a wrong - you will ONLY plug if the vm is down. Probably should be something like this: Boolean plugParam = getParameters().getPlugDiskToVm()); boolean shouldPlugDisk = Boolean.TRUE.equals(plugParam) || (plugParam == null && getVm().getStatus() == VMStatus.Down); Line 372: VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), Line 373: VmDeviceGeneralType.DISK, Line 374: VmDeviceType.DISK, Line 375: null, Line 403: parameters.setStoragePoolId(getStorageDomain().getStoragePoolId()); Line 404: parameters.setParentParameters(getParameters()); Line 405: if (getVm() != null) { Line 406: setVmSnapshotIdForDisk(parameters); Line 407: boolean shouldPlugDisk = getVm().getStatus() == VMStatus.Down && (getParameters().getPlugDiskToVm() == null || getParameters().getPlugDiskToVm()); agreed. see also correction to logic in the comment above. Line 408: getCompensationContext().snapshotNewEntity(VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo() Line 409: .getId(), Line 410: getVmId()), Line 411: VmDeviceGeneralType.DISK, Line 555: } Line 556: Line 557: private void plugDiskToVmIfNeeded() { Line 558: if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm()) && getVm() != null && getVm().getStatus() != VMStatus.Down) { Line 559: HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(getVmId(), getParameters().getDiskInfo().getId()); what lock are you reffering to? Line 560: VdcReturnValueBase returnValue = Backend.getInstance().runInternalAction(VdcActionType.HotPlugDiskToVm, params); Line 561: if (!returnValue.getSucceeded()) { Line 562: AuditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK); Line 563: } .................................................... File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddDiskToVmCommandTest.java Line 733: CanDoActionTestUtils.runAndAssertCanDoActionSuccess(command); Line 734: } Line 735: Line 736: @Test Line 737: public void testCanDoFailOnAddDiskFloatingDiskWithPlugSet() { +1 Line 738: DiskImage disk = createDiskImage(1); Line 739: Line 740: AddDiskParameters parameters = createParameters(); Line 741: parameters.setDiskInfo(disk); .................................................... File backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties Line 865: ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Guest OS version is not supported. Line 866: HOT_PLUG_DISK_IS_NOT_VIRTIO=Can plug only virtIO disks. Line 867: HOT_PLUG_DISK_IS_NOT_UNPLUGGED=Disk is already activated. Line 868: HOT_UNPLUG_DISK_IS_NOT_PLUGGED=Disk is already deactivated. Line 869: CANNOT_ADD_FLOATING_DISK_WITH_PLUG_VM_SET=Cannot ${action} ${type}. Plug disk to VM was set while the disk was added as a floating disk. I do not understand this error. Line 870: ACTIVATE_DEACTIVATE_NIC_VM_STATUS_ILLEGAL=Cannot activate/deactivate VM Network Interface due to VM status. The VM status must be Down or Up. Line 871: ACTIVATE_DEACTIVATE_NETWORK_NOT_IN_VDS=The Network does not exist on the host the VM is running on.\n Either add the Network to the Host or migrate the VM to a Host that has this Network. Line 872: VM_CANNOT_RUN_FROM_DISK_WITHOUT_PLUGGED_DISK=Cannot ${action} ${type} without at least one active disk.\nPlease activate a disk and rerun the VM. Line 873: SHAREABLE_DISK_IS_NOT_SUPPORTED_FOR_DISK=Cannot ${action} ${type}. Disk cannot be shareable if it depends on a snapshot. In order to share it, remove the disk's snapshots. -- To view, visit http://gerrit.ovirt.org/21851 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia9778bcaf21b346a55992590159cabd8d78f0c66 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Ayal Baron <aba...@redhat.com> Gerrit-Reviewer: Cheryn Tan <cheryn...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Liron Ar <lara...@redhat.com> Gerrit-Reviewer: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches