Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2125,9 +2125,6 @@ protected void validateConditionsToReplaceDiskOfferingOfVolume(VolumeVO volume,
if (newDiskOffering == null) {
return;
}
if (Volume.Type.ROOT.equals(volume.getVolumeType())) {
throw new InvalidParameterValueException(String.format("Cannot change the disk offering of a ROOT volume [id=%s].", volume.getUuid()));
}
if ((destPool.isShared() && newDiskOffering.getUseLocalStorage()) || destPool.isLocal() && newDiskOffering.isShared()) {
throw new InvalidParameterValueException("You cannot move the volume to a shared storage and assing a disk offering for local storage and vice versa.");
}
Expand All @@ -2142,7 +2139,7 @@ protected void validateConditionsToReplaceDiskOfferingOfVolume(VolumeVO volume,
"You are migrating a volume [id=%s] and changing the disk offering[from id=%s to id=%s] to reflect this migration. However, the sizes of the volume and the new disk offering are different.",
volume.getUuid(), oldDiskOffering.getUuid(), newDiskOffering.getUuid()));
}

s_logger.info(String.format("Changing disk offering to [uuid=%s] while migrating volume [uuid=%s, name=%s].", newDiskOffering.getUuid(), volume.getUuid(), volume.getName()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ public void validateConditionsToReplaceDiskOfferingOfVolumeTestNoNewDiskOffering
Mockito.verify(volumeVOMock, times(0)).getVolumeType();
}

@Test(expected = InvalidParameterValueException.class)
@Test
public void validateConditionsToReplaceDiskOfferingOfVolumeTestRootVolume() {
Mockito.when(volumeVOMock.getVolumeType()).thenReturn(Type.ROOT);

Expand Down Expand Up @@ -575,7 +575,6 @@ public void validateConditionsToReplaceDiskOfferingOfVolumeTestEverythingWorking
volumeApiServiceImpl.validateConditionsToReplaceDiskOfferingOfVolume(volumeVOMock, newDiskOfferingMock, storagePoolMock);

InOrder inOrder = Mockito.inOrder(volumeVOMock, newDiskOfferingMock, storagePoolMock, volumeApiServiceImpl);
inOrder.verify(volumeVOMock).getVolumeType();
inOrder.verify(storagePoolMock).isShared();
inOrder.verify(newDiskOfferingMock).getUseLocalStorage();
inOrder.verify(storagePoolMock).isLocal();
Expand Down