rafaelweingartner commented on a change in pull request #2848: Vmware offline 
migration
URL: https://github.com/apache/cloudstack/pull/2848#discussion_r237219175
 
 

 ##########
 File path: 
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
 ##########
 @@ -1988,92 +1977,249 @@ public void storageMigration(final String vmUuid, 
final StoragePool destPool) {
     private void orchestrateStorageMigration(final String vmUuid, final 
StoragePool destPool) {
         final VMInstanceVO vm = _vmDao.findByUuid(vmUuid);
 
-        if (destPool == null) {
-            throw new CloudRuntimeException("Unable to migrate vm: missing 
destination storage pool");
-        }
+        preStorageMigrationStateCheck(destPool, vm);
 
         try {
-            stateTransitTo(vm, VirtualMachine.Event.StorageMigrationRequested, 
null);
-        } catch (final NoTransitionException e) {
-            s_logger.debug("Unable to migrate vm: " + e.toString());
-            throw new CloudRuntimeException("Unable to migrate vm: " + 
e.toString());
+            if(s_logger.isDebugEnabled()) {
+                s_logger.debug(
+                        String.format("Offline migration of %s vm %s with 
volumes",
+                                vm.getHypervisorType().toString(),
+                                vm.getInstanceName()));
+            }
+
+            migrateThroughHypervisorOrStorage(destPool, vm);
+
+        } catch (ConcurrentOperationException
+                | InsufficientCapacityException // possibly 
InsufficientVirtualNetworkCapacityException or 
InsufficientAddressCapacityException
+                | StorageUnavailableException e) {
+            String msg = String.format("Failed to migrate vm: %s" , 
vm.getUuid(), e);
+            s_logger.debug(msg);
+            throw new CloudRuntimeException(msg);
 
 Review comment:
   what about re throwing the exception? So, we do not loose the initial stack 
trace.
   I mean, you can send the original exception in the new 
`CloudRuntimeException`

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to