rafaelweingartner closed pull request #2607: Allow changing disk offering of 
VMs' root volume during volume migration
URL: https://github.com/apache/cloudstack/pull/2607
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java 
b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index 2caeaec3b79..2cf55d17e25 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -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.");
         }
@@ -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()));
     }
 
     /**
diff --git 
a/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java 
b/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java
index 28937ec1b3f..55dda533193 100644
--- a/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java
+++ b/server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java
@@ -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);
 
@@ -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();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to