Source:
<code>protected boolean validateCanResizeDisk() { DiskImage newDiskImage = (DiskImage) getNewDisk(); DiskImage oldDiskImage = (DiskImage) getOldDisk(); if (newDiskImage.getSize() != oldDiskImage.getSize()) { if (Boolean.TRUE.equals(getVmDeviceForVm().getIsReadOnly())) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK); } if (vmDeviceForVm.getSnapshotId() != null) { DiskImage snapshotDisk = getDiskImageDao().getDiskSnapshotForVmSnapshot(getParameters().getDiskId(), vmDeviceForVm.getSnapshotId()); if (snapshotDisk.getSize() != newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_DISK_SNAPSHOT); } } if (oldDiskImage.getSize() > newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL); } for (VM vm : getVmsDiskPluggedTo()) { if (!VdcActionUtils.canExecute(Collections.singletonList(vm), VM.class, VdcActionType.ExtendImageSize)) { <START> return failVmStatusIllegal(); <END> } } StorageDomainValidator storageDomainValidator = getStorageDomainValidator((DiskImage) getNewDisk()); if (!validate(storageDomainValidator.isDomainExistAndActive())) { return false; } long additionalDiskSpaceInGB = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); DiskImage dummyForValidation = DiskImage.copyOf(newDiskImage); dummyForValidation.setSizeInGigabytes(additionalDiskSpaceInGB); return validate(storageDomainValidator.hasSpaceForNewDisk(dummyForValidation)); } return true; }</code><technical_language>if vm.getStatus getVm().getStatus() in method</technical_language>

Target:
protected boolean validateCanResizeDisk() { DiskImage newDiskImage = (DiskImage) getNewDisk(); DiskImage oldDiskImage = (DiskImage) getOldDisk(); if (newDiskImage.getSize() != oldDiskImage.getSize()) { if (Boolean.TRUE.equals(getVmDeviceForVm().getIsReadOnly())) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK); } if (vmDeviceForVm.getSnapshotId() != null) { DiskImage snapshotDisk = getDiskImageDao().getDiskSnapshotForVmSnapshot(getParameters().getDiskId(), vmDeviceForVm.getSnapshotId()); if (snapshotDisk.getSize() != newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_DISK_SNAPSHOT); } } if (oldDiskImage.getSize() > newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL); } for (VM vm : getVmsDiskPluggedTo()) { if (!VdcActionUtils.canExecute(Collections.singletonList(vm), VM.class, VdcActionType.ExtendImageSize)) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(vm.getStatus())); } } StorageDomainValidator storageDomainValidator = getStorageDomainValidator((DiskImage) getNewDisk()); if (!validate(storageDomainValidator.isDomainExistAndActive())) { return false; } long additionalDiskSpaceInGB = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); DiskImage dummyForValidation = DiskImage.copyOf(newDiskImage); dummyForValidation.setSizeInGigabytes(additionalDiskSpaceInGB); return validate(storageDomainValidator.hasSpaceForNewDisk(dummyForValidation)); } return true; }